test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] framework: add virt_type option for virt type(kvm/libvirt) selection
@ 2018-01-09  6:00 Herbert Guan
  2018-01-09  6:54 ` Liu, Yong
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Herbert Guan @ 2018-01-09  6:00 UTC (permalink / raw)
  To: dts; +Cc: Herbert Guan

Allow users to use test config file to specify virt type(kvm, libvirt, etc) by
'virt_type' option.  If not specified in config file, the default virt_type
is kvm (qemu_kvm).


Signed-off-by: Herbert Guan <herbert.guan@arm.com>
---
 framework/virt_base.py | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/framework/virt_base.py b/framework/virt_base.py
index 1838ca1..cd6dc0c 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -98,13 +98,22 @@ class VirtBase(object):
         """
         Get the virtual type, such as KVM, XEN or LIBVIRT.
         """
-        NotImplemented
+        conf = VirtConf(CONFIG_ROOT_PATH + os.sep + self.suite + '.cfg')
+        conf.load_virt_config(self.vm_name)
+        local_conf = conf.get_virt_config()
+        for param in local_conf:
+            if 'virt_type' in param.keys():
+                return param['virt_type'][0]['virt_type']
+        # if virt_type is not existing in config file, return 'KVM' by default
+        return 'KVM'
+
 
     def has_virtual_ability(self):
         """
         Check if the host have the ability of virtualization.
         """
-        NotImplemented
+        # Return True for non-derived virt_base object.
+        return True
 
     def enable_virtual_ability(self):
         """
@@ -140,6 +149,9 @@ class VirtBase(object):
             if 'cpu' in param.keys():
                 self.__save_local_config('cpu', param['cpu'])
                 continue
+            if 'virt_type' in param.keys():
+                # param 'virt_type' is for virt_base only
+                continue
             # save local configurations
             for key in param.keys():
                 self.__save_local_config(key, param[key])
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-01-30  6:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09  6:00 [dts] [PATCH] framework: add virt_type option for virt type(kvm/libvirt) selection Herbert Guan
2018-01-09  6:54 ` Liu, Yong
2018-01-09  7:11   ` Herbert Guan
2018-01-25  9:17 ` [dts] [PATCH v2] " Herbert Guan
2018-01-29 16:37   ` Liu, Yong
2018-01-30  5:28 ` [dts] [PATCH v3] " Herbert Guan
2018-01-30 14:33   ` Liu, Yong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).