po: Fix message format warnings printed from xgettext
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
7b98850fdf
commit
fec9f0b136
|
@ -858,7 +858,7 @@ c.add_invalid("--cdrom %(EXISTIMG1)s --extra-args console=ttyS0") # cdrom fail
|
|||
c.add_invalid("--hvm --boot kernel=%(TREEDIR)s/pxeboot/vmlinuz,initrd=%(TREEDIR)s/pxeboot/initrd.img,kernel_args='foo bar' --initrd-inject virt-install") # initrd-inject with manual kernel/initrd
|
||||
c.add_invalid("--disk none --location kernel=/dev/null,initrd=/dev/null") # --location with manual kernel/initrd, but not URL
|
||||
c.add_invalid("--install winxp", grep="does not have a URL location") # no URL for winxp
|
||||
c.add_invalid("--arch i686 --install fedora26", grep="does not have a URL location for the i686") # there's no URL for i686
|
||||
c.add_invalid("--arch i686 --install fedora26", grep="does not have a URL location for the architecture 'i686") # there's no URL for i686
|
||||
c.add_invalid("-c foo --cdrom bar", grep="Cannot specify both -c") # check for ambiguous -c and --cdrom collision
|
||||
c.add_invalid("-c qemu:///system", grep="looks like a libvirt URI") # error for the ambiguous -c vs --connect
|
||||
c.add_invalid("--location /", grep="Error validating install location") # detect_distro failure
|
||||
|
|
|
@ -806,9 +806,10 @@ class vmmCloneVM(vmmGObjectUI):
|
|||
self.reset_finish_cursor()
|
||||
|
||||
if error is not None:
|
||||
error = (_("Error creating virtual machine clone '%s': %s") %
|
||||
(self.clone_design.clone_name, error))
|
||||
self.err.show_err(error, details=details)
|
||||
msg = (_("Error creating virtual machine clone '%s'") %
|
||||
self.clone_design.clone_name)
|
||||
msg += ": %s" % error
|
||||
self.err.show_err(msg, details=details)
|
||||
return
|
||||
|
||||
conn.schedule_priority_tick(pollvm=True)
|
||||
|
|
|
@ -598,12 +598,12 @@ class vmmConnection(vmmGObject):
|
|||
except Exception as fixerr:
|
||||
log.debug("Failed to redefine original %s!",
|
||||
obj.class_name(), exc_info=True)
|
||||
raise RuntimeError(
|
||||
_("%s rename failed. Attempting to recover also "
|
||||
"failed.\n\n"
|
||||
"Original error: %s\n\n"
|
||||
"Recover error: %s" %
|
||||
(obj.class_name(), str(renameerr), str(fixerr))))
|
||||
msg = (_("%s rename failed. Attempting to "
|
||||
"recover also failed") % (obj.class_name()))
|
||||
msg += "\n\n"
|
||||
msg += ("Original error: %s\n\n" % str(renameerr))
|
||||
msg += ("Recover error: %s" % str(fixerr))
|
||||
raise RuntimeError(msg)
|
||||
raise
|
||||
finally:
|
||||
if newobj:
|
||||
|
|
|
@ -199,8 +199,9 @@ class _vmmDeleteBase(vmmGObjectUI):
|
|||
|
||||
self._delete_vm(vm)
|
||||
except Exception as e:
|
||||
error = (_("Error deleting virtual machine '%s': %s") %
|
||||
(vm.get_name(), str(e)))
|
||||
error = (
|
||||
(_("Error deleting virtual machine '%s'") % vm.get_name()) +
|
||||
(": %s") % str(e))
|
||||
details = "".join(traceback.format_exc())
|
||||
|
||||
storage_errstr = ""
|
||||
|
|
|
@ -225,8 +225,8 @@ def _label_for_device(dev):
|
|||
pretty = vmmGraphicsDetails.graphics_pretty_type_simple(dev.type)
|
||||
return _("Display %s") % pretty
|
||||
if devtype == "redirdev":
|
||||
return _("%s Redirector %s") % (dev.bus.upper(),
|
||||
dev.get_xml_idx() + 1)
|
||||
return (_("%s Redirector") % (dev.bus.upper()) +
|
||||
(" %s" % (dev.get_xml_idx() + 1)))
|
||||
if devtype == "hostdev":
|
||||
return vmmAddHardware.hostdev_pretty_name(dev)
|
||||
if devtype == "sound":
|
||||
|
@ -234,10 +234,10 @@ def _label_for_device(dev):
|
|||
if devtype == "video":
|
||||
return _("Video %s") % vmmAddHardware.video_pretty_model(dev.model)
|
||||
if devtype == "filesystem":
|
||||
return _("Filesystem %s") % dev.target[:8]
|
||||
return _("Filesystem") + (" %s" % dev.target[:8])
|
||||
if devtype == "controller":
|
||||
return _("Controller %s %s") % (
|
||||
vmmAddHardware.controller_pretty_desc(dev), dev.index)
|
||||
return _("Controller") + (" %s %s" % (
|
||||
vmmAddHardware.controller_pretty_desc(dev), dev.index))
|
||||
if devtype == "rng":
|
||||
label = _("RNG")
|
||||
if dev.device:
|
||||
|
@ -1600,9 +1600,10 @@ class vmmDetails(vmmGObjectUI):
|
|||
|
||||
names = virtinst.DeviceDisk.path_in_use_by(devobj.conn, path)
|
||||
if names:
|
||||
res = self.err.yes_no(
|
||||
_('Disk "%s" is already in use by other guests %s') %
|
||||
(path, names),
|
||||
msg = (_("Disk '%(path)s' is already in use by other "
|
||||
"guests %(names)s") %
|
||||
{"path": path, "names": names})
|
||||
res = self.err.yes_no(msg,
|
||||
_("Do you really want to use the disk?"))
|
||||
if not res:
|
||||
return False
|
||||
|
@ -2175,7 +2176,7 @@ class vmmDetails(vmmGObjectUI):
|
|||
def refresh_redir_page(self, rd):
|
||||
address = None
|
||||
if rd.type == 'tcp':
|
||||
address = _("%s:%s") % (rd.source.host, rd.source.service)
|
||||
address = "%s:%s" % (rd.source.host, rd.source.service)
|
||||
|
||||
self.widget("redir-title").set_markup(_label_for_device(rd))
|
||||
self.widget("redir-type").set_text(
|
||||
|
|
|
@ -651,13 +651,15 @@ class vmmSnapshotPage(vmmGObjectUI):
|
|||
return
|
||||
|
||||
snap = snaps[0]
|
||||
msg = _("Are you sure you want to run snapshot '%s'? "
|
||||
"All %s changes since the last snapshot was created will be "
|
||||
"discarded.")
|
||||
if self.vm.is_active():
|
||||
msg = msg % (snap.get_name(), _("disk"))
|
||||
else:
|
||||
msg = msg % (snap.get_name(), _("disk and configuration"))
|
||||
|
||||
label = _("disk")
|
||||
if not self.vm.is_active():
|
||||
label = _("disk and configuration")
|
||||
|
||||
msg = (_("Are you sure you want to run snapshot '%(name)s'? "
|
||||
"All %(changetype)s changes since the last snapshot was "
|
||||
"created will be discarded.") %
|
||||
{"name": snap.get_name(), "changetype": label})
|
||||
|
||||
result = self.err.yes_no(msg)
|
||||
if not result:
|
||||
|
|
|
@ -460,8 +460,9 @@ class VNCViewer(Viewer):
|
|||
sock.connect(self._ginfo.gsocket)
|
||||
self._sockfd = sock
|
||||
except Exception as e:
|
||||
raise RuntimeError(_("Error opening socket path '%s': %s") %
|
||||
(self._ginfo.gsocket, e))
|
||||
raise RuntimeError(
|
||||
(_("Error opening socket path '%s'") % self._ginfo.gsocket) +
|
||||
(": %s" % e))
|
||||
|
||||
fd = self._sockfd.fileno()
|
||||
if fd < 0:
|
||||
|
|
|
@ -209,9 +209,10 @@ class vmmAddStorage(vmmGObjectUI):
|
|||
# Disk collision
|
||||
names = disk.is_conflict_disk()
|
||||
if names:
|
||||
res = self.err.yes_no(
|
||||
_('Disk "%s" is already in use by other guests %s') %
|
||||
(disk.path, names),
|
||||
msg = (_("Disk '%(path)s' is already in use by other "
|
||||
"guests %(names)s") %
|
||||
{"path": disk.path, "names": names})
|
||||
res = self.err.yes_no(msg,
|
||||
_("Do you really want to use the disk?"))
|
||||
if not res:
|
||||
return False
|
||||
|
|
|
@ -210,8 +210,9 @@ class vmmNetworkList(vmmGObjectUI):
|
|||
netobj.start()
|
||||
log.debug("Started network '%s'", devname)
|
||||
except Exception as e:
|
||||
return self.err.show_err(_("Could not start virtual network "
|
||||
"'%s': %s") % (devname, str(e)))
|
||||
return self.err.show_err(
|
||||
(_("Could not start virtual network '%s'") % devname) +
|
||||
(": %s") % str(e))
|
||||
|
||||
def _find_rowiter_for_dev(self, net):
|
||||
nettype = net.type
|
||||
|
|
|
@ -318,8 +318,9 @@ class vmmHostStorage(vmmGObjectUI):
|
|||
self.widget("pool-name-entry").set_text(pool.get_name())
|
||||
self.widget("pool-name-entry").set_editable(not active)
|
||||
self.widget("pool-sizes").set_markup(
|
||||
_("%s Free / <i>%s In Use</i>") %
|
||||
(pool.get_pretty_available(), pool.get_pretty_allocation()))
|
||||
_("%(bytesfree)s Free / <i>%(bytesinuse)s In Use</i>") %
|
||||
{"bytesfree": pool.get_pretty_available(),
|
||||
"bytesinuse": pool.get_pretty_allocation()})
|
||||
self.widget("pool-location").set_text(
|
||||
pool.get_target_path())
|
||||
self.widget("pool-state-icon").set_from_icon_name(
|
||||
|
|
|
@ -399,8 +399,8 @@ class vmmMigrateDialog(vmmGObjectUI):
|
|||
[self.vm, destconn, uri, tunnel, unsafe, temporary],
|
||||
self._finish_cb, [destconn],
|
||||
_("Migrating VM '%s'") % self.vm.get_name(),
|
||||
(_("Migrating VM '%s' to %s. This may take a while.") %
|
||||
(self.vm.get_name(), destlabel)),
|
||||
(_("Migrating VM '%(name)s' to %(host)s. This may take a while.") %
|
||||
{"name": self.vm.get_name(), "host": destlabel}),
|
||||
self.topwin, cancel_cb=cancel_cb)
|
||||
progWin.run()
|
||||
|
||||
|
|
|
@ -305,10 +305,12 @@ def check_path_search(conn, path):
|
|||
searchdata = DeviceDisk.check_path_search(conn, path)
|
||||
if not searchdata.fixlist:
|
||||
return
|
||||
log.warning(_("%s may not be accessible by the hypervisor. "
|
||||
"You will need to grant the '%s' user search permissions for "
|
||||
"the following directories: %s"),
|
||||
path, searchdata.user, searchdata.fixlist) # pragma: no cover
|
||||
msg = ( # pragma: no cover
|
||||
_("%(path)s may not be accessible by the hypervisor. "
|
||||
"You will need to grant the '%(user)s' user search permissions for "
|
||||
"the following directories: %(dirs)s") %
|
||||
{"path": path, "user": searchdata.user, "dirs": searchdata.fixlist})
|
||||
log.warning(msg) # pragma: no cover
|
||||
|
||||
|
||||
def _optional_fail(msg, checkname, warn_on_skip=True):
|
||||
|
@ -360,9 +362,9 @@ def validate_disk(dev, warn_overwrite=False):
|
|||
if not names:
|
||||
return
|
||||
|
||||
_optional_fail(_("Disk %s is already in use by other guests %s." %
|
||||
(dev.path, names)),
|
||||
"path_in_use")
|
||||
msg = (_("Disk %(path)s is already in use by other guests %(names)s.") %
|
||||
{"path": dev.path, "names": names})
|
||||
_optional_fail(msg, "path_in_use")
|
||||
|
||||
def check_size_conflict(dev):
|
||||
"""
|
||||
|
@ -487,7 +489,8 @@ def get_domain_and_guest(conn, domstr):
|
|||
else:
|
||||
raise
|
||||
except libvirt.libvirtError as e:
|
||||
fail(_("Could not find domain '%s': %s") % (domstr, e))
|
||||
fail((_("Could not find domain '%s'") % domstr) +
|
||||
(": " + str(e)))
|
||||
|
||||
state = domain.info()[0]
|
||||
active_xmlobj = None
|
||||
|
@ -1453,8 +1456,9 @@ class VirtCLIParser(metaclass=_InitClass):
|
|||
passed an invalid argument such as --disk idontexist=foo
|
||||
"""
|
||||
if optdict:
|
||||
fail(_("Unknown %s options: %s") %
|
||||
(self.cli_flag_name(), list(optdict.keys())))
|
||||
fail(_("Unknown %(optionflag)s options: %(string)s") %
|
||||
{"optionflag": self.cli_flag_name(),
|
||||
"string": list(optdict.keys())})
|
||||
|
||||
def _parse(self, inst):
|
||||
"""
|
||||
|
@ -3148,7 +3152,8 @@ class ParserDisk(VirtCLIParser):
|
|||
# It's default. Nothing to do.
|
||||
pass
|
||||
else:
|
||||
fail(_("Unknown '%s' value '%s'") % ("perms", val))
|
||||
fail(_("Unknown '%(optionname)s' value '%(string)'") %
|
||||
{"optionname": "perms", "string": val})
|
||||
|
||||
backing_store = self.optdict.pop("backing_store", None)
|
||||
backing_format = self.optdict.pop("backing_format", None)
|
||||
|
|
|
@ -42,8 +42,9 @@ def _replace_vm(conn, name):
|
|||
log.debug("Undefining guest '%s'", name)
|
||||
vm.undefine()
|
||||
except libvirt.libvirtError as e: # pragma: no cover
|
||||
raise RuntimeError(_("Could not remove old vm '%s': %s") %
|
||||
(str(e)))
|
||||
raise RuntimeError(
|
||||
(_("Could not remove old vm '%s'") % name) +
|
||||
(": " + str(e)))
|
||||
|
||||
|
||||
class Cloner(object):
|
||||
|
@ -156,8 +157,9 @@ class Cloner(object):
|
|||
disklist.append(disk)
|
||||
except Exception as e:
|
||||
log.debug("Error setting clone path.", exc_info=True)
|
||||
raise ValueError(_("Could not use path '%s' for cloning: %s") %
|
||||
(path, str(e)))
|
||||
raise ValueError(
|
||||
(_("Could not use path '%s' for cloning") % path) +
|
||||
(": " + str(e)))
|
||||
|
||||
self._clone_disks = disklist
|
||||
def get_clone_paths(self):
|
||||
|
|
|
@ -61,7 +61,7 @@ class DeviceAddress(XMLBuilder):
|
|||
def pretty_desc(self):
|
||||
pretty_desc = None
|
||||
if self.type == self.ADDRESS_TYPE_DRIVE:
|
||||
pretty_desc = _("%s:%s:%s:%s" %
|
||||
pretty_desc = ("%s:%s:%s:%s" %
|
||||
(self.controller, self.bus, self.target, self.unit))
|
||||
return pretty_desc
|
||||
|
||||
|
|
|
@ -849,8 +849,9 @@ class DeviceDisk(Device):
|
|||
self.target = ret
|
||||
return ret
|
||||
|
||||
raise ValueError(_("Only %s disks for bus '%s' are supported"
|
||||
% (maxnode, self.bus)))
|
||||
raise ValueError(
|
||||
_("Only %(number)s disks for bus '%(bus)s' are supported") %
|
||||
{"number": maxnode, "bus": self.bus})
|
||||
|
||||
def change_bus(self, guest, newbus):
|
||||
"""
|
||||
|
|
|
@ -534,8 +534,10 @@ class CloneStorageCreator(_StorageCreator):
|
|||
|
||||
|
||||
if msg:
|
||||
msg += (_(" %d M requested > %d M available") %
|
||||
((need // (1024 * 1024)), (avail // (1024 * 1024))))
|
||||
msg += " "
|
||||
msg += (_("%(mem1)s M requested > %(mem2)s M available") %
|
||||
{"mem1": (need // (1024 * 1024)),
|
||||
"mem2": (avail // (1024 * 1024))})
|
||||
return (ret, msg)
|
||||
|
||||
def validate(self):
|
||||
|
@ -620,8 +622,12 @@ class CloneStorageCreator(_StorageCreator):
|
|||
if i < size_bytes:
|
||||
meter.update(i)
|
||||
except OSError as e: # pragma: no cover
|
||||
raise RuntimeError(_("Error cloning diskimage %s to %s: %s") %
|
||||
(self._input_path, self._output_path, str(e)))
|
||||
msg = (_("Error cloning diskimage "
|
||||
"%(inputpath)s to %(outputpath)s") %
|
||||
{"inputpath": self._input_path,
|
||||
"outputpath": self._output_path})
|
||||
msg += ": " + str(e)
|
||||
raise RuntimeError(msg)
|
||||
finally:
|
||||
if src_fd is not None:
|
||||
os.close(src_fd)
|
||||
|
|
|
@ -259,8 +259,10 @@ class Installer(object):
|
|||
ram = guest.osinfo.get_network_install_required_ram(guest)
|
||||
ram = (ram or 0) // 1024
|
||||
if ram > guest.currentMemory:
|
||||
log.warning(_("Overriding memory to %s MiB needed for %s "
|
||||
"network install."), ram // 1024, guest.osinfo.name)
|
||||
msg = (_("Overriding memory to %(number)s MiB needed for "
|
||||
"%(osname)s network install.") %
|
||||
{"number": ram // 1024, "osname": guest.osinfo.name})
|
||||
log.warning(msg)
|
||||
guest.currentMemory = ram
|
||||
|
||||
|
||||
|
|
|
@ -67,8 +67,9 @@ class InstallerTreeMedia(object):
|
|||
"like HTTP, or manually mount the NFS share and install "
|
||||
"from the local directory mount point.")
|
||||
|
||||
raise ValueError(_("Validating install media '%s' failed: %s") %
|
||||
(str(path), e))
|
||||
raise ValueError(
|
||||
(_("Validating install media '%s' failed") % str(path)) +
|
||||
(": %s" % e))
|
||||
|
||||
@staticmethod
|
||||
def get_system_scratchdir(guest):
|
||||
|
|
|
@ -54,7 +54,8 @@ def _make_installconfig(script, osobj, unattended_data, arch, hostname, url):
|
|||
login = login.lower()
|
||||
if not is_user_login_safe(login):
|
||||
raise RuntimeError(
|
||||
_("%s cannot use '%s' as user-login.") % (osobj.name, login))
|
||||
_("%(osname)s cannot use '%(loginname)s' as user-login.") %
|
||||
{"osname": osobj.name, "loginname": login})
|
||||
|
||||
config.set_user_login(login)
|
||||
config.set_user_realname(realname)
|
||||
|
@ -188,8 +189,9 @@ class OSInstallScript:
|
|||
supported_injection_methods = self._script.get_injection_methods()
|
||||
if (injection_method & supported_injection_methods == 0):
|
||||
raise RuntimeError(
|
||||
_("OS '%s' does not support required injection method '%s'") %
|
||||
(self._osobj.name, namestr))
|
||||
_("OS '%(osname)s' does not support required "
|
||||
"injection method '%(methodname)s'") %
|
||||
{"osname": self._osobj.name, "methodname": namestr})
|
||||
|
||||
self._script.set_preferred_injection_method(injection_method)
|
||||
|
||||
|
@ -344,9 +346,11 @@ def _lookup_rawscripts(osinfo, profile, os_media):
|
|||
rawscripts = script_map.get(profile, [])
|
||||
if not rawscripts:
|
||||
raise RuntimeError(
|
||||
_("OS '%s' does not support unattended installation for "
|
||||
"the '%s' profile. Available profiles: %s") %
|
||||
(osinfo.name, profile, ", ".join(profile_names)))
|
||||
_("OS '%(osname)s' does not support unattended "
|
||||
"installation for the '%(profilename)s' profile. "
|
||||
"Available profiles: %(profiles)s") %
|
||||
{"osname": osinfo.name, "profilename": profile,
|
||||
"profiles": ", ".join(profile_names)})
|
||||
else:
|
||||
profile = _find_default_profile(profile_names)
|
||||
log.warning(_("Using unattended profile '%s'"), profile)
|
||||
|
|
|
@ -308,11 +308,13 @@ def getDistroStore(guest, fetcher, skip_error):
|
|||
extramsg = (": " +
|
||||
_("The URL could not be accessed, maybe you mistyped?"))
|
||||
|
||||
raise ValueError(
|
||||
_("Could not find an installable distribution at '%s'%s\n\n"
|
||||
"The location must be the root directory of an install tree.\n"
|
||||
"See virt-install man page for various distro examples." %
|
||||
(fetcher.location, extramsg)))
|
||||
msg = (_("Could not find an installable distribution at URL '%s'") %
|
||||
fetcher.location)
|
||||
msg += extramsg
|
||||
msg += "\n\n"
|
||||
msg += _("The location must be the root directory of an install tree.\n"
|
||||
"See virt-install man page for various distro examples.")
|
||||
raise ValueError(msg)
|
||||
|
||||
|
||||
##################
|
||||
|
|
|
@ -67,8 +67,9 @@ class _URLFetcher(object):
|
|||
try:
|
||||
urlobj, size = self._grabber(url)
|
||||
except Exception as e:
|
||||
raise ValueError(_("Couldn't acquire file %s: %s") %
|
||||
(url, str(e)))
|
||||
raise ValueError(
|
||||
(_("Couldn't acquire file %s") % url) +
|
||||
(": %s" % str(e)))
|
||||
|
||||
log.debug("Fetching URI: %s", url)
|
||||
self.meter.start(
|
||||
|
@ -244,8 +245,9 @@ class _FTPURLFetcher(_URLFetcher):
|
|||
# Force binary mode
|
||||
self._ftp.voidcmd("TYPE I")
|
||||
except Exception as e: # pragma: no cover
|
||||
raise ValueError(_("Opening URL %s failed: %s.") %
|
||||
(self.location, str(e)))
|
||||
raise ValueError(
|
||||
(_("Opening URL %s failed") % self.location) +
|
||||
(": %s" % str(e)))
|
||||
|
||||
def _grabber(self, url):
|
||||
"""
|
||||
|
|
|
@ -234,9 +234,10 @@ class _OSDB(object):
|
|||
if key not in self._all_variants and key in self._aliases:
|
||||
alias = self._aliases[key]
|
||||
# Added 2018-10-02. Maybe remove aliases in a year
|
||||
log.warning(
|
||||
_("OS name '%s' is deprecated, using '%s' instead. "
|
||||
"This alias will be removed in the future."), key, alias)
|
||||
msg = (_("OS name '%(oldname)s' is deprecated, using '%(newname)s' "
|
||||
"instead. This alias will be removed in the future.") %
|
||||
{"oldname": key, "newname": alias})
|
||||
log.warning(msg)
|
||||
key = alias
|
||||
|
||||
ret = self._all_variants.get(key)
|
||||
|
@ -676,8 +677,9 @@ class _OsVariant(object):
|
|||
return location
|
||||
|
||||
raise RuntimeError(
|
||||
_("OS '%s' does not have a URL location for the %s architecture") %
|
||||
(self.name, arch))
|
||||
_("OS '%(osname)s' does not have a URL location "
|
||||
"for the architecture '%(archname)s'") %
|
||||
{"osname": self.name, "archname": arch})
|
||||
|
||||
def get_install_script_list(self):
|
||||
if not self._os:
|
||||
|
|
|
@ -163,8 +163,8 @@ class StoragePool(_StorageObject):
|
|||
return defpool
|
||||
except Exception as e: # pragma: no cover
|
||||
raise RuntimeError(
|
||||
_("Couldn't create default storage pool '%s': %s") %
|
||||
(path, str(e)))
|
||||
(_("Couldn't create default storage pool '%s'") % path) +
|
||||
(": %s" % str(e)))
|
||||
|
||||
@staticmethod
|
||||
def lookup_pool_by_path(conn, path):
|
||||
|
@ -728,16 +728,18 @@ class StorageVolume(_StorageObject):
|
|||
# pool info is [pool state, capacity, allocation, available]
|
||||
avail = self.pool.info()[3]
|
||||
if self.allocation > avail:
|
||||
return (True, _("There is not enough free space on the storage "
|
||||
"pool to create the volume. "
|
||||
"(%d M requested allocation > %d M available)") %
|
||||
((self.allocation // (1024 * 1024)),
|
||||
(avail // (1024 * 1024))))
|
||||
msg = (_("There is not enough free space on the storage "
|
||||
"pool to create the volume. (%(mem1)s M requested "
|
||||
"allocation > %(mem2)s M available)") %
|
||||
{"mem1": (self.allocation // (1024 * 1024)),
|
||||
"mem2": (avail // (1024 * 1024))})
|
||||
return (True, msg)
|
||||
elif self.capacity > avail:
|
||||
return (False, _("The requested volume capacity will exceed the "
|
||||
"available pool space when the volume is fully "
|
||||
"allocated. "
|
||||
"(%d M requested capacity > %d M available)") %
|
||||
((self.capacity // (1024 * 1024)),
|
||||
(avail // (1024 * 1024))))
|
||||
msg = (_("The requested volume capacity will exceed the "
|
||||
"available pool space when the volume is fully "
|
||||
"allocated. (%(mem1)s M requested "
|
||||
"capacity > %(mem2)s M available)") %
|
||||
{"mem1": (self.capacity // (1024 * 1024)),
|
||||
"mem2": (avail // (1024 * 1024))})
|
||||
return (False, msg)
|
||||
return (False, "")
|
||||
|
|
|
@ -343,9 +343,10 @@ def _show_memory_warnings(guest):
|
|||
minram = (res.get_minimum_ram(guest.os.arch) or 0)
|
||||
if minram:
|
||||
if (minram // 1024) > guest.currentMemory:
|
||||
log.warning(_("Requested memory %s MiB is less than the "
|
||||
"recommended %s MiB for OS %s"), rammb,
|
||||
minram // (1024 * 1024), guest.osinfo.name)
|
||||
log.warning(_("Requested memory %(mem1)s MiB is less than the "
|
||||
"recommended %(mem2)s MiB for OS %(osname)s"),
|
||||
{"mem1": rammb, "mem2": minram // (1024 * 1024),
|
||||
"osname": guest.osinfo.name})
|
||||
elif rammb < 17:
|
||||
log.warning(_("Requested memory %s MiB is abnormally low. "
|
||||
"Were you trying to specify GiB?"), rammb)
|
||||
|
|
|
@ -87,9 +87,10 @@ def _find_objects_to_edit(guest, action_name, editval, parserclass):
|
|||
fail(_("No --%s objects found in the XML") %
|
||||
parserclass.cli_arg_name)
|
||||
if len(objlist) < abs(idx):
|
||||
fail(_("--edit %s requested but there's only %s "
|
||||
"--%s object in the XML") %
|
||||
(idx, len(objlist), parserclass.cli_arg_name))
|
||||
fail(_("'--edit %(number)s' requested but there's only %(max)s "
|
||||
"--%(type)s object in the XML") %
|
||||
{"number": idx, "max": len(objlist),
|
||||
"type": parserclass.cli_arg_name})
|
||||
|
||||
if idx > 0:
|
||||
idx -= 1
|
||||
|
@ -104,8 +105,8 @@ def _find_objects_to_edit(guest, action_name, editval, parserclass):
|
|||
parserobj = parserclass(editval, guest=guest)
|
||||
inst = parserobj.lookup_child_from_option_string()
|
||||
if not inst:
|
||||
fail(_("No matching objects found for --%s %s") %
|
||||
(action_name, editval))
|
||||
fail(_("No matching objects found for %s") %
|
||||
("--%s %s" % (action_name, editval)))
|
||||
|
||||
return inst
|
||||
|
||||
|
@ -149,9 +150,10 @@ def action_edit(guest, options, parserclass):
|
|||
else:
|
||||
inst = guest
|
||||
if options.edit and options.edit != '1' and options.edit != 'all':
|
||||
fail(_("'--edit %s' doesn't make sense with --%s, "
|
||||
"just use empty '--edit'") %
|
||||
(options.edit, parserclass.cli_arg_name))
|
||||
fail(_("'--edit %(option)s' doesn't make sense with "
|
||||
"--%(objecttype)s, just use empty '--edit'") %
|
||||
{"option": options.edit,
|
||||
"objecttype": parserclass.cli_arg_name})
|
||||
if options.os_variant is not None:
|
||||
fail(_("--os-variant is not supported with --edit"))
|
||||
|
||||
|
@ -241,7 +243,8 @@ def start_domain_transient(conn, xmlobj, devs, action, confirm):
|
|||
try:
|
||||
dom = conn.createXML(xmlobj.get_xml())
|
||||
except libvirt.libvirtError as e:
|
||||
fail(_("Failed starting domain '%s': %s") % (xmlobj.name, e))
|
||||
fail((_("Failed starting domain '%s'") % xmlobj.name) +
|
||||
(": %s" % e))
|
||||
else:
|
||||
print_stdout(_("Domain '%s' started successfully.") % xmlobj.name)
|
||||
return dom
|
||||
|
@ -275,7 +278,8 @@ def update_changes(domain, devs, action, confirm):
|
|||
elif action == "update":
|
||||
domain.updateDeviceFlags(xml, libvirt.VIR_DOMAIN_AFFECT_LIVE)
|
||||
except libvirt.libvirtError as e:
|
||||
fail(_("Error attempting device %s: %s") % (action, e))
|
||||
fail((_("Error attempting device action %s") % action) +
|
||||
(": %s" % e))
|
||||
|
||||
# Test driver doesn't support device hotplug so we can't reach this
|
||||
print_stdout(_("Device %s successful.") % action) # pragma: no cover
|
||||
|
@ -501,8 +505,8 @@ def main(conn=None):
|
|||
try:
|
||||
dom.create()
|
||||
except libvirt.libvirtError as e: # pragma: no cover
|
||||
fail(_("Failed starting domain '%s': %s") % (
|
||||
inactive_xmlobj.name, e))
|
||||
fail((_("Failed starting domain '%s'") % inactive_xmlobj.name) +
|
||||
(": " % e))
|
||||
print_stdout(_("Domain '%s' started successfully.") %
|
||||
inactive_xmlobj.name)
|
||||
|
||||
|
|
|
@ -187,8 +187,9 @@ class _XMLBase(object):
|
|||
if rootname == expected_root_name:
|
||||
return
|
||||
raise RuntimeError(
|
||||
_("XML did not have expected root element name '%s', found '%s'") %
|
||||
(expected_root_name, rootname))
|
||||
_("XML did not have expected root element name "
|
||||
"'%(expectname)s', found '%(foundname)s'") %
|
||||
{"expectname": expected_root_name, "foundname": rootname})
|
||||
|
||||
def _node_set_content(self, xpath, node, setval):
|
||||
xpathobj = _XPath(xpath)
|
||||
|
|
|
@ -459,9 +459,10 @@ class XMLBuilder(object):
|
|||
for c in forbid:
|
||||
if c not in val:
|
||||
continue
|
||||
raise ValueError(
|
||||
_("%s name '%s' can not contain '%s' character.") %
|
||||
(name_label, val, c))
|
||||
msg = (_("%(objecttype)s name '%(name)s' can not contain "
|
||||
"'%(char)s' character.") %
|
||||
{"objecttype": name_label, "name": val, "char": c})
|
||||
raise ValueError(msg)
|
||||
|
||||
|
||||
def __init__(self, conn, parsexml=None,
|
||||
|
|
Loading…
Reference in New Issue