From 1b0324e3e37606df24e93435c5550bfe36be52fd Mon Sep 17 00:00:00 2001 From: catborise Date: Thu, 19 Dec 2019 12:06:42 +0300 Subject: [PATCH] Add is_support_virtio function and is_qemu functions --- vrtManager/connection.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/vrtManager/connection.py b/vrtManager/connection.py index d6ebca2..8e826f0 100644 --- a/vrtManager/connection.py +++ b/vrtManager/connection.py @@ -273,7 +273,7 @@ class wvmConnectionManager(object): if connection is None: self._connections_lock.acquireWrite() try: - # we have to search for the connection again after aquireing the write lock + # we have to search for the connection again after acquiring the write lock # as the thread previously holding the write lock may have already added our connection connection = self._search_connection(host, login, passwd, conn) if connection is None: @@ -341,6 +341,9 @@ class wvmConnect(object): # get connection from connection manager self.wvm = connection_manager.get_connection(host, login, passwd, conn) + def is_qemu(self): + return self.wvm.getURI().startswith("qemu") + def get_cap_xml(self): """Return xml capabilities""" return self.wvm.getCapabilities() @@ -809,3 +812,17 @@ class wvmConnect(object): return ("readonly" in loader_enums and "yes" in loader_enums.get("readonly")) + def is_supports_virtio(self, arch, machine): + if not self.is_qemu(): + return False + + # These _only_ support virtio so don't check the OS + if arch in ["aarch64", "armv7l", "ppc64", "ppc64le", "s390x", "riscv64", "riscv32"] and \ + machine in ["virt", "pseries"]: + return True + + if arch in ["x86_64", "i686"]: + return True + + return False +