support: Remove getversion/getlibversion checks

They are only used in one place, just handle it there
This commit is contained in:
Cole Robinson 2018-08-31 17:43:58 -04:00
parent d8514e19c8
commit 2eaff7fdcf
2 changed files with 10 additions and 11 deletions

View File

@ -303,22 +303,24 @@ class VirtinstConnection(object):
if not self.is_remote():
return self.local_libvirt_version()
if not self._daemon_version:
if not self.check_support(support.SUPPORT_CONN_LIBVERSION):
self._daemon_version = 0
else:
if self._daemon_version is None:
self._daemon_version = 0
try:
self._daemon_version = self._libvirtconn.getLibVersion()
except Exception:
logging.debug("Error calling getLibVersion", exc_info=True)
return self._daemon_version
def conn_version(self):
if self._fake_conn_version is not None:
return self._fake_conn_version
if not self._conn_version:
if not self.check_support(support.SUPPORT_CONN_GETVERSION):
self._conn_version = 0
else:
if self._conn_version is None:
self._conn_version = 0
try:
self._conn_version = self._libvirtconn.getVersion()
except Exception:
logging.debug("Error calling getVersion", exc_info=True)
return self._conn_version
def stable_defaults(self, emulator=None, force=False):

View File

@ -226,9 +226,6 @@ SUPPORT_CONN_MAXVCPUS_XML = _make(version="0.8.5")
# Earliest version with working bindings
SUPPORT_CONN_STREAM = _make(
version="0.9.3", function="virConnect.newStream", run_args=(0,))
SUPPORT_CONN_GETVERSION = _make(function="virConnect.getVersion", run_args=())
SUPPORT_CONN_LIBVERSION = _make(
function="virConnect.getLibVersion", run_args=())
SUPPORT_CONN_LISTALLDOMAINS = _make(
function="virConnect.listAllDomains", run_args=())
SUPPORT_CONN_LISTALLNETWORKS = _make(