[RFC virt-manager v2] virtmanager: list active node devices only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


With virt-manager application, it is possible to add inactive node
devices(eg: mediated devices) in host system to guest system. But it
is impossible to start a guest system with inactive node devices.
Also, it is not yet possible to start a node device with virt-manager
application. So, the user cannot use the inactive node device.

This patch filters out all inactive node devices and lists only active
node devices in virt-manager application, so that it is only possible
to add active node devices to the guest system.

Signed-off-by: Shalini Chellathurai Saroja <shalini@xxxxxxxxxxxxx>
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
 virtManager/connection.py |  2 +-
 virtinst/pollhelpers.py   | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/virtManager/connection.py b/virtManager/connection.py
index 68a37ea6..8462108b 100644
--- a/virtManager/connection.py
+++ b/virtManager/connection.py
@@ -1113,7 +1113,7 @@ class vmmConnection(vmmGObject):
                 dopoll = pollnodedev
                 objs = self.list_nodedevs()
                 cls = vmmNodeDevice
-                pollcb = pollhelpers.fetch_nodedevs
+                pollcb = pollhelpers.fetch_active_nodedevs
                 dopoll = pollvm
                 objs = self.list_vms()
diff --git a/virtinst/pollhelpers.py b/virtinst/pollhelpers.py
index ef695914..ca12d165 100644
--- a/virtinst/pollhelpers.py
+++ b/virtinst/pollhelpers.py
@@ -5,10 +5,11 @@
 # See the COPYING file in the top-level directory.
+import libvirt
 from .logger import log
-def _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb):
+def _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb, flags=0):
     Helper for new style listAll* APIs
@@ -17,8 +18,10 @@ def _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb):
     objs = []
-        if support_cb():
+        if support_cb() and not(flags):
             objs = list_cb()
+        else:
+            objs = list_cb(flags)
     except Exception as e:  # pragma: no cover
         log.debug("Unable to list all %ss: %s", typename, e)
@@ -65,6 +68,14 @@ def fetch_nodedevs(backend, origmap, build_cb):
     return _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb)
+def fetch_active_nodedevs(backend, origmap, build_cb):
+    typename = "nodedev"
+    list_cb = backend.listAllDevices
+    support_cb = backend.support.conn_nodedev
+    return _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb, flags)
 def fetch_vms(backend, origmap, build_cb):
     typename = "domain"
     list_cb = backend.listAllDomains

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux