From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B22C5A04A3; Mon, 4 Nov 2019 03:41:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8C969397D; Mon, 4 Nov 2019 03:41:22 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 7EAE3378E for ; Mon, 4 Nov 2019 03:41:20 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Nov 2019 18:41:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,265,1569308400"; d="scan'208";a="352691260" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 03 Nov 2019 18:41:19 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 3 Nov 2019 18:41:19 -0800 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 3 Nov 2019 18:41:18 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.213]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.215]) with mapi id 14.03.0439.000; Mon, 4 Nov 2019 10:41:18 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Chen, Zhaoyan" , "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] framework/virt_base: reduce dpdk complie times in vm at same suite Thread-Index: AQHViIHpT1N+FoibiUWZRgp97PGXTad6YZrw Date: Mon, 4 Nov 2019 02:41:17 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB5D273@SHSMSX101.ccr.corp.intel.com> References: <1571685233-1934-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1571685233-1934-1-git-send-email-lihongx.ma@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGViM2U3ZDAtYThhZC00Y2NmLWEzNmMtMGYxZTg2NzkxZWRiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVFZKNlNIRXNVU1dJa0VJa21rM1wvXC9cL1dnc3RSQWF0TEJVQmVSd2trVmZ3M0JhWVpYSWJhaUFZMW4zOHBHZG1IeiJ9 x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1] framework/virt_base: reduce dpdk complie times in vm at same suite 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong > Sent: Tuesday, October 22, 2019 3:14 AM > To: dts@dpdk.org > Cc: Chen, Zhaoyan ; Ma, LihongX > > Subject: [dts] [PATCH V1] framework/virt_base: reduce dpdk complie times > in vm at same suite >=20 > Add global variable to record all the vm image name in each dut and suite= , in > same suite, same vm only compile one times. >=20 > Signed-off-by: lihong > --- > framework/virt_base.py | 29 +++++++++++++++++++++++++++-- > 1 file changed, 27 insertions(+), 2 deletions(-) >=20 > diff --git a/framework/virt_base.py b/framework/virt_base.py index > 6e3462c..31623be 100644 > --- a/framework/virt_base.py > +++ b/framework/virt_base.py > @@ -31,6 +31,7 @@ > import os > import sys > import traceback > +import threading > from random import randint > from itertools import imap >=20 > @@ -47,6 +48,8 @@ ST_NOTSTART =3D "NOTSTART" > ST_PAUSE =3D "PAUSE" > ST_RUNNING =3D "RUNNING" > ST_UNKNOWN =3D "UNKNOWN" > +VM_IMG_LIST =3D [] > +mutex_vm_list =3D threading.Lock() >=20 > class VirtBase(object): > """ > @@ -388,6 +391,20 @@ class VirtBase(object): > """ > NotImplemented >=20 > + def get_vm_img(self): > + """ > + get current vm img name from params > + get format like: > 10.67.110.11:TestVhostMultiQueueQemu:/home/img/Ub1604.img > + """ > + param_len =3D len(self.params) > + for i in range(param_len): > + if 'disk' in self.params[i].keys(): > + value =3D self.params[i]['disk'][0] > + if 'file' in value.keys(): > + host_ip =3D self.host_dut.get_ip_address() > + return host_ip + ':' + self.host_dut.test_classname = + ':' + > value['file'] > + return None > + > def instantiate_vm_dut(self, set_target=3DTrue, cpu_topo=3D'', bind_= dev=3DTrue, > autodetect_topo=3DTrue): > """ > Instantiate the Dut class for VM. > @@ -427,9 +444,11 @@ class VirtBase(object): >=20 > read_cache =3D False > skip_setup =3D self.host_dut.skip_setup > + vm_img =3D self.get_vm_img() > # if current vm is migration vm, skip compile dpdk > - if self.migration_vm: > - skip_setup =3D True > + # if VM_IMG_list include the vm_img, it means the vm have compli= e the > dpdk ok, skip it > + if self.migration_vm or vm_img in VM_IMG_LIST: > + skip_setup =3D True > base_dir =3D self.host_dut.base_dir > vm_dut.set_speedup_options(read_cache, skip_setup) >=20 > @@ -449,6 +468,12 @@ class VirtBase(object): > raise exception.VirtDutInitException(vm_dut) > return None >=20 > + # after prerequisites and set_target, the dpdk compile is ok, ad= d this vm > img to list > + if vm_img not in VM_IMG_LIST: > + mutex_vm_list.acquire() > + VM_IMG_LIST.append(vm_img) > + mutex_vm_list.release() > + > self.vm_dut =3D vm_dut > return vm_dut >=20 > -- > 2.7.4