If we specify 'default' on the config file (default),
vm.driver_type == vm.LIBVIRT_DEFAULT, even if the
detected driver is one we know how to do things with.

So verify the detected virsh uri, if it matches one
of our known types, update vm.driver_type to that
type and be happy.

With this bugfix, the default config file for libvirt test
works again.

CC: Signed-off-by: Xu He Jie <[email protected]>
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 client/virt/libvirt_vm.py |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index 32bbfd8..908f12a 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -261,8 +261,6 @@ class VM(virt_vm.BaseVM):
     """
     This class handles all basic VM operations for libvirt.
     """
-
-
     # constant for libirt driver type,
     # now it only supports default, qemu and xen.
     LIBVIRT_DEFAULT = "default"
@@ -305,7 +303,7 @@ class VM(virt_vm.BaseVM):
         self.driver_type = params.get("driver_type", self.LIBVIRT_DEFAULT)
 
         default_uri = virsh_uri()
-        if not self.driver_type:
+        if not self.driver_type or self.driver_type == self.LIBVIRT_DEFAULT:
             if default_uri == "qemu:///system":
                 self.driver_type = self.LIBVIRT_QEMU
             elif default_uri == "xen:///":
-- 
1.7.7.1

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to