From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 55B1B16E for ; Tue, 9 Jan 2018 07:01:01 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 47EF11529; Mon, 8 Jan 2018 22:01:01 -0800 (PST) Received: from lenovo-a010984.shanghai.arm.com (lenovo-a010984.shanghai.arm.com [10.169.40.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C1AC43F41F; Mon, 8 Jan 2018 22:01:00 -0800 (PST) From: Herbert Guan To: dts@dpdk.org Cc: Herbert Guan Date: Tue, 9 Jan 2018 14:00:55 +0800 Message-Id: <1515477655-19201-1-git-send-email-herbert.guan@arm.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dts] [PATCH] framework: add virt_type option for virt type(kvm/libvirt) selection X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 06:01:02 -0000 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 --- 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