Remove unused variables.

This commit is contained in:
Cole Robinson 2008-11-18 14:48:10 -05:00
parent b6e35dfd2f
commit 11a38c01f3
11 changed files with 15 additions and 47 deletions

View File

@ -248,7 +248,7 @@ def main():
setup_i18n()
setup_logging()
setup_pypath()
(options, args) = parse_commandline()
(options, ignore) = parse_commandline()
# Urgh, pygtk merely logs a warning when failing to open
# the X11 display connection, and lets everything carry
@ -318,7 +318,7 @@ def main():
else:
# Grab the service to allow others to talk to us later
name = dbus.service.BusName("com.redhat.virt.manager", bus=bus)
remote = vmmRemote(engine, name)
vmmRemote(engine, name)
except:
# Something went wrong doing dbus setup, just ignore & carry on
logging.warning("Could not get connection to session bus, disabling DBus service " + \

View File

@ -279,7 +279,7 @@ class vmmAddHardware(gobject.GObject):
fd.seek(0,2)
block_size = fd.tell() / 1024 / 1024
return block_size
except Exception, e:
except Exception:
details = "Unable to verify partition size: '%s'" % \
"".join(traceback.format_exc())
logging.error(details)
@ -510,7 +510,7 @@ class vmmAddHardware(gobject.GObject):
used.append(d[3])
try:
t = self._dev.generate_target(used)
self._dev.generate_target(used)
except Exception, e:
details = _("Unable to complete install: ") + \
"".join(traceback.format_exc())

View File

@ -250,7 +250,7 @@ class vmmConnect(gobject.GObject):
if host.startswith("linux-"):
tmphost = host[6:]
try:
tmp = long(tmphost)
long(tmphost)
host = ""
except ValueError:
pass

View File

@ -44,8 +44,7 @@ LIBVIRT_POLICY_FILES = [
def get_local_hostname():
try:
(host, aliases, ipaddrs) = gethostbyaddr(gethostname())
return host
return gethostbyaddr(gethostname())[0]
except:
logging.warning("Unable to resolve local hostname for machine")
return "localhost"
@ -280,8 +279,8 @@ class vmmConnection(gobject.GObject):
return virtinst.util.is_uri_remote(self.uri)
def is_qemu_session(self):
(scheme, username, netloc, \
path, query, fragment) = virtinst.util.uri_split(self.uri)
(scheme, ignore, ignore, \
path, ignore, ignore) = virtinst.util.uri_split(self.uri)
if path == "/session" and scheme.startswith("qemu"):
return True
return False

View File

@ -396,7 +396,7 @@ class vmmCreate(gobject.GObject):
fd.seek(0,2)
block_size = fd.tell() / 1024 / 1024
return block_size
except Exception, e:
except Exception:
details = "Unable to verify partition size: '%s'" % \
"".join(traceback.format_exc())
logging.error(details)
@ -695,7 +695,7 @@ class vmmCreate(gobject.GObject):
if self.config.get_console_popup() == 1:
# user has requested console on new created vms only
vm = self.connection.get_vm(guest.uuid)
(gtype, host, port, transport, username) = vm.get_graphics_console()
(gtype, ignore, ignore, ignore, ignore) = vm.get_graphics_console()
if gtype == "vnc":
self.emit("action-show-console", self.connection.get_uri(), guest.uuid)
else:
@ -942,7 +942,6 @@ class vmmCreate(gobject.GObject):
except ValueError, e:
return self.err.val_err(_("ISO Path Not Found"), str(e))
else:
cdlist = self.window.get_widget("cd-path")
src = self.get_config_install_source()
try:
self._guest.installer.location = src

View File

@ -187,7 +187,7 @@ class vmmCreateVolume(gobject.GObject):
meter = vmmCreateMeter(asyncjob)
logging.debug("Starting backround vol creation.")
poolobj = self.vol.install(meter=meter)
self.vol.install(meter=meter)
except Exception, e:
self.error_msg = _("Error creating vol: %s") % str(e)
self.error_details = "".join(traceback.format_exc())

View File

@ -787,8 +787,7 @@ class vmmDetails(gobject.GObject):
self.window.get_widget("overview-status-text").set_text(self.vm.run_status())
self.window.get_widget("overview-status-icon").set_from_pixbuf(self.vm.run_status_icon())
def switch_page(self, ignore1=None, ignore2=None,newpage=None):
details = self.window.get_widget("details-pages")
def switch_page(self, ignore1=None, ignore2=None, newpage=None):
self.page_refresh(newpage)
def refresh_resources(self, ignore=None):
@ -808,8 +807,6 @@ class vmmDetails(gobject.GObject):
active = selection.get_selected()
if active[1] != None:
pagetype = active[0].get_value(active[1], HW_LIST_COL_TYPE)
device_info = active[0].get_value(active[1], HW_LIST_COL_DEVICE)
hw_model = hw_list.get_model()
if pagetype == HW_LIST_TYPE_CPU:
self.refresh_config_cpu()
elif pagetype == HW_LIST_TYPE_MEMORY:
@ -838,7 +835,6 @@ class vmmDetails(gobject.GObject):
(int(round(vm_memory/1024.0)), \
int(round(host_memory/1024.0))))
history_len = self.config.get_stats_history_length()
self.cpu_usage_graph.set_property("data_array", self.vm.cpu_time_vector())
self.memory_usage_graph.set_property("data_array", self.vm.current_memory_vector())
@ -1050,7 +1046,7 @@ class vmmDetails(gobject.GObject):
autoval = self.vm.get_autostart()
self.window.get_widget("config-autostart").set_active(autoval)
self.window.get_widget("config-autostart").set_sensitive(True)
except libvirt.libvirtError, e:
except libvirt.libvirtError:
# Autostart isn't supported
self.window.get_widget("config-autostart").set_active(False)
self.window.get_widget("config-autostart").set_sensitive(False)
@ -1181,7 +1177,6 @@ class vmmDetails(gobject.GObject):
return
logging.debug("Trying console login")
password = self.window.get_widget("console-auth-password").get_text()
protocol, host, port, trans, username = self.vm.get_graphics_console()
if protocol is None:
@ -1291,8 +1286,6 @@ class vmmDetails(gobject.GObject):
if not(file.endswith(".png")):
file = file + ".png"
image = self.vncViewer.get_pixbuf()
width = image.get_width()
height = image.get_height()
# Save along with a little metadata about us & the domain
image.save(file, 'png', { 'tEXt::Hypervisor URI': self.vm.get_connection().get_uri(),
@ -1396,7 +1389,6 @@ class vmmDetails(gobject.GObject):
memadj.value = memory
def config_memory_apply(self, src):
status = self.vm.status()
self.refresh_config_memory()
exc = None
curmem = None

View File

@ -207,7 +207,6 @@ class vmmDomain(gobject.GObject):
return
# Clear cached XML
self.xml = None
hostInfo = self.connection.get_host_info()
info = self.vm.info()
expected = self.config.get_stats_history_length()
current = len(self.record)
@ -542,7 +541,6 @@ class vmmDomain(gobject.GObject):
devs = ctx.xpathEval("/domain/devices/serial")
for node in devs:
name = "Serial "
usable = False
dev_type = node.prop("type")
source_path = None
@ -1029,7 +1027,6 @@ class vmmDomain(gobject.GObject):
except:
return []
ctx = doc.xpathNewContext()
graphics = []
dev = None
try:
ret = ctx.xpathEval("/domain/os/boot[1]")
@ -1051,8 +1048,6 @@ class vmmDomain(gobject.GObject):
except:
return []
ctx = doc.xpathNewContext()
graphics = []
dev = None
try:
ret = ctx.xpathEval("/domain/os/boot[1]")
if len(ret) > 0:

View File

@ -246,8 +246,6 @@ class vmmEngine(gobject.GObject):
win.activate_console_page()
def refresh_console(self, uri, uuid):
con = self.get_connection(uri)
if not(self.connections[uri]["windowConsole"].has_key(uuid)):
return
@ -576,7 +574,7 @@ class vmmEngine(gobject.GObject):
for item in menu:
menu.remove(item)
for key, val_list in conns.items():
for ignore, val_list in conns.items():
can_migrate, label, tooltip = val_list
mitem = gtk.ImageMenuItem(label)
mitem.set_sensitive(can_migrate)
@ -593,7 +591,6 @@ class vmmEngine(gobject.GObject):
menu.add(mitem)
def get_available_migrate_hostnames(self):
hostname = self.windowManager.current_connection().get_hostname()
driver = self.windowManager.current_connection().get_driver()
uri = self.windowManager.current_connection().get_uri()
available_migrate_hostnames = {}

View File

@ -614,13 +614,6 @@ class vmmHost(gobject.GObject):
if event.button != 3:
return
tup = widget.get_path_at_pos(int(event.x), int(event.y))
if tup == None:
return False
path = tup[0]
model = widget.get_model()
iter = model.get_iter(path)
vol = model.get_value(iter, 0)
self.volmenu.popup(None, None, None, 0, event.time)
def copy_vol_path(self, ignore=None):

View File

@ -443,7 +443,7 @@ class vmmManager(gobject.GObject):
logging.debug("VM %s started" % vm.get_name())
if self.config.get_console_popup() == 2 and not vm.is_management_domain():
# user has requested consoles on all vms
(gtype, host, port, transport, username) = vm.get_graphics_console()
(gtype, ignore, ignore, ignore, ignore) = vm.get_graphics_console()
if gtype == "vnc":
self.emit("action-show-console", uri, vmuuid)
elif not connection.is_remote():
@ -961,7 +961,6 @@ class vmmManager(gobject.GObject):
self.config.set_vmlist_domain_id_visible(menu.get_active())
def toggle_domain_id_visible_widget(self, ignore1, ignore2, ignore3, ignore4):
menu = self.window.get_widget("menu_view_domain_id")
vmlist = self.window.get_widget("vm-list")
col = vmlist.get_column(COL_ID)
col.set_visible(self.config.is_vmlist_domain_id_visible())
@ -970,7 +969,6 @@ class vmmManager(gobject.GObject):
self.config.set_vmlist_status_visible(menu.get_active())
def toggle_status_visible_widget(self, ignore1, ignore2, ignore3, ignore4):
menu = self.window.get_widget("menu_view_status")
vmlist = self.window.get_widget("vm-list")
col = vmlist.get_column(COL_STATUS)
col.set_visible(self.config.is_vmlist_status_visible())
@ -979,7 +977,6 @@ class vmmManager(gobject.GObject):
self.config.set_vmlist_cpu_usage_visible(menu.get_active())
def toggle_cpu_usage_visible_widget(self, ignore1, ignore2, ignore3, ignore4):
menu = self.window.get_widget("menu_view_cpu_usage")
vmlist = self.window.get_widget("vm-list")
col = vmlist.get_column(COL_CPU)
col.set_visible(self.config.is_vmlist_cpu_usage_visible())
@ -988,7 +985,6 @@ class vmmManager(gobject.GObject):
self.config.set_vmlist_virtual_cpus_visible(menu.get_active())
def toggle_virtual_cpus_visible_widget(self, ignore1, ignore2, ignore3, ignore4):
menu = self.window.get_widget("menu_view_virtual_cpus")
vmlist = self.window.get_widget("vm-list")
col = vmlist.get_column(COL_VCPU)
col.set_visible(self.config.is_vmlist_virtual_cpus_visible())
@ -997,7 +993,6 @@ class vmmManager(gobject.GObject):
self.config.set_vmlist_memory_usage_visible(menu.get_active())
def toggle_memory_usage_visible_widget(self, ignore1, ignore2, ignore3, ignore4):
menu = self.window.get_widget("menu_view_memory_usage")
vmlist = self.window.get_widget("vm-list")
col = vmlist.get_column(COL_MEM)
col.set_visible(self.config.is_vmlist_memory_usage_visible())
@ -1006,7 +1001,6 @@ class vmmManager(gobject.GObject):
self.config.set_vmlist_disk_io_visible(menu.get_active())
def toggle_disk_io_visible_widget(self, ignore1, ignore2, ignore3, ignore4):
menu = self.window.get_widget("menu_view_disk_io")
vmlist = self.window.get_widget("vm-list")
col = vmlist.get_column(COL_DISK)
col.set_visible(self.config.is_vmlist_disk_io_visible())
@ -1015,7 +1009,6 @@ class vmmManager(gobject.GObject):
self.config.set_vmlist_network_traffic_visible(menu.get_active())
def toggle_network_traffic_visible_widget(self, ignore1, ignore2, ignore3, ignore4):
menu = self.window.get_widget("menu_view_network_traffic")
vmlist = self.window.get_widget("vm-list")
col = vmlist.get_column(COL_NETWORK)
col.set_visible(self.config.is_vmlist_network_traffic_visible())