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 <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2022-01-17 13:44:37 -05:00
parent c51ebdd76a
commit 499badbdf4
2 changed files with 12 additions and 0 deletions

View File

@ -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)

View File

@ -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):
"""