Specify all logging string format args as function parameters

As warned about by pylint. Also clean up some pylint false positives
and a few scattered legit warnings.
This commit is contained in:
Cole Robinson 2012-01-16 22:04:40 -05:00
parent a1d2b1a0f0
commit 1ff601138f
29 changed files with 162 additions and 155 deletions

View File

@ -70,8 +70,8 @@ def main():
(options, ignore) = parse_commandline()
cli.setup_logging(appname, options.debug)
logging.debug("Launched as: %s" % " ".join(sys.argv[:]))
logging.debug("virtManager import: %s" % str(virtManager))
logging.debug("Launched as: %s", " ".join(sys.argv[:]))
logging.debug("virtManager import: %s", str(virtManager))
cli.check_virtinst_version(virtinst_str)

View File

@ -151,7 +151,7 @@ def launch_specific_window(engine, show, uri, uuid):
if not show:
return
logging.debug("Launching requested window '%s'" % show)
logging.debug("Launching requested window '%s'", show)
if show == 'creator':
engine.show_domain_creator(uri)
elif show == 'editor':
@ -289,9 +289,9 @@ def main():
global logging_setup
logging_setup = True
logging.debug("Launched as: %s" % origargs)
logging.debug("GTK version: %s" % str(gtk.gtk_version))
logging.debug("virtManager import: %s" % str(virtManager))
logging.debug("Launched as: %s", origargs)
logging.debug("GTK version: %s", str(gtk.gtk_version))
logging.debug("virtManager import: %s", str(virtManager))
cli.check_virtinst_version(virtinst_str)

View File

@ -587,7 +587,7 @@ class vmmAddHardware(vmmGObjectUI):
path = util.get_default_path(self.conn,
self.vm.get_name(),
collidelist=pathlist)
logging.debug("Default storage path is: %s" % path)
logging.debug("Default storage path is: %s", path)
else:
path = self.widget("config-storage-entry").get_text()
@ -1121,7 +1121,7 @@ class vmmAddHardware(vmmGObjectUI):
try:
self.vm.attach_device(self._dev)
except Exception, e:
logging.debug("Device could not be hotplugged: %s" % str(e))
logging.debug("Device could not be hotplugged: %s", str(e))
attach_err = (str(e), "".join(traceback.format_exc()))
if attach_err:

View File

@ -85,7 +85,7 @@ class vmmGObject(GObject):
self._cleanup()
except:
logging.exception("Error cleaning up %s" % self)
logging.exception("Error cleaning up %s", self)
def _cleanup(self):
raise NotImplementedError("_cleanup must be implemented in subclass")
@ -143,9 +143,9 @@ class vmmGObject(GObject):
def _logtrace(self, msg):
import traceback
logging.debug("%s (%s %s)\n:%s" %
(msg, self.object_key, self.refcount(),
"".join(traceback.format_stack())))
logging.debug("%s (%s %s)\n:%s",
msg, self.object_key, self.refcount(),
"".join(traceback.format_stack()))
def refcount(self):
# Function generates 2 temporary refs, so adjust total accordingly
@ -225,7 +225,7 @@ class vmmGObject(GObject):
if self.config and self._leak_check:
self.config.remove_object(self.object_key)
except:
logging.exception("Error removing %s" % self.object_key)
logging.exception("Error removing %s", self.object_key)
class vmmGObjectUI(vmmGObject):
def __init__(self, filename, windowname):

View File

@ -68,13 +68,13 @@ def setup_logging(appname, debug_stdout):
"%(asctime)s (%(module)s:%(lineno)d): %(message)s"))
rootLogger.addHandler(streamHandler)
logging.info("%s startup" % appname)
logging.info("%s startup", appname)
# Register libvirt handler
def libvirt_callback(ctx_ignore, err):
if err[3] != libvirt.VIR_ERR_ERROR:
# Don't log libvirt errors: global error handler will do that
logging.warn("Non-error from libvirt: '%s'" % err[2])
logging.warn("Non-error from libvirt: '%s'", err[2])
libvirt.registerErrorHandler(f=libvirt_callback, ctx=None)
# Log uncaught exceptions

View File

@ -402,7 +402,7 @@ class vmmCloneVM(vmmGObjectUI):
cd.skip_target = skip_targets
cd.setup_original()
except Exception, e:
logging.exception("Disk target '%s' caused clone error" %
logging.exception("Disk target '%s' caused clone error",
force_target)
storage_add(str(e))
continue
@ -416,13 +416,13 @@ class vmmCloneVM(vmmGObjectUI):
# Generate disk path, make sure that works
clone_path = self.generate_clone_path_name(path)
logging.debug("Original path: %s\nGenerated clone path: %s" %
(path, clone_path))
logging.debug("Original path: %s\nGenerated clone path: %s",
path, clone_path)
cd.clone_devices = clone_path
size = cd.original_virtual_disks[0].size
except Exception, e:
logging.exception("Error setting generated path '%s'" %
logging.exception("Error setting generated path '%s'",
clone_path)
storage_add(str(e))

View File

@ -169,7 +169,7 @@ class vmmConfig(object):
ignore = SpiceClientGtk
self._spice_error = False
except Exception, self._spice_error:
logging.debug("Error importing spice: %s" % self._spice_error)
logging.debug("Error importing spice: %s", self._spice_error)
return self._spice_error and str(self._spice_error) or None
@ -672,7 +672,7 @@ class vmmConfig(object):
def get_default_directory(self, conn, _type):
if not _type:
logging.error("Unknown type '%s' for get_default_directory" % _type)
logging.error("Unknown type '%s' for get_default_directory", _type)
return
key = self._get_default_dir_key(_type)
@ -691,7 +691,7 @@ class vmmConfig(object):
_type == self.CONFIG_DIR_RESTORE):
path = self.get_default_save_dir(conn)
logging.debug("get_default_directory(%s): returning %s" % (_type, path))
logging.debug("get_default_directory(%s): returning %s", _type, path)
return path
def set_default_directory(self, folder, _type):
@ -699,7 +699,7 @@ class vmmConfig(object):
logging.error("Unknown type for set_default_directory")
return
logging.debug("set_default_directory(%s): saving %s" % (_type, folder))
logging.debug("set_default_directory(%s): saving %s", _type, folder)
self.conf.set_string(self.conf_dir + "/paths/default-%s-path" % _type,
folder)

View File

@ -89,7 +89,7 @@ class vmmConnect(vmmGObjectUI):
"org.freedesktop.Avahi.Server")
self.can_browse = True
except Exception, e:
logging.debug("Couldn't contact avahi: %s" % str(e))
logging.debug("Couldn't contact avahi: %s", str(e))
self.reset_state()
@ -344,7 +344,7 @@ class vmmConnect(vmmGObjectUI):
auto = self.widget("autoconnect").get_active()
uri = self.generate_uri()
logging.debug("Generate URI=%s, auto=%s" % (uri, auto))
logging.debug("Generate URI=%s, auto=%s", uri, auto)
self.close()
self.emit("completed", uri, auto)
@ -378,7 +378,7 @@ class vmmConnect(vmmGObjectUI):
socket.getaddrinfo(host, None)
except:
logging.debug("Couldn't resolve host '%s'. Stripping "
"'.local' and retrying." % host)
"'.local' and retrying.", host)
self.can_resolve_local = False
host = self.check_resolve_host(host[:-6])
else:
@ -392,7 +392,7 @@ class vmmConnect(vmmGObjectUI):
socket.getaddrinfo(host, None)
except:
logging.debug("Couldn't resolve host '%s'. Disabling "
"host name resolution, only using IP addr" %
"host name resolution, only using IP addr",
host)
self.can_resolve_hostname = False
else:

View File

@ -498,7 +498,7 @@ class vmmConnection(vmmGObject):
try:
util.build_default_pool(self)
except Exception, e:
logging.debug("Building default pool failed: %s" % str(e))
logging.debug("Building default pool failed: %s", str(e))
return self._storage_capable
@ -575,7 +575,7 @@ class vmmConnection(vmmGObject):
key = virtinst.support.SUPPORT_DOMAIN_MANAGED_SAVE
if key not in self._support_dict:
val = virtinst.support.check_domain_support(vm, key)
logging.debug("Connection managed save support: %s" % val)
logging.debug("Connection managed save support: %s", val)
self._support_dict[key] = val
return self._support_dict[key]
@ -822,7 +822,7 @@ class vmmConnection(vmmGObject):
# to the user.
os.remove(frm)
except:
logging.debug("Couldn't remove save file '%s' used for restore." %
logging.debug("Couldn't remove save file '%s' used for restore",
frm)
####################
@ -954,7 +954,7 @@ class vmmConnection(vmmGObject):
self._change_state(self.STATE_CONNECTING)
if sync:
logging.debug("Opening connection synchronously: %s" %
logging.debug("Opening connection synchronously: %s",
self.get_uri())
self._open_thread()
else:
@ -973,7 +973,7 @@ class vmmConnection(vmmGObject):
logging.debug("Skipping policykit check as root")
return 0
logging.debug("Doing policykit for %s" % action)
logging.debug("Doing policykit for %s", action)
try:
# First try to use org.freedesktop.PolicyKit.AuthenticationAgent
@ -1190,8 +1190,8 @@ class vmmConnection(vmmGObject):
if self.state == self.STATE_ACTIVE:
caps = self.get_capabilities_xml()
logging.debug("%s capabilities:\n%s" %
(self.get_uri(), caps))
logging.debug("%s capabilities:\n%s",
self.get_uri(), caps)
self.tick()
# If VMs disappeared since the last time we connected to
@ -1226,19 +1226,19 @@ class vmmConnection(vmmGObject):
try:
newActiveNames = active_list()
except Exception, e:
logging.debug("Unable to list active %ss: %s" % (typename, e))
logging.debug("Unable to list active %ss: %s", typename, e)
try:
newInactiveNames = inactive_list()
except Exception, e:
logging.debug("Unable to list inactive %ss: %s" % (typename, e))
logging.debug("Unable to list inactive %ss: %s", typename, e)
def check_obj(key, is_active):
if key not in origlist:
try:
obj = lookup_func(key)
except Exception, e:
logging.debug("Could not fetch %s '%s': %s" %
(typename, key, e))
logging.debug("Could not fetch %s '%s': %s",
typename, key, e)
return
# Object is brand new this tick period
@ -1266,14 +1266,14 @@ class vmmConnection(vmmGObject):
check_obj(name, True)
except:
logging.exception("Couldn't fetch active "
"%s '%s'" % (typename, name))
"%s '%s'", typename, name)
for name in newInactiveNames:
try:
check_obj(name, False)
except:
logging.exception("Couldn't fetch inactive "
"%s '%s'" % (typename, name))
"%s '%s'", typename, name)
return (stop, start, origlist, new, current)
@ -1355,12 +1355,12 @@ class vmmConnection(vmmGObject):
try:
newActiveIDs = self.vmm.listDomainsID()
except Exception, e:
logging.debug("Unable to list active domains: %s" % e)
logging.debug("Unable to list active domains: %s", e)
try:
newInactiveNames = self.vmm.listDefinedDomains()
except Exception, e:
logging.exception("Unable to list inactive domains: %s" % e)
logging.exception("Unable to list inactive domains: %s", e)
# NB in these first 2 loops, we go to great pains to
# avoid actually instantiating a new VM object so that
@ -1396,7 +1396,7 @@ class vmmConnection(vmmGObject):
check_new(vm, uuid)
except:
logging.exception("Couldn't fetch domain id '%s'" % _id)
logging.exception("Couldn't fetch domain id '%s'", _id)
for name in newInactiveNames:
@ -1412,7 +1412,7 @@ class vmmConnection(vmmGObject):
check_new(vm, uuid)
except:
logging.exception("Couldn't fetch domain '%s'" % name)
logging.exception("Couldn't fetch domain '%s'", name)
return (new, origlist, current)
@ -1522,9 +1522,9 @@ class vmmConnection(vmmGObject):
except libvirt.libvirtError, e:
if e.get_error_code() == libvirt.VIR_ERR_SYSTEM_ERROR:
raise
logging.exception("Tick for VM '%s' failed" % vm.get_name())
logging.exception("Tick for VM '%s' failed", vm.get_name())
except Exception, e:
logging.exception("Tick for VM '%s' failed" % vm.get_name())
logging.exception("Tick for VM '%s' failed", vm.get_name())
if not noStatsUpdate:
self._recalculate_stats(now, updateVMs)

View File

@ -106,7 +106,7 @@ class Tunnel(object):
argv.append("'%s'" % nc_cmd)
argv_str = reduce(lambda x, y: x + " " + y, argv[1:])
logging.debug("Creating SSH tunnel: %s" % argv_str)
logging.debug("Creating SSH tunnel: %s", argv_str)
fds = socket.socketpair()
errorfds = socket.socketpair()
@ -128,8 +128,8 @@ class Tunnel(object):
fds[1].close()
errorfds[1].close()
logging.debug("Tunnel PID=%d OUTFD=%d ERRFD=%d" %
(pid, fds[0].fileno(), errorfds[0].fileno()))
logging.debug("Tunnel PID=%d OUTFD=%d ERRFD=%d",
pid, fds[0].fileno(), errorfds[0].fileno())
errorfds[0].setblocking(0)
self.outfd = fds[0]
@ -145,9 +145,9 @@ class Tunnel(object):
if self.outfd is None:
return
logging.debug("Shutting down tunnel PID=%d OUTFD=%d ERRFD=%d" %
(self.pid, self.outfd.fileno(),
self.errfd.fileno()))
logging.debug("Shutting down tunnel PID=%d OUTFD=%d ERRFD=%d",
self.pid, self.outfd.fileno(),
self.errfd.fileno())
self.outfd.close()
self.outfd = None
self.errfd.close()
@ -260,7 +260,7 @@ class Viewer(vmmGObject):
if keys:
self.display.set_grab_keys(keys)
except Exception, e:
logging.debug("Error when getting the grab keys combination: %s" %
logging.debug("Error when getting the grab keys combination: %s",
str(e))
def open_host(self, host, user, port, socketpath, password=None):
@ -338,7 +338,7 @@ class VNCViewer(Viewer):
withUsername = False
withPassword = False
for cred in credList:
logging.debug("Got credential request %s" % cred)
logging.debug("Got credential request %s", cred)
if cred == gtkvnc.CREDENTIAL_PASSWORD:
withPassword = True
elif cred == gtkvnc.CREDENTIAL_USERNAME:
@ -499,7 +499,7 @@ class SpiceViewer(Viewer):
uri = "spice://"
uri += (user and str(user) or "")
uri += str(host) + "?port=" + str(port)
logging.debug("spice uri: %s" % uri)
logging.debug("spice uri: %s", uri)
self.spice_session = spice.Session()
self.spice_session.set_property("uri", uri)
@ -967,7 +967,7 @@ class vmmConsolePages(vmmGObjectUI):
error = _("Error: viewer connection to hypervisor host got refused "
"or disconnected!")
if errout:
logging.debug("Error output from closed console: %s" % errout)
logging.debug("Error output from closed console: %s", errout)
error += "\n\nError: %s" % errout
self.activate_unavailable_page(error)
@ -1036,7 +1036,7 @@ class vmmConsolePages(vmmGObjectUI):
except Exception, e:
# We can fail here if VM is destroyed: xen is a bit racy
# and can't handle domain lookups that soon after
logging.exception("Getting graphics console failed: %s" % str(e))
logging.exception("Getting graphics console failed: %s", str(e))
return
if protocol is None:
@ -1047,7 +1047,7 @@ class vmmConsolePages(vmmGObjectUI):
if protocol not in self.config.embeddable_graphics():
logging.debug("Don't know how to show graphics type '%s' "
"disabling console page" % protocol)
"disabling console page", protocol)
msg = (_("Cannot display graphical console type '%s'")
% protocol)
@ -1068,9 +1068,9 @@ class vmmConsolePages(vmmGObjectUI):
logging.debug("Starting connect process for "
"proto=%s trans=%s connhost=%s connuser=%s "
"connport=%s gaddr=%s gport=%s gsocket=%s" %
(protocol, transport, connhost, connuser, connport,
gaddr, gport, gsocket))
"connport=%s gaddr=%s gport=%s gsocket=%s",
protocol, transport, connhost, connuser, connport,
gaddr, gport, gsocket)
try:
if protocol == "vnc":
self.viewer = VNCViewer(self)

View File

@ -827,9 +827,10 @@ class vmmCreate(vmmGObjectUI):
self.capsguest = newg
self.capsdomain = newdom
logging.debug("Guest type set to os_type=%s, arch=%s, dom_type=%s" %
(self.capsguest.os_type, self.capsguest.arch,
self.capsdomain.hypervisor_type))
logging.debug("Guest type set to os_type=%s, arch=%s, dom_type=%s",
self.capsguest.os_type,
self.capsguest.arch,
self.capsdomain.hypervisor_type)
def populate_summary(self):
ignore, ignore, dlabel, vlabel = self.get_config_os_info()
@ -998,7 +999,7 @@ class vmmCreate(vmmGObjectUI):
elif self.is_default_storage():
path = self.get_default_path(self.guest.name)
logging.debug("Default storage path is: %s" % path)
logging.debug("Default storage path is: %s", path)
else:
path = self.widget("config-storage-entry").get_text()
@ -2053,7 +2054,7 @@ class vmmCreate(vmmGObjectUI):
self.detectedDistro = None
logging.debug("Starting OS detection thread for media=%s" % media)
logging.debug("Starting OS detection thread for media=%s", media)
self._safe_wrapper(self._set_forward_sensitive, (False,))
detectThread = threading.Thread(target=self.actually_detect,

View File

@ -213,7 +213,7 @@ class vmmCreateVolume(vmmGObjectUI):
self.show_err(_("Uncaught error validating input: %s") % str(e))
return
logging.debug("Creating volume with xml:\n%s" %
logging.debug("Creating volume with xml:\n%s",
self.vol.get_xml_config())
self.topwin.set_sensitive(False)

View File

@ -162,7 +162,7 @@ class vmmDeleteDialog(vmmGObjectUI):
for path in paths:
try:
logging.debug("Deleting path: %s" % path)
logging.debug("Deleting path: %s", path)
meter.start(text=_("Deleting path '%s'") % path)
self._async_delete_path(newconn, path, meter)
except Exception, e:
@ -170,7 +170,7 @@ class vmmDeleteDialog(vmmGObjectUI):
"".join(traceback.format_exc())))
meter.end(0)
logging.debug("Removing VM '%s'" % self.vm.get_name())
logging.debug("Removing VM '%s'", self.vm.get_name())
self.vm.delete()
except Exception, e:
@ -207,7 +207,7 @@ class vmmDeleteDialog(vmmGObjectUI):
try:
vol = conn.storageVolLookupByPath(path)
except:
logging.debug("Path '%s' is not managed. Deleting locally." % path)
logging.debug("Path '%s' is not managed. Deleting locally", path)
if vol:
vol.delete(0)
@ -371,7 +371,7 @@ def do_we_default(conn, vm_name, vol, path, ro, shared):
info = append_str(info, _("Storage is in use by the following "
"virtual machines:\n- %s " % namestr))
except Exception, e:
logging.exception("Failed checking disk conflict: %s" % str(e))
logging.exception("Failed checking disk conflict: %s", str(e))
return (not info, info)

View File

@ -2345,7 +2345,7 @@ class vmmDetails(vmmGObjectUI):
# Device removal
def remove_device(self, dev_type, dev_id_info):
logging.debug("Removing device: %s %s" % (dev_type, dev_id_info))
logging.debug("Removing device: %s %s", dev_type, dev_id_info)
if not util.chkbox_helper(self, self.config.get_confirm_removedev,
self.config.set_confirm_removedev,
@ -2365,7 +2365,7 @@ class vmmDetails(vmmGObjectUI):
if self.vm.is_active():
self.vm.detach_device(dev_id_info)
except Exception, e:
logging.debug("Device could not be hotUNplugged: %s" % str(e))
logging.debug("Device could not be hotUNplugged: %s", str(e))
detach_err = (str(e), "".join(traceback.format_exc()))
if not detach_err:
@ -2415,8 +2415,8 @@ class vmmDetails(vmmGObjectUI):
try:
func(*args)
except Exception, e:
logging.debug("Hotplug failed: func=%s: %s" % (func,
str(e)))
logging.debug("Hotplug failed: func=%s: %s",
func, str(e))
hotplug_err.append((str(e),
"".join(traceback.format_exc())))

View File

@ -374,7 +374,7 @@ class vmmDomain(vmmLibvirtObject):
if self.is_active():
raise RuntimeError(_("Cannot rename an active guest"))
logging.debug("Changing guest name to '%s'" % newname)
logging.debug("Changing guest name to '%s'", newname)
origxml = guest.get_xml_config()
guest.name = newname
newxml = guest.get_xml_config()
@ -692,17 +692,17 @@ class vmmDomain(vmmLibvirtObject):
def define_controller_model(self, devobj, newmodel):
def change(editdev):
ignore = editdev
guest = self._get_guest_to_define()
ctrls = guest.get_devices("controller")
ctrls = filter(lambda x:
(x.type ==
virtinst.VirtualController.CONTROLLER_TYPE_USB),
ctrls = filter(lambda x: (x.type ==
virtinst.VirtualController.CONTROLLER_TYPE_USB),
ctrls)
for dev in ctrls:
guest.remove_device(dev)
if newmodel == "ich9-ehci1":
print guest
guest.add_usb_ich9_controllers()
return self._redefine_device(change, devobj)
@ -755,8 +755,8 @@ class vmmDomain(vmmLibvirtObject):
self._backend.setMaxMemory(maxmem)
def hotplug_both_mem(self, memory, maxmem):
logging.info("Hotplugging curmem=%s maxmem=%s for VM '%s'" %
(memory, maxmem, self.get_name()))
logging.info("Hotplugging curmem=%s maxmem=%s for VM '%s'",
memory, maxmem, self.get_name())
if self.is_active():
actual_cur = self.get_memory()
@ -1149,8 +1149,8 @@ class vmmDomain(vmmLibvirtObject):
newxml = self.get_xml(inactive=True)
logging.debug("Migrating: conn=%s flags=%s dname=%s uri=%s rate=%s" %
(destconn.vmm, flags, newname, interface, rate))
logging.debug("Migrating: conn=%s flags=%s dname=%s uri=%s rate=%s",
destconn.vmm, flags, newname, interface, rate)
if meter:
start_job_progress_thread(self, meter, _("Migrating domain"))
@ -1506,13 +1506,13 @@ class vmmDomain(vmmLibvirtObject):
tx += io[4]
except libvirt.libvirtError, err:
if support.is_error_nosupport(err):
logging.debug("Net stats not supported: %s" % err)
logging.debug("Net stats not supported: %s", err)
self._stats_net_supported = False
else:
logging.error("Error reading net stats for "
"'%s' dev '%s': %s" %
(self.get_name(), dev, err))
logging.debug("Adding %s to skip list." % dev)
"'%s' dev '%s': %s",
self.get_name(), dev, err)
logging.debug("Adding %s to skip list", dev)
self._stats_net_skip.append(dev)
return rx, tx
@ -1540,13 +1540,13 @@ class vmmDomain(vmmLibvirtObject):
wr += io[3]
except libvirt.libvirtError, err:
if support.is_error_nosupport(err):
logging.debug("Disk stats not supported: %s" % err)
logging.debug("Disk stats not supported: %s", err)
self._stats_disk_supported = False
else:
logging.error("Error reading disk stats for "
"'%s' dev '%s': %s" %
(self.get_name(), dev, err))
logging.debug("Adding %s to skip list." % dev)
"'%s' dev '%s': %s",
self.get_name(), dev, err)
logging.debug("Adding %s to skip list", dev)
self._stats_disk_skip.append(dev)
return rd, wr

View File

@ -112,7 +112,7 @@ def check_packagekit(errbox, packages, libvirt_packages):
found = progWin.get_data()
not_found = filter(lambda x: x not in found, packages)
logging.debug("Missing packages: %s" % not_found)
logging.debug("Missing packages: %s", not_found)
do_install = not_found
if not do_install:
@ -173,7 +173,7 @@ def packagekit_install(package_list):
# Set 2 hour timeout
timeout = 60 * 60 * 2
logging.debug("Installing packages: %s" % package_list)
logging.debug("Installing packages: %s", package_list)
pk_control.InstallPackageNames(0, package_list, "hide-confirm-search",
timeout=timeout)
@ -343,7 +343,7 @@ class vmmEngine(vmmGObject):
def load_stored_uris(self):
uris = self.config.get_conn_uris()
if uris != None:
logging.debug("About to connect to uris %s" % uris)
logging.debug("About to connect to uris %s", uris)
for uri in uris:
self.add_conn(uri)
@ -368,7 +368,7 @@ class vmmEngine(vmmGObject):
conn.open()
return conn
except Exception:
logging.exception("Error connecting to %s" % uri)
logging.exception("Error connecting to %s", uri)
return None
def _do_connect(self, src_ignore, uri):
@ -450,9 +450,9 @@ class vmmEngine(vmmGObject):
if (dom in [from_remote, from_rpc] and
code in [sys_error]):
logging.exception("Could not refresh connection %s." % uri)
logging.exception("Could not refresh connection %s", uri)
logging.debug("Closing connection since libvirtd "
"appears to have stopped.")
"appears to have stopped")
else:
self.err.show_err(_("Error polling connection '%s': %s") %
(conn.get_uri(), e))
@ -468,11 +468,11 @@ class vmmEngine(vmmGObject):
def increment_window_counter(self, src):
ignore = src
self.windows += 1
logging.debug("window counter incremented to %s" % self.windows)
logging.debug("window counter incremented to %s", self.windows)
def decrement_window_counter(self, src):
self.windows -= 1
logging.debug("window counter decremented to %s" % self.windows)
logging.debug("window counter decremented to %s", self.windows)
# Don't exit if system tray is enabled
if (self.windows <= 0 and
@ -545,7 +545,7 @@ class vmmEngine(vmmGObject):
objs.remove(src.object_key)
for name in objs:
logging.debug("Leaked %s" % name)
logging.debug("Leaked %s", name)
logging.debug("Exiting app normally.")
gtk.main_quit()
@ -648,7 +648,7 @@ class vmmEngine(vmmGObject):
if index:
uri += "#%s" % index
logging.debug("Showing help for %s" % uri)
logging.debug("Showing help for %s", uri)
gtk.show_uri(None, uri, gtk.get_current_event_time())
except Exception, e:
src.err.show_err(_("Unable to display documentation: %s") % e)
@ -988,7 +988,7 @@ class vmmEngine(vmmGObject):
"shutting down the OS and may cause data loss.")):
return
logging.debug("Destroying vm '%s'." % vm.get_name())
logging.debug("Destroying vm '%s'", vm.get_name())
vmmAsyncJob.simple_async_noshow(vm.destroy, [], src,
_("Error shutting down domain"))
@ -1002,7 +1002,7 @@ class vmmEngine(vmmGObject):
vm.get_name())):
return
logging.debug("Pausing vm '%s'." % vm.get_name())
logging.debug("Pausing vm '%s'", vm.get_name())
vmmAsyncJob.simple_async_noshow(vm.suspend, [], src,
_("Error pausing domain"))
@ -1010,7 +1010,7 @@ class vmmEngine(vmmGObject):
conn = self._lookup_conn(uri)
vm = conn.get_vm(uuid)
logging.debug("Unpausing vm '%s'." % vm.get_name())
logging.debug("Unpausing vm '%s'", vm.get_name())
vmmAsyncJob.simple_async_noshow(vm.resume, [], src,
_("Error unpausing domain"))
@ -1018,7 +1018,7 @@ class vmmEngine(vmmGObject):
conn = self._lookup_conn(uri)
vm = conn.get_vm(uuid)
logging.debug("Starting vm '%s'." % vm.get_name())
logging.debug("Starting vm '%s'", vm.get_name())
if vm.hasSavedImage():
# VM will be restored, which can take some time, so show a
@ -1045,7 +1045,7 @@ class vmmEngine(vmmGObject):
vm.get_name())):
return
logging.debug("Shutting down vm '%s'." % vm.get_name())
logging.debug("Shutting down vm '%s'", vm.get_name())
vmmAsyncJob.simple_async_noshow(vm.shutdown, [], src,
_("Error shutting down domain"))
@ -1059,7 +1059,7 @@ class vmmEngine(vmmGObject):
vm.get_name())):
return
logging.debug("Rebooting vm '%s'." % vm.get_name())
logging.debug("Rebooting vm '%s'", vm.get_name())
def reboot_cb():
no_support = False

View File

@ -77,7 +77,7 @@ class vmmErrorDialog(vmmGObject):
details = summary + "\n\n" + details
if debug:
logging.debug("dialog message: %s : %s" % (summary, details))
logging.debug("dialog message: %s : %s", summary, details)
dialog = _errorDialog(parent=self.get_parent(),
type=dialog_type, buttons=buttons)

View File

@ -247,13 +247,13 @@ class vmmHalHelper(vmmGObject):
# something else. ethN -> pethN
psysfspath = sysfspath[0:len(sysfspath) - len(name)] + "p" + name
if os.path.exists(psysfspath):
logging.debug("Device %s named to p%s" % (name, name))
logging.debug("Device %s named to p%s", name, name)
name = "p" + name
sysfspath = psysfspath
# Ignore devices that are slaves of a bond
if is_net_bonding_slave(name, sysfspath):
logging.debug("Skipping device %s in bonding slave" % name)
logging.debug("Skipping device %s in bonding slave", name)
return
# Add the main NIC
@ -265,7 +265,7 @@ class vmmHalHelper(vmmGObject):
def _net_tag_device_added(self, name, sysfspath):
for vlanpath in glob.glob(sysfspath + ".*"):
if os.path.exists(vlanpath):
logging.debug("Process VLAN %s" % vlanpath)
logging.debug("Process VLAN %s", vlanpath)
vlanmac = get_net_mac_address(name, vlanpath)
if vlanmac:
(ignore, vlanname) = os.path.split(vlanpath)
@ -276,8 +276,8 @@ class vmmHalHelper(vmmGObject):
pvlanpath = (vlanpath[0:len(vlanpath) - len(vlanname)] +
"p" + vlanname)
if os.path.exists(pvlanpath):
logging.debug("Device %s named to p%s" % (vlanname,
vlanname))
logging.debug("Device %s named to p%s",
vlanname, vlanname)
vlanname = "p" + vlanname
vlanpath = pvlanpath
self._net_device_added(vlanname, vlanmac, vlanpath)

View File

@ -417,7 +417,7 @@ class vmmHost(vmmGObjectUI):
if not result:
return
logging.debug("Deleting network '%s'" % net.get_name())
logging.debug("Deleting network '%s'", net.get_name())
vmmAsyncJob.simple_async_noshow(net.delete, [], self,
_("Error deleting network '%s'") % net.get_name())
@ -426,7 +426,7 @@ class vmmHost(vmmGObjectUI):
if net is None:
return
logging.debug("Starting network '%s'" % net.get_name())
logging.debug("Starting network '%s'", net.get_name())
vmmAsyncJob.simple_async_noshow(net.start, [], self,
_("Error starting network '%s'") % net.get_name())
@ -435,7 +435,7 @@ class vmmHost(vmmGObjectUI):
if net is None:
return
logging.debug("Stopping network '%s'" % net.get_name())
logging.debug("Stopping network '%s'", net.get_name())
vmmAsyncJob.simple_async_noshow(net.stop, [], self,
_("Error stopping network '%s'") % net.get_name())
@ -453,7 +453,7 @@ class vmmHost(vmmGObjectUI):
if net is None:
return
logging.debug("Applying changes for network '%s'" % net.get_name())
logging.debug("Applying changes for network '%s'", net.get_name())
try:
auto = self.widget("net-autostart").get_active()
net.set_autostart(auto)
@ -609,7 +609,7 @@ class vmmHost(vmmGObjectUI):
if pool is None:
return
logging.debug("Stopping pool '%s'" % pool.get_name())
logging.debug("Stopping pool '%s'", pool.get_name())
vmmAsyncJob.simple_async_noshow(pool.stop, [], self,
_("Error stopping pool '%s'") % pool.get_name())
@ -618,7 +618,7 @@ class vmmHost(vmmGObjectUI):
if pool is None:
return
logging.debug("Starting pool '%s'" % pool.get_name())
logging.debug("Starting pool '%s'", pool.get_name())
vmmAsyncJob.simple_async_noshow(pool.start, [], self,
_("Error starting pool '%s'") % pool.get_name())
@ -632,7 +632,7 @@ class vmmHost(vmmGObjectUI):
if not result:
return
logging.debug("Deleting pool '%s'" % pool.get_name())
logging.debug("Deleting pool '%s'", pool.get_name())
vmmAsyncJob.simple_async_noshow(pool.delete, [], self,
_("Error deleting pool '%s'") % pool.get_name())
@ -645,7 +645,7 @@ class vmmHost(vmmGObjectUI):
pool.refresh()
self.refresh_current_pool()
logging.debug("Refresh pool '%s'" % pool.get_name())
logging.debug("Refresh pool '%s'", pool.get_name())
vmmAsyncJob.simple_async_noshow(cb, [], self,
_("Error refreshing pool '%s'") % pool.get_name())
@ -664,7 +664,7 @@ class vmmHost(vmmGObjectUI):
self.refresh_current_pool()
self.populate_storage_volumes()
logging.debug("Deleting volume '%s'" % vol.get_name())
logging.debug("Deleting volume '%s'", vol.get_name())
vmmAsyncJob.simple_async_noshow(cb, [], self,
_("Error refreshing volume '%s'") % vol.get_name())
@ -682,7 +682,7 @@ class vmmHost(vmmGObjectUI):
if pool is None:
return
logging.debug("Launching 'Add Volume' wizard for pool '%s'" %
logging.debug("Launching 'Add Volume' wizard for pool '%s'",
pool.get_name())
try:
if self.addvol is None:
@ -725,7 +725,7 @@ class vmmHost(vmmGObjectUI):
if pool is None:
return
logging.debug("Applying changes for pool '%s'" % pool.get_name())
logging.debug("Applying changes for pool '%s'", pool.get_name())
try:
do_auto = self.widget("pool-autostart").get_active()
pool.set_autostart(do_auto)
@ -904,7 +904,7 @@ class vmmHost(vmmGObjectUI):
"'%s'?" % interface.get_name())):
return
logging.debug("Stopping interface '%s'" % interface.get_name())
logging.debug("Stopping interface '%s'", interface.get_name())
vmmAsyncJob.simple_async_noshow(interface.stop, [], self,
_("Error stopping interface '%s'") % interface.get_name())
@ -919,7 +919,7 @@ class vmmHost(vmmGObjectUI):
"'%s'?" % interface.get_name())):
return
logging.debug("Starting interface '%s'" % interface.get_name())
logging.debug("Starting interface '%s'", interface.get_name())
vmmAsyncJob.simple_async_noshow(interface.start, [], self,
_("Error starting interface '%s'") % interface.get_name())
@ -934,7 +934,7 @@ class vmmHost(vmmGObjectUI):
if not result:
return
logging.debug("Deleting interface '%s'" % interface.get_name())
logging.debug("Deleting interface '%s'", interface.get_name())
vmmAsyncJob.simple_async_noshow(interface.delete, [], self,
_("Error deleting interface '%s'") % interface.get_name())
@ -973,7 +973,7 @@ class vmmHost(vmmGObjectUI):
model = start_list.get_model()
newmode = model[start_list.get_active()][0]
logging.debug("Applying changes for interface '%s'" %
logging.debug("Applying changes for interface '%s'",
interface.get_name())
try:
interface.set_startmode(newmode)

View File

@ -123,14 +123,14 @@ class vmmInspection(vmmGObject):
vm = conn.get_vm(vmuuid)
prettyvm = conn.get_uri() + ":" + vm.get_name()
logging.debug("%s: processing started" % prettyvm)
logging.debug("%s: processing started", prettyvm)
# Whether success or failure, we've "seen" this VM now.
self._vmseen[vmuuid] = True
self._process(conn, vm, vmuuid)
except:
logging.exception("%s: exception while processing" %
logging.exception("%s: exception while processing",
prettyvm)
logging.debug("%s: processing done" % prettyvm)
logging.debug("%s: processing done", prettyvm)
def _process(self, conn, vm, vmuuid):
g = GuestFS()
@ -209,7 +209,7 @@ class vmmInspection(vmmGObject):
g.mount_ro(mp_dev[1], mp_dev[0])
except:
logging.exception("exception mounting %s on %s "
"(ignored)" % (mp_dev[1], mp_dev[0]))
"(ignored)", mp_dev[1], mp_dev[0])
filesystems_mounted = True
except:

View File

@ -511,7 +511,7 @@ class vmmMigrateDialog(vmmGObjectUI):
# migration has not been started, wait 100 milliseconds
return True
logging.warning("Error setting migrate downtime: %s" % e)
logging.warning("Error setting migrate downtime: %s", e)
return False
def cancel_migration(self, asyncjob, vm):

View File

@ -71,7 +71,7 @@ class LocalConsoleConnection(ConsoleConnection):
self.close()
ipty = dev and dev.source_path or None
logging.debug("Opening serial tty path: %s" % ipty)
logging.debug("Opening serial tty path: %s", ipty)
if ipty == None:
return
@ -186,8 +186,8 @@ class LibvirtConsoleConnection(ConsoleConnection):
self.stream = self.conn.vmm.newStream(libvirt.VIR_STREAM_NONBLOCK)
name = dev and dev.alias.name or None
logging.debug("Opening console stream for dev=%s alias=%s" %
(dev, name))
logging.debug("Opening console stream for dev=%s alias=%s",
dev, name)
self.vm.open_console(name, self.stream)
self.stream.eventAddCallback((libvirt.VIR_STREAM_EVENT_READABLE |
@ -390,12 +390,12 @@ class vmmSerialConsole(vmmGObject):
if port == self.target_port:
if path != self.lastpath:
logging.debug("Serial console '%s' path changed to %s."
% (self.target_port, path))
logging.debug("Serial console '%s' path changed to %s",
self.target_port, path)
self.lastpath = path
return dev
logging.debug("No devices found for serial target port '%s'." %
logging.debug("No devices found for serial target port '%s'",
self.target_port)
self.lastpath = None
return None

View File

@ -325,8 +325,9 @@ class vmmStorageBrowser(vmmGObjectUI):
fmt = vol.get_format() or ""
except Exception:
logging.exception("Failed to determine volume parameters, "
"skipping volume %s" % key)
continue
"skipping volume %s", key)
continue
namestr = None
try:

View File

@ -122,7 +122,7 @@ def check_default_pool_active(topwin, conn):
# Try to start the pool
try:
default_pool.start()
logging.info("Started pool '%s'." % default_pool.get_name())
logging.info("Started pool '%s'", default_pool.get_name())
except Exception, e:
return topwin.err.show_err(_("Could not start storage_pool "
"'%s': %s") %
@ -648,7 +648,7 @@ def validate_network(parent, conn, nettype, devname, macaddr, model=None):
try:
virnet = conn.vmm.networkLookupByName(devname)
virnet.create()
logging.info("Started network '%s'." % devname)
logging.info("Started network '%s'", devname)
except Exception, e:
return err_dial.show_err(_("Could not start virtual network "
"'%s': %s") % (devname, str(e)))
@ -888,7 +888,7 @@ def check_path_search_for_qemu(parent, conn, path):
if not broken_paths:
return
logging.debug("No search access for dirs: %s" % broken_paths)
logging.debug("No search access for dirs: %s", broken_paths)
resp, chkres = err_dial.warn_chkbox(
_("The emulator may not have search permissions "
"for the path '%s'.") % path,
@ -914,7 +914,7 @@ def check_path_search_for_qemu(parent, conn, path):
continue
details += "%s : %s\n" % (path, error)
logging.debug("Permission errors:\n%s" % details)
logging.debug("Permission errors:\n%s", details)
ignore, chkres = err_dial.err_chkbox(errmsg, details,
_("Don't ask about these directories again."))

View File

@ -60,7 +60,7 @@ def build_default_pool(vmmconn):
return
try:
logging.debug("Attempting to build default pool with target '%s'" %
logging.debug("Attempting to build default pool with target '%s'",
path)
defpool = virtinst.Storage.DirectoryPool(conn=conn,
name=name,

View File

@ -39,7 +39,8 @@ class ChangeHostConfigScreen(HostListConfigScreen):
def process_input(self, page):
if page is CONNECTION_LIST_PAGE:
logging.info("Changing libvirt connection to %s" % self.get_selected_connection())
logging.info("Changing libvirt connection to %s",
self.get_selected_connection())
self.get_libvirt().open_connection(self.get_selected_connection())
elif page is CONNECTED_PAGE:
self.set_finished()

View File

@ -24,7 +24,7 @@ class CreateMeter(progress.BaseMeter):
logging.info("Starting...")
def _do_end(self, amount_read, now=None):
logging.info("Ending: read=%d" % amount_read)
logging.info("Ending: read=%d", amount_read)
def _do_update(self, amount_read, now=None):
logging.info("Update: read=%d" % amount_read)
logging.info("Update: read=%d", amount_read)

View File

@ -32,13 +32,13 @@ DEFAULT_URL = "qemu:///system"
default_url = DEFAULT_URL
def set_default_url(url):
logging.info("Changing DEFAULT_URL to %s" % url)
logging.info("Changing DEFAULT_URL to %s", url)
global default_url
default_url = url
def get_default_url():
logging.info("Returning default URL of %s" % default_url)
logging.info("Returning default URL of %s", default_url)
return default_url
class VirtManagerConfig:
@ -78,7 +78,7 @@ class LibvirtWorker:
def __init__(self, url=None):
if url is None:
url = get_default_url()
logging.info("Connecting to libvirt: %s" % url)
logging.info("Connecting to libvirt: %s", url)
self.__url = None
self.__conn = None
self.__vmmconn = None

View File

@ -27,8 +27,10 @@ UNABLE_IMPORT="Unable to import '(appindicator)"
# os._exit is needed for forked processes.
OS_EXIT="protected member _exit of a client class"
# False positive
# False positives
MAIN_NONETYPE="main:.*Raising NoneType while.*"
STYLE_ATTACH="Class 'style' has no 'attach' member"
VBOX_PACK="Class 'vbox' has no 'pack_start' member"
# Avahi API may have requirements on callback argument names, so ignore these
# warnings
@ -98,7 +100,9 @@ pylint --ignore=$IGNOREFILES $PYLINT_FILES \
-ve "$INFER_ERRORS" \
-ve "$MAIN_NONETYPE" \
-ve "$TEST_HACKS" \
-ve "$UNABLE_IMPORT" | \
-ve "$UNABLE_IMPORT" \
-ve "$STYLE_ATTACH" \
-ve "$VBOX_ATTACH" | \
$AWK '\
# Strip out any "*** Module name" lines if we dont list any errors for them
BEGIN { found=0; cur_line="" }