mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-25 23:21:45 +03:00
connection: Don't pass redundant 'uri' to callbacks
This commit is contained in:
parent
15e6cc18f6
commit
44869d2e6c
@ -268,13 +268,13 @@ class vmmConnection(vmmGObject):
|
||||
|
||||
if name == "vm-added":
|
||||
for uuid in self.vms.keys():
|
||||
self.emit("vm-added", self.get_uri(), uuid)
|
||||
self.emit("vm-added", uuid)
|
||||
elif name == "mediadev-added":
|
||||
for dev in self.mediadevs.values():
|
||||
self.emit("mediadev-added", dev)
|
||||
elif name == "nodedev-added":
|
||||
for key in self.nodedevs.keys():
|
||||
self.emit("nodedev-added", self.get_uri(), key)
|
||||
self.emit("nodedev-added", key)
|
||||
|
||||
return handle_id
|
||||
|
||||
@ -858,7 +858,7 @@ class vmmConnection(vmmGObject):
|
||||
|
||||
self._add_mediadev(key, dev)
|
||||
|
||||
def _nodedev_mediadev_added(self, ignore1, ignore2, name):
|
||||
def _nodedev_mediadev_added(self, ignore1, name):
|
||||
if name in self.mediadevs:
|
||||
return
|
||||
|
||||
@ -869,7 +869,7 @@ class vmmConnection(vmmGObject):
|
||||
|
||||
self._add_mediadev(name, mediadev)
|
||||
|
||||
def _nodedev_mediadev_removed(self, ignore1, ignore2, name):
|
||||
def _nodedev_mediadev_removed(self, ignore1, name):
|
||||
if name not in self.mediadevs:
|
||||
return
|
||||
|
||||
@ -1442,7 +1442,6 @@ class vmmConnection(vmmGObject):
|
||||
app with long tick operations.
|
||||
"""
|
||||
# Connection closed out from under us
|
||||
uri = self.get_uri()
|
||||
if not self.vmm:
|
||||
return
|
||||
|
||||
@ -1455,50 +1454,50 @@ class vmmConnection(vmmGObject):
|
||||
|
||||
# Update VM states
|
||||
for uuid in oldVMs:
|
||||
self.emit("vm-removed", uri, uuid)
|
||||
self.emit("vm-removed", uuid)
|
||||
oldVMs[uuid].cleanup()
|
||||
for uuid in newVMs:
|
||||
self.emit("vm-added", uri, uuid)
|
||||
self.emit("vm-added", uuid)
|
||||
|
||||
# Update virtual network states
|
||||
for uuid in oldNets:
|
||||
self.emit("net-removed", uri, uuid)
|
||||
self.emit("net-removed", uuid)
|
||||
oldNets[uuid].cleanup()
|
||||
for uuid in newNets:
|
||||
self.emit("net-added", uri, uuid)
|
||||
self.emit("net-added", uuid)
|
||||
for uuid in startNets:
|
||||
self.emit("net-started", uri, uuid)
|
||||
self.emit("net-started", uuid)
|
||||
for uuid in stopNets:
|
||||
self.emit("net-stopped", uri, uuid)
|
||||
self.emit("net-stopped", uuid)
|
||||
|
||||
# Update storage pool states
|
||||
for uuid in oldPools:
|
||||
self.emit("pool-removed", uri, uuid)
|
||||
self.emit("pool-removed", uuid)
|
||||
oldPools[uuid].cleanup()
|
||||
for uuid in newPools:
|
||||
self.emit("pool-added", uri, uuid)
|
||||
self.emit("pool-added", uuid)
|
||||
for uuid in startPools:
|
||||
self.emit("pool-started", uri, uuid)
|
||||
self.emit("pool-started", uuid)
|
||||
for uuid in stopPools:
|
||||
self.emit("pool-stopped", uri, uuid)
|
||||
self.emit("pool-stopped", uuid)
|
||||
|
||||
# Update interface states
|
||||
for name in oldInterfaces:
|
||||
self.emit("interface-removed", uri, name)
|
||||
self.emit("interface-removed", name)
|
||||
oldInterfaces[name].cleanup()
|
||||
for name in newInterfaces:
|
||||
self.emit("interface-added", uri, name)
|
||||
self.emit("interface-added", name)
|
||||
for name in startInterfaces:
|
||||
self.emit("interface-started", uri, name)
|
||||
self.emit("interface-started", name)
|
||||
for name in stopInterfaces:
|
||||
self.emit("interface-stopped", uri, name)
|
||||
self.emit("interface-stopped", name)
|
||||
|
||||
# Update nodedev list
|
||||
for name in oldNodedevs:
|
||||
self.emit("nodedev-removed", uri, name)
|
||||
self.emit("nodedev-removed", name)
|
||||
oldNodedevs[name].cleanup()
|
||||
for name in newNodedevs:
|
||||
self.emit("nodedev-added", uri, name)
|
||||
self.emit("nodedev-added", name)
|
||||
|
||||
self.safe_idle_add(tick_send_signals)
|
||||
|
||||
@ -1657,26 +1656,26 @@ class vmmConnection(vmmGObject):
|
||||
self.config.get_iso_paths)
|
||||
|
||||
vmmGObject.type_register(vmmConnection)
|
||||
vmmGObject.signal_new(vmmConnection, "vm-added", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "vm-removed", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "vm-added", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "vm-removed", [str])
|
||||
|
||||
vmmGObject.signal_new(vmmConnection, "net-added", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "net-removed", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "net-started", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "net-stopped", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "net-added", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "net-removed", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "net-started", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "net-stopped", [str])
|
||||
|
||||
vmmGObject.signal_new(vmmConnection, "pool-added", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "pool-removed", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "pool-started", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "pool-stopped", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "pool-added", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "pool-removed", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "pool-started", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "pool-stopped", [str])
|
||||
|
||||
vmmGObject.signal_new(vmmConnection, "interface-added", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "interface-removed", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "interface-started", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "interface-stopped", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "interface-added", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "interface-removed", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "interface-started", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "interface-stopped", [str])
|
||||
|
||||
vmmGObject.signal_new(vmmConnection, "nodedev-added", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "nodedev-removed", [str, str])
|
||||
vmmGObject.signal_new(vmmConnection, "nodedev-added", [str])
|
||||
vmmGObject.signal_new(vmmConnection, "nodedev-removed", [str])
|
||||
|
||||
vmmGObject.signal_new(vmmConnection, "mediadev-added", [object])
|
||||
vmmGObject.signal_new(vmmConnection, "mediadev-removed", [str])
|
||||
|
@ -373,8 +373,8 @@ class vmmEngine(vmmGObject):
|
||||
self.exit_app(src)
|
||||
|
||||
|
||||
def _do_vm_removed(self, connection, hvuri, vmuuid):
|
||||
ignore = connection
|
||||
def _do_vm_removed(self, conn, vmuuid):
|
||||
hvuri = conn.get_uri()
|
||||
if vmuuid not in self.connections[hvuri]["windowDetails"]:
|
||||
return
|
||||
|
||||
|
@ -482,7 +482,7 @@ class vmmHost(vmmGObjectUI):
|
||||
return self.conn.get_net(curruuid)
|
||||
return None
|
||||
|
||||
def refresh_network(self, src_ignore, uri_ignore, uuid):
|
||||
def refresh_network(self, src_ignore, uuid):
|
||||
uilist = self.widget("net-list")
|
||||
sel = uilist.get_selection()
|
||||
active = sel.get_selected()
|
||||
@ -586,7 +586,7 @@ class vmmHost(vmmGObjectUI):
|
||||
_("Isolated virtual network"))
|
||||
self.widget("net-apply").set_sensitive(False)
|
||||
|
||||
def repopulate_networks(self, src_ignore, uri_ignore, uuid_ignore):
|
||||
def repopulate_networks(self, src_ignore, uuid_ignore):
|
||||
self.populate_networks(self.widget("net-list").get_model())
|
||||
|
||||
def populate_networks(self, model):
|
||||
@ -704,7 +704,7 @@ class vmmHost(vmmGObjectUI):
|
||||
if cp is None:
|
||||
return
|
||||
cp.refresh()
|
||||
self.refresh_storage_pool(None, None, cp.get_uuid())
|
||||
self.refresh_storage_pool(None, cp.get_uuid())
|
||||
|
||||
def current_pool(self):
|
||||
sel = self.widget("pool-list").get_selection()
|
||||
@ -811,7 +811,7 @@ class vmmHost(vmmGObjectUI):
|
||||
util.tooltip_wrapper(self.widget("vol-add"),
|
||||
str(e))
|
||||
|
||||
def refresh_storage_pool(self, src_ignore, uri_ignore, uuid):
|
||||
def refresh_storage_pool(self, src_ignore, uuid):
|
||||
refresh_pool_in_list(self.widget("pool-list"), self.conn, uuid)
|
||||
curpool = self.current_pool()
|
||||
if curpool.uuid != uuid:
|
||||
@ -867,7 +867,7 @@ class vmmHost(vmmGObjectUI):
|
||||
clipboard.set_text(target_path)
|
||||
|
||||
|
||||
def repopulate_storage_pools(self, src_ignore, uri_ignore, uuid_ignore):
|
||||
def repopulate_storage_pools(self, src_ignore, uuid_ignore):
|
||||
pool_list = self.widget("pool-list")
|
||||
populate_storage_pools(pool_list, self.conn)
|
||||
|
||||
@ -958,7 +958,7 @@ class vmmHost(vmmGObjectUI):
|
||||
if cp is None:
|
||||
return
|
||||
|
||||
self.refresh_interface(None, None, cp.get_name())
|
||||
self.refresh_interface(None, cp.get_name())
|
||||
|
||||
def current_interface(self):
|
||||
sel = self.widget("interface-list").get_selection()
|
||||
@ -1098,7 +1098,7 @@ class vmmHost(vmmGObjectUI):
|
||||
self.widget("interface-child-box").set_property("visible", show_child)
|
||||
self.populate_interface_children()
|
||||
|
||||
def refresh_interface(self, src_ignore, uri_ignore, name):
|
||||
def refresh_interface(self, src_ignore, name):
|
||||
iface_list = self.widget("interface-list")
|
||||
sel = iface_list.get_selection()
|
||||
active = sel.get_selected()
|
||||
@ -1121,7 +1121,7 @@ class vmmHost(vmmGObjectUI):
|
||||
self.widget("interface-start").set_sensitive(False)
|
||||
self.widget("interface-apply").set_sensitive(False)
|
||||
|
||||
def repopulate_interfaces(self, src_ignore, uri_ignore, name_ignore):
|
||||
def repopulate_interfaces(self, src_ignore, name_ignore):
|
||||
interface_list = self.widget("interface-list")
|
||||
self.populate_interfaces(interface_list.get_model())
|
||||
|
||||
|
@ -47,9 +47,8 @@ class vmmInspection(Thread):
|
||||
self._q.put(obj)
|
||||
|
||||
# Called by the main thread whenever a VM is added to vmlist.
|
||||
def vm_added(self, conn, uri, uuid):
|
||||
def vm_added(self, conn, uuid):
|
||||
ignore = conn
|
||||
ignore = uri
|
||||
ignore = uuid
|
||||
obj = ("vm_added")
|
||||
self._q.put(obj)
|
||||
|
@ -676,8 +676,8 @@ class vmmManager(vmmGObjectUI):
|
||||
def vm_row_key(self, vm):
|
||||
return vm.get_uuid() + ":" + vm.get_connection().get_uri()
|
||||
|
||||
def vm_added(self, connection, uri_ignore, vmuuid):
|
||||
vm = connection.get_vm(vmuuid)
|
||||
def vm_added(self, conn, vmuuid):
|
||||
vm = conn.get_vm(vmuuid)
|
||||
vm.connect("status-changed", self.vm_status_changed)
|
||||
vm.connect("resources-sampled", self.vm_resources_sampled)
|
||||
vm.connect("config-changed", self.vm_resources_sampled, True)
|
||||
@ -686,13 +686,13 @@ class vmmManager(vmmGObjectUI):
|
||||
vmlist = self.widget("vm-list")
|
||||
model = vmlist.get_model()
|
||||
|
||||
self._append_vm(model, vm, connection)
|
||||
self._append_vm(model, vm, conn)
|
||||
|
||||
def vm_removed(self, connection, uri_ignore, vmuuid):
|
||||
def vm_removed(self, conn, vmuuid):
|
||||
vmlist = self.widget("vm-list")
|
||||
model = vmlist.get_model()
|
||||
|
||||
parent = self.rows[connection.get_uri()].iter
|
||||
parent = self.rows[conn.get_uri()].iter
|
||||
for row in range(model.iter_n_children(parent)):
|
||||
vm = model.get_value(model.iter_nth_child(parent, row), ROW_HANDLE)
|
||||
if vm.get_uuid() == vmuuid:
|
||||
|
@ -231,7 +231,7 @@ class vmmStorageBrowser(vmmGObjectUI):
|
||||
return
|
||||
return pool.get_volume(row[0])
|
||||
|
||||
def refresh_storage_pool(self, src_ignore, uri_ignore, uuid):
|
||||
def refresh_storage_pool(self, src_ignore, uuid):
|
||||
pool_list = self.widget("pool-list")
|
||||
virtManager.host.refresh_pool_in_list(pool_list, self.conn, uuid)
|
||||
curpool = self.current_pool()
|
||||
@ -242,7 +242,7 @@ class vmmStorageBrowser(vmmGObjectUI):
|
||||
# update vol list
|
||||
self.pool_selected(self.widget("pool-list").get_selection())
|
||||
|
||||
def repopulate_storage_pools(self, src_ignore, uri_ignore, uuid_ignore):
|
||||
def repopulate_storage_pools(self, src_ignore, uuid_ignore):
|
||||
pool_list = self.widget("pool-list")
|
||||
virtManager.host.populate_storage_pools(pool_list, self.conn)
|
||||
|
||||
@ -270,7 +270,7 @@ class vmmStorageBrowser(vmmGObjectUI):
|
||||
if cp is None:
|
||||
return
|
||||
cp.refresh()
|
||||
self.refresh_storage_pool(None, None, cp.get_uuid())
|
||||
self.refresh_storage_pool(None, cp.get_uuid())
|
||||
|
||||
def new_volume(self, src_ignore):
|
||||
pool = self.current_pool()
|
||||
|
@ -348,7 +348,8 @@ class vmmSystray(vmmGObject):
|
||||
vm_item = self.conn_vm_menuitems[uri][uuid]
|
||||
vm_submenu.insert(vm_item, i)
|
||||
|
||||
def vm_added(self, conn, uri, uuid):
|
||||
def vm_added(self, conn, uuid):
|
||||
uri = conn.get_uri()
|
||||
vm = conn.get_vm(uuid)
|
||||
if not vm:
|
||||
return
|
||||
@ -372,7 +373,8 @@ class vmmSystray(vmmGObject):
|
||||
self.vm_state_changed(vm)
|
||||
menu_item.show()
|
||||
|
||||
def vm_removed(self, conn_ignore, uri, uuid):
|
||||
def vm_removed(self, conn, uuid):
|
||||
uri = conn.get_uri()
|
||||
vm_mappings = self.conn_vm_menuitems[uri]
|
||||
if not vm_mappings:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user