[RFC virt-manager] 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>
---
 virtManager/connection.py |  2 +-
 virtinst/pollhelpers.py   | 14 ++++++++++++--
 2 files changed, 13 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
             else:
                 dopoll = pollvm
                 objs = self.list_vms()
diff --git a/virtinst/pollhelpers.py b/virtinst/pollhelpers.py
index ef695914..8c8a8bf8 100644
--- a/virtinst/pollhelpers.py
+++ b/virtinst/pollhelpers.py
@@ -8,7 +8,7 @@
 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 +17,10 @@ def _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb):
     objs = []
 
     try:
-        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 +67,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"
+    flags = 2147483648
+    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
-- 
2.30.2




[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