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 C4562A00E6 for ; Tue, 6 Aug 2019 11:06:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BCB5F1B998; Tue, 6 Aug 2019 11:06:21 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id BBB364C80 for ; Tue, 6 Aug 2019 11:06:19 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2019 02:06:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,353,1559545200"; d="scan'208";a="325580528" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 06 Aug 2019 02:06:15 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 6 Aug 2019 02:06:15 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 6 Aug 2019 02:06:15 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.80]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.163]) with mapi id 14.03.0439.000; Tue, 6 Aug 2019 17:06:13 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] framework/qemu_kvm: use -device instead of -net nic param when start qemu Thread-Index: AQHVRqJH5b7zuw07ckaBkKKTgQXHpabt3xXQ Date: Tue, 6 Aug 2019 09:06:12 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BAFD33A@SHSMSX101.ccr.corp.intel.com> References: <1564442457-15344-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1564442457-15344-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.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjg0NGYwYzUtNWZkOS00NGQwLTkxOWQtNjliM2RlMjU1MTI3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicnp1K201b013R0NVc1hObFVjZVdIZjZMeVpzXC90N0xNYkhHNytZYzNYOGtiZmdcL3ZsdE9iSlFTSjhUSkhJelB2In0= 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/qemu_kvm: use -device instead of -net nic param when start qemu 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, July 30, 2019 7:21 AM > To: dts@dpdk.org > Cc: Ma, LihongX > Subject: [dts] [PATCH V1] framework/qemu_kvm: use -device instead of -net > nic param when start qemu >=20 > After qemu3.0, 'vlan' is deprecated, use 'netdev' instead. > use '-device devtype,netdev=3Dstr' instead of -net nic use '-netdev optio= n' > instead of -net user/tap >=20 > Signed-off-by: lihong > --- > framework/qemu_kvm.py | 75 ++++++++++++++++++---------------------------= ------ > 1 file changed, 26 insertions(+), 49 deletions(-) >=20 > diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index > c7d4041..c425f41 100644 > --- a/framework/qemu_kvm.py > +++ b/framework/qemu_kvm.py > @@ -146,11 +146,12 @@ class QEMUKvm(VirtBase): > self.set_vm_daemon() > self.set_vm_monitor() >=20 > + self.nic_num =3D 1 > if not self.__default_nic: > # add default control interface > - def_nic =3D {'type': 'nic', 'opt_vlan': '0', 'opt_addr': '1f= '} > + def_nic =3D {'type': 'nic'} > self.set_vm_net(**def_nic) > - def_net =3D {'type': 'user', 'opt_vlan': '0'} > + def_net =3D {'type': 'user'} > self.set_vm_net(**def_net) > self.__default_nic =3D True >=20 > @@ -469,8 +470,6 @@ class QEMUKvm(VirtBase): > note:the sub-option will be decided according to the net typ= e. > """ > if 'type' in options.keys(): > - if 'opt_vlan' not in options.keys(): > - options['opt_vlan'] =3D '0' > if options['type'] =3D=3D 'nic': > self.__add_vm_net_nic(**options) > if options['type'] =3D=3D 'user': > @@ -511,32 +510,11 @@ class QEMUKvm(VirtBase): > def __add_vm_net_nic(self, **options): > """ > type: nic > - opt_vlan: 0 > - note: Default is 0. > - opt_macaddr: 00:00:00:00:01:01 > - note: if creating a nic, it`s better to specify a MAC, > - else it will get a random number. > opt_model:["e1000" | "virtio" | "i82551" | ...] > note: Default is e1000. > - opt_name: 'nic1' > - opt_addr: '' > - note: PCI cards only. > - opt_vectors: > - note: This option currently only affects virtio cards. > """ > - net_boot_line =3D '-net nic' > + net_boot_line =3D '-device ' > separator =3D ',' > - if 'opt_vlan' in options.keys() and \ > - options['opt_vlan']: > - net_boot_line +=3D separator + 'vlan=3D%s' % options['opt_vl= an'] > - > - # add MAC info > - if 'opt_macaddr' in options.keys() and \ > - options['opt_macaddr']: > - mac =3D options['opt_macaddr'] > - else: > - mac =3D self.generate_unique_mac() > - net_boot_line +=3D separator + 'macaddr=3D%s' % mac >=20 > if 'opt_model' in options.keys() and \ > options['opt_model']: > @@ -544,17 +522,14 @@ class QEMUKvm(VirtBase): > else: > model =3D 'e1000' > self.nic_model =3D model > - net_boot_line +=3D separator + 'model=3D%s' % model > + net_boot_line +=3D model >=20 > - if 'opt_name' in options.keys() and \ > - options['opt_name']: > - net_boot_line +=3D separator + 'name=3D%s' % options['opt_na= me'] > - if 'opt_addr' in options.keys() and \ > - options['opt_addr']: > - net_boot_line +=3D separator + 'addr=3D%s' % options['opt_ad= dr'] > - if 'opt_vectors' in options.keys() and \ > - options['opt_vectors']: > - net_boot_line +=3D separator + 'vectors=3D%s' % options['opt= _vectors'] > + netdev_id =3D self.nic_num > + if self.nic_num % 2 =3D=3D 0: > + netdev_id =3D self.nic_num - 1 > + netdev =3D "netdev=3Dnttsip%d " % netdev_id > + self.nic_num =3D self.nic_num + 1 > + net_boot_line +=3D separator + netdev >=20 > if self.__string_has_multi_fields(net_boot_line, separator): > self.__add_boot_line(net_boot_line) > @@ -562,15 +537,16 @@ class QEMUKvm(VirtBase): > def __add_vm_net_user(self, **options): > """ > type: user > - opt_vlan: 0 > - note: default is 0. > opt_hostfwd: [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport > """ > - net_boot_line =3D '-net user' > + net_boot_line =3D '-netdev user' > separator =3D ',' > - if 'opt_vlan' in options.keys() and \ > - options['opt_vlan']: > - net_boot_line +=3D separator + 'vlan=3D%s' % options['opt_vl= an'] > + netdev_id =3D self.nic_num > + if self.nic_num % 2 =3D=3D 0: > + netdev_id =3D self.nic_num - 1 > + self.nic_num =3D self.nic_num + 1 > + netdev =3D "id=3Dnttsip%d" % netdev_id > + net_boot_line +=3D separator + netdev > if 'opt_hostfwd' in options.keys() and \ > options['opt_hostfwd']: > self.__check_net_user_opt_hostfwd(options['opt_hostfwd']) > @@ -651,8 +627,6 @@ class QEMUKvm(VirtBase): > def __add_vm_net_tap(self, **options): > """ > type: tap > - opt_vlan: 0 > - note: default is 0. > opt_br: br0 > note: if choosing tap, need to specify bridge name, > else it will be br0. > @@ -661,9 +635,16 @@ class QEMUKvm(VirtBase): > opt_downscript: QEMU_IFDOWN_PATH > note: if not specified, default is self.QEMU_IFDOWN_PATH. > """ > - net_boot_line =3D '-net tap' > + net_boot_line =3D '-netdev tap' > separator =3D ',' >=20 > + netdev_id =3D self.nic_num > + if self.nic_num % 2 =3D=3D 0: > + netdev_id =3D self.nic_num - 1 > + self.nic_num =3D self.nic_num + 1 > + netdev =3D "id=3Dnttsip%d" % netdev_id > + net_boot_line +=3D separator + netdev > + > # add bridge info > if 'opt_br' in options.keys() and \ > options['opt_br']: > @@ -672,10 +653,6 @@ class QEMUKvm(VirtBase): > bridge =3D self.DEFAULT_BRIDGE > self.__generate_net_config_script(str(bridge)) >=20 > - if 'opt_vlan' in options.keys() and \ > - options['opt_vlan']: > - net_boot_line +=3D separator + 'vlan=3D%s' % options['opt_vl= an'] > - > # add network configure script path > if 'opt_script' in options.keys() and \ > options['opt_script']: > -- > 2.7.4