From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPvpp-0004Ab-Rb for qemu-devel@nongnu.org; Wed, 10 Apr 2013 10:17:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPvpk-000783-Sw for qemu-devel@nongnu.org; Wed, 10 Apr 2013 10:17:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPvpk-00077u-Ji for qemu-devel@nongnu.org; Wed, 10 Apr 2013 10:17:08 -0400 Date: Wed, 10 Apr 2013 22:17:04 +0800 From: Amos Kong Message-ID: <20130410141704.GA4321@t430s.nay.redhat.com> References: <20130410120519.GA13514@t430s.nay.redhat.com> <51655AF8.40102@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <51655AF8.40102@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Nic devices' name are wrongly repeated List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Anthony Liguori , Paolo Bonzini , qemu-devel , Stefan Hajnoczi , Gerd Hoffmann On Wed, Apr 10, 2013 at 02:28:40PM +0200, Andreas F=E4rber wrote: > Hi, >=20 > Am 10.04.2013 14:05, schrieb Amos Kong: > > If we don't assign 'id' for nic device, device name will be $model.$i= dx. The $idx are always 0 if we set nic by new style. > >=20 > > # qemu-upstream -device virtio-net-pci,netdev=3Dh1 -netdev tap,id=3Dh= 1 -device virtio-net-pci,netdev=3Dh2 -netdev tap,id=3Dh2 ... > > (qemu) info network > > virtio-net-pci.0: index=3D0,type=3Dnic,model=3Dvirtio-net-pci,macaddr= =3D52:54:00:12:34:56 > > \ h1: index=3D0,type=3Dtap,ifname=3Dtap0,script=3D/etc/qemu-ifup,dow= nscript=3D/etc/qemu-ifdown > > virtio-net-pci.0: index=3D0,type=3Dnic,model=3Dvirtio-net-pci,macaddr= =3D52:54:00:12:34:57 > > \ h2: index=3D0,type=3Dtap,ifname=3Dtap1,script=3D/etc/qemu-ifup,dow= nscript=3D/etc/qemu-ifdown > >=20 > > it's introduced by commit d33d93b2 >=20 > I can see that's inconvenient, but... >=20 > > If we set links down by 'set_link virtio-net-pci.0', the first nic > > will be set down. But how to set the second link down by id? >=20 > As you would do for all devices? I.e., add ,id=3Dyouruniqueid to -devic= e. If we also assigned unique ids for nic devices, it works. =20 > Having said that, in a different context (USB) I was made aware that we > don't know the bus name at QOM initialization time yet and, if we want > to create a bus at that point, will need to rename it later. Thus we'd > need an overridable ID setter hook to propagate to busses, and if we ha= d > such a settable ID property it would be convenient for your use case to > have a matching monitor command as well to be able to resolve name > conflicts at runtime rather than with a QEMU restart. It's better to allocate an increased & uniqued index suffix automatically as past. monitor command is good for human, but it's difficult for management tools to identify & resolve the conflicts. =20 > Andreas >=20 > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrn= berg --=20 Amos.