mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-06 14:13:28 -06:00
connection: De-duplicate ui and cli version logging
Remove the open coded version logging in cli.py and virt-manager connection.py, and move it into virtinst connection open Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
aeffa4f711
commit
8079c421bd
@ -950,11 +950,6 @@ class vmmConnection(vmmGObject):
|
||||
return False, ConnectError
|
||||
|
||||
def _populate_initial_state(self):
|
||||
log.debug("libvirt version=%s", self._backend.local_libvirt_version())
|
||||
log.debug("daemon version=%s", self._backend.daemon_version())
|
||||
log.debug("conn version=%s", self._backend.conn_version())
|
||||
log.debug("%s capabilities:\n%s", self.get_uri(), self.caps.get_xml())
|
||||
|
||||
if not self.support.conn_domain(): # pragma: no cover
|
||||
raise RuntimeError("Connection does not support required "
|
||||
"domain listing APIs")
|
||||
|
@ -214,21 +214,10 @@ def getConnection(uri, conn=None):
|
||||
# preopened connection passed in via test suite
|
||||
return conn
|
||||
|
||||
def format_version(num):
|
||||
log.debug(num)
|
||||
maj = int(num / 1000000)
|
||||
min = int(num / 1000) % 1000
|
||||
mic = num % 1000
|
||||
return "%s.%s.%s" % (maj, min, mic)
|
||||
|
||||
log.debug("Requesting libvirt URI %s", (uri or "default"))
|
||||
conn = VirtinstConnection(uri)
|
||||
conn.open(_openauth_cb, None)
|
||||
log.debug("Received libvirt URI %s versions library=%s driver=%s hypervisor=%s",
|
||||
conn.uri,
|
||||
format_version(libvirt.getVersion()),
|
||||
format_version(conn.getLibVersion()),
|
||||
format_version(conn.getVersion()))
|
||||
log.debug("Received libvirt URI %s", conn.uri)
|
||||
|
||||
return conn
|
||||
|
||||
|
@ -114,6 +114,23 @@ class VirtinstConnection(object):
|
||||
return self._libvirtconn
|
||||
|
||||
|
||||
###################
|
||||
# Private helpers #
|
||||
###################
|
||||
|
||||
def _log_versions(self):
|
||||
def format_version(num):
|
||||
major = int(num / 1000000)
|
||||
minor = int(num / 1000) % 1000
|
||||
micro = num % 1000
|
||||
return "%s.%s.%s" % (major, minor, micro)
|
||||
|
||||
log.debug("libvirt URI versions library=%s driver=%s hypervisor=%s",
|
||||
format_version(self.local_libvirt_version()),
|
||||
format_version(self.daemon_version()),
|
||||
format_version(self.conn_version()))
|
||||
|
||||
|
||||
##############
|
||||
# Public API #
|
||||
##############
|
||||
@ -163,6 +180,9 @@ class VirtinstConnection(object):
|
||||
self._uri = self._libvirtconn.getURI()
|
||||
self._uriobj = URI(self._uri)
|
||||
|
||||
self._log_versions()
|
||||
self._get_caps() # cache and log capabilities
|
||||
|
||||
def get_libvirt_data_root_dir(self):
|
||||
if self.is_privileged():
|
||||
return "/var/lib/libvirt"
|
||||
|
Loading…
Reference in New Issue
Block a user