From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30062.outbound.protection.outlook.com [40.107.3.62]) by dpdk.org (Postfix) with ESMTP id 4F5573256 for ; Tue, 9 Jan 2018 08:11:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=9dpyB+veg3Y87gIS/kHNGizBA8p1j8Pxk7vx6tviHgw=; b=YvIocWjQbPLUb2oTI3pHH7u9MVgOFp41pa7dZryLFWW/4xnP7mCisklKA8lw6NFlC/FuoOqdGEekGvF+uSs9GvBKyv0pC2lQtyuUl5aGeFdc2KL3EPI5XM9t2/PNOJJ1TqpCDQT4lniyW5uX3KP6VKLPQ8WmpLWdiqACeUyZcws= Received: from HE1PR08MB2809.eurprd08.prod.outlook.com (10.170.246.148) by HE1PR08MB2810.eurprd08.prod.outlook.com (10.170.246.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Tue, 9 Jan 2018 07:11:16 +0000 Received: from HE1PR08MB2809.eurprd08.prod.outlook.com ([fe80::4b6:8770:8525:20c5]) by HE1PR08MB2809.eurprd08.prod.outlook.com ([fe80::4b6:8770:8525:20c5%13]) with mapi id 15.20.0386.008; Tue, 9 Jan 2018 07:11:16 +0000 From: Herbert Guan To: "Liu, Yong" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH] framework: add virt_type option for virt type(kvm/libvirt) selection Thread-Index: AQHTiRa9wFdJDozKEkq9Awdqu4StF6NrG3+Q Date: Tue, 9 Jan 2018 07:11:16 +0000 Message-ID: References: <1515477655-19201-1-git-send-email-herbert.guan@arm.com> <86228AFD5BCD8E4EBFD2B90117B5E81E62F42AB7@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <86228AFD5BCD8E4EBFD2B90117B5E81E62F42AB7@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR08MB2810; 7:SrGUM4QZo1RSDm/SWVXD1fJtkryFWPwHUQBjJz393aXjI6K2CoOrBNJtylMApYkilvNvh+OOSKJ7FZEZoLKvCoEM14nWaUKCzGUIzex6r9xdshBqIH5Pxv9L7YQzqUN9QzclLYnNExv5kE+CNzy3gGDFBg/ZqdCxEPRuXYk3RkXRheKS17Xg0kP9jsIpyr5qAAaqvqtHgq6cFlP+pNhxtbxmre8cZDFsr9o1CKCHFS1awkttqsCHKqKdQklrfNzs x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 02b368fd-c8d5-4224-c4fb-08d557302cd9 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:HE1PR08MB2810; x-ms-traffictypediagnostic: HE1PR08MB2810: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(944501110)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041268)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:HE1PR08MB2810; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR08MB2810; x-forefront-prvs: 0547116B72 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39380400002)(396003)(39860400002)(346002)(366004)(376002)(40434004)(189003)(199004)(13464003)(9686003)(6246003)(55236004)(2950100002)(106356001)(86362001)(59450400001)(575784001)(99286004)(53936002)(7696005)(105586002)(76176011)(25786009)(53546011)(6506007)(6346003)(305945005)(74316002)(55016002)(68736007)(2906002)(6436002)(478600001)(14454004)(102836004)(2900100001)(7736002)(229853002)(72206003)(316002)(5660300001)(3660700001)(97736004)(6116002)(8936002)(3846002)(81166006)(81156014)(5250100002)(33656002)(5890100001)(110136005)(66066001)(3280700002)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR08MB2810; H:HE1PR08MB2809.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Herbert.Guan@arm.com; x-microsoft-antispam-message-info: bV8piNmx1Ifq5k0WioRxGSkq34IlEUJjjcVwcVkV5SNytoVBquhrxXBAc/RIy8A+TcEh9JRbhLSVZXyiu9An6w== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02b368fd-c8d5-4224-c4fb-08d557302cd9 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jan 2018 07:11:16.4371 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB2810 Subject: Re: [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 07:11:18 -0000 Marvin, The "virt_type" is actually in the vm level configuration, means one VM wil= l be qemu and the other one can be libvirt. The example of test suite conf= igure file will be: [vm0] virt_type =3D virt_type=3DLIBVIRT; os =3D loader=3D/usr/share/AAVMF/AAVMF_CODE.fd,nvram=3D/var/lib/libvirt/qemu/n= vram/c2400-vm-04_VARS.fd; [vm1] virt_type =3D virt_type=3DKVM; Before we create a VM, we need to decide whether it'll be a libvirt or qemu= . So a virt_base object will be created and read VM type from config file. In test script, a patch like below will be applied: # set up VM0 ENV - self.vm0 =3D QEMUKvm(self.dut, 'vm0', 'vf_macfilter') - self.vm0.set_vm_device(driver=3Dself.vf_assign_method, **vf0_p= rop) - self.vm0.set_vm_device(driver=3Dself.vf_assign_method, **vf1_p= rop) + self.vm0_name =3D "vm0" + vm_base =3D VirtBase(self.dut, self.vm0_name, self.suite_name) + if vm_base.virt_type =3D=3D 'KVM': + # setup KVM VM0 + self.vm0 =3D QEMUKvm(self.dut, self.vm0_name, self.suite_n= ame) + self.vm0.set_vm_device(driver=3Dself.vf_assign_method, **v= f0_prop) + self.vm0.set_vm_device(driver=3Dself.vf_assign_method, **v= f1_prop) + elif vm_base.virt_type =3D=3D 'LIBVIRT': + # setup libvirt VM0 + self.vm0 =3D LibvirtKvm(self.dut, self.vm0_name, self.suit= e_name) + self.vm0.add_vm_device(**vf0_prop) + self.vm0.add_vm_device(**vf1_prop) + else: + raise Exception("Virt type %s is not supported!" + % vm_base.virt_type) Best reagrds, Herbert > -----Original Message----- > From: Liu, Yong [mailto:yong.liu@intel.com] > Sent: Tuesday, January 9, 2018 14:55 > To: Herbert Guan ; dts@dpdk.org > Subject: RE: [dts] [PATCH] framework: add virt_type option for virt > type(kvm/libvirt) selection > > Hi Herbert, > I think argument "virt_type" is not needed for suite level configuration. > There will be one possible scenario like libvirt and qemu VMs enabled in = one > suite. > Please see my inline comment. > > Thanks, > Marvin > > > -----Original Message----- > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Herbert Guan > > Sent: Tuesday, January 09, 2018 2:01 PM > > To: dts@dpdk.org > > Cc: Herbert Guan > > Subject: [dts] [PATCH] framework: add virt_type option for virt > > type(kvm/libvirt) selection > > > > 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 =3D VirtConf(CONFIG_ROOT_PATH + os.sep + self.suite + '.c= fg') > > + conf.load_virt_config(self.vm_name) > > + local_conf =3D 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' > > + > > Virt_type has been specified when instantiating virtual machine object, s= o > can initialize virt_type variable in init function of VM object. > Please refer to above patch example. Before we create a VM, we need to dec= ide whether it'll be a libvirt or qemu. So a virt_base object will be crea= ted and read VM type from config file. > > > > 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 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.