From 499badbdf4b0b3914a6078f7f37234dd6613ab1e Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 17 Jan 2022 13:44:37 -0500 Subject: object: nodedev: support isActive state This was added to libvirt in the past few years, and we may want it for mdev addhardware UI Signed-off-by: Cole Robinson --- virtManager/object/nodedev.py | 7 +++++++ virtinst/support.py | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/virtManager/object/nodedev.py b/virtManager/object/nodedev.py index 797569b2..a89663fb 100644 --- a/virtManager/object/nodedev.py +++ b/virtManager/object/nodedev.py @@ -57,6 +57,13 @@ class vmmNodeDevice(vmmLibvirtObject): return self._STATUS_ACTIVE def _using_events(self): return self.conn.using_node_device_events + def _get_backend_status(self): + is_active = True + if self.conn.support.nodedev_isactive(self._backend): + is_active = self._backend.isActive() + return (is_active and + self._STATUS_ACTIVE or + self._STATUS_INACTIVE) def pretty_name(self): return _pretty_name(self.xmlobj) diff --git a/virtinst/support.py b/virtinst/support.py index 5511bb7a..b43e024e 100644 --- a/virtinst/support.py +++ b/virtinst/support.py @@ -304,6 +304,11 @@ class SupportCache: flag="VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA", version="1.0.1") + # Nodedev checks + # Added in libvirt 7.8.0 mid 2021 + nodedev_isactive = _make( + function="virNodeDevice.isActive", run_args=()) + def _check_version(self, version): """ -- cgit v1.2.1