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 D493DA0613 for ; Tue, 30 Jul 2019 14:17:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8C7361C10A; Tue, 30 Jul 2019 14:17:11 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 96F901C0D3 for ; Tue, 30 Jul 2019 14:17:09 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jul 2019 05:17:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,326,1559545200"; d="scan'208";a="183110932" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 30 Jul 2019 05:17:08 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 30 Jul 2019 05:17:08 -0700 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 30 Jul 2019 05:17:07 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.204]) with mapi id 14.03.0439.000; Tue, 30 Jul 2019 20:17:05 +0800 From: "Wang, Yinan" 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: AQHVRqJH/AthJXK85kSKB9iblQjv/abjFAGg Date: Tue, 30 Jul 2019 12:17:04 +0000 Message-ID: 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: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGVjYTIyOWUtZTRhZi00ZjkyLTkzZTktMTFhYzlmYzMwNzk0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoieU00QytlMThkQ3MyUVoyeXBlTEF1cllSUncrNlwvSyszZVZZUTUrNG80M0pDSWw2NGVRTXpXWWlqZEM5QURqZ3cifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" 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" Acked-by: Wang, Yinan > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong > Sent: 2019=1B$BG/=1B(B7=1B$B7n=1B(B30=1B$BF|=1B(B 7:21 > 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