[virt-tools-list] [virt-manager PATCH 1/2] Move stable_defaults from vmmConnection to VirtualConnection

Giuseppe Scrivano gscrivan at redhat.com
Tue Feb 24 12:59:50 UTC 2015


Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 virtManager/config.py     |  3 +--
 virtManager/connection.py | 14 ++------------
 virtinst/connection.py    | 15 ++++++++++++++-
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/virtManager/config.py b/virtManager/config.py
index df649ab..7fef277 100644
--- a/virtManager/config.py
+++ b/virtManager/config.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006, 2012-2014 Red Hat, Inc.
+# Copyright (C) 2006, 2012-2015 Red Hat, Inc.
 # Copyright (C) 2006 Daniel P. Berrange <berrange at redhat.com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -155,7 +155,6 @@ class vmmConfig(object):
         self.keyring = None
 
         self.default_qemu_user = cliconfig.default_qemu_user
-        self.stable_defaults = cliconfig.stable_defaults
         self.preferred_distros = cliconfig.preferred_distros
         self.hv_packages = cliconfig.hv_packages
         self.libvirt_packages = cliconfig.libvirt_packages
diff --git a/virtManager/connection.py b/virtManager/connection.py
index 645823c..32bd45b 100644
--- a/virtManager/connection.py
+++ b/virtManager/connection.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006, 2013, 2014 Red Hat, Inc.
+# Copyright (C) 2006, 2013, 2014, 2015 Red Hat, Inc.
 # Copyright (C) 2006 Daniel P. Berrange <berrange at redhat.com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -315,17 +315,7 @@ class vmmConnection(vmmGObject):
 
     # Connection capabilities debug helpers
     def stable_defaults(self, emulator=None):
-        if not self.is_qemu_system():
-            return False
-        if emulator:
-            if not str(emulator).startswith("/usr/libexec"):
-                return False
-        else:
-            for guest in self.caps.guests:
-                for dom in guest.domains:
-                    if dom.emulator.startswith("/usr/libexec"):
-                        return self.config.stable_defaults
-        return self.config.stable_defaults
+        return self._backend.stable_defaults(emulator)
 
     def get_cache_dir(self):
         uri = self.get_uri().replace("/", "_")
diff --git a/virtinst/connection.py b/virtinst/connection.py
index 7607ad9..0729e05 100644
--- a/virtinst/connection.py
+++ b/virtinst/connection.py
@@ -1,5 +1,5 @@
 #
-# Copyright 2013, 2014 Red Hat, Inc.
+# Copyright 2013, 2014, 2015 Red Hat, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -31,6 +31,7 @@ from .cli import VirtOptionString
 from .guest import Guest
 from .nodedev import NodeDevice
 from .storage import StoragePool, StorageVolume
+from virtcli import cliconfig
 
 _virtinst_uri_magic = "__virtinst_test__"
 
@@ -326,6 +327,18 @@ class VirtualConnection(object):
                 self._conn_version = self._libvirtconn.getVersion()
         return self._conn_version
 
+    def stable_defaults(self, emulator=None):
+        if not self.is_qemu_system():
+            return False
+        if emulator:
+            if not str(emulator).startswith("/usr/libexec"):
+                return False
+        else:
+            for guest in self.caps.guests:
+                for dom in guest.domains:
+                    if dom.emulator.startswith("/usr/libexec"):
+                        return self.config.stable_defaults
+        return cliconfig.stable_defaults
 
     ###################
     # Public URI bits #
-- 
2.1.0




More information about the virt-tools-list mailing list