Re: [Libvir] Proposal for virtual devices described in XML

When specified at device creation, vifname is put in XenStore directory /local/domain/0/backend/vif/<domID>/<vif_number>. All vifnames used in a domain are returned by Get "/xend/domain/<domID>?detail=1" and converted into XML "target" by virDomainGetXMLDesc. For convenience, we could force the vifname, either at domain creation or in Attach, and ignore any "target" in "interface", except for Detach. The vifname value could be the sequence number of network device creation in domain (for Xen, it would be equal to vif number). Veuillez répondre à "Daniel P. Berrange" <berrange@redhat.com> Pour : michel.ponceau@bull.net cc : libvir-list@redhat.com Objet : Re: [Libvir] Proposal for virtual devices described in XML On Wed, Sep 27, 2006 at 05:21:33PM +0200, michel.ponceau@bull.net wrote:
After comments from Daniel P. Berrange and from Bull people, my proposal
is reduced to following 2 functions:
/* Create a virtual device attachment to backend */ int virDomainAttachDevice(virDomainPtr domain, char *xml);
This is definitely a good way forward - it lets us re-use the existing code for parsing device descriptions very easily.
/* Destroy a virtual device attachment to backend */ int virDomainDetachDevice(virDomainPtr domain, char *xml); /* @domain: pointer to domain object * @xml: pointer to XML description of one device * Returns 0 in case of success, -1 in case of failure. */
I was wondering whether we need to have the full XML block passed in for detaching devices. Perhaps it is sufficient to just pass i nthe target name of the device. Then again, some implementations may prefer to have the full XML blob available to allow greater sanity checking when detaching, so its probably worth while.
The XML would be in same form as the part of domain description for a single device, either <disk.../disk> or <interface.../interface>.
The device is identified by its target name. This attribute is optional for "interface" in domain description, but would become mandatory in Attach/Detach description. It is not yet processed in Libvirt-0.1.6
Very nice. source
xml.c (function virDomainParseXMLIfDesc). I have successfully tried the attached patch, which tranlates "target" into Xen "vifname". (It processes "ip" attribute in same way, but my try
failed, maybe because address value was invalid for Xen).
I'm not sure I like the idea of having to explicitly set a vif name for every guest NIC we define - principally because there's no straightforward way for a user of this API to determine what VIF names are already in use, vs free. It also seems XenD does not tell us what the vifname for running domains are - although I think the info is in xenstore somewhere. I can see why we need the vifname to detach the device though. If we can find a way to fill in the vifname when dumping the XML, then this would let a caller uniquely identify an existing device, without us requireing that vifnames are used when creating a domain/attaching a new device (& thus let Xen still auto-allocate them) Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

On Thu, Sep 28, 2006 at 05:23:11PM +0200, michel.ponceau@bull.net wrote:
When specified at device creation, vifname is put in XenStore directory /local/domain/0/backend/vif/<domID>/<vif_number>. All vifnames used in a domain are returned by Get "/xend/domain/<domID>?detail=1" and converted into XML "target" by virDomainGetXMLDesc.
It seems XenD only writes the 'vifname' into xenstore if you explicitly requested one. If you let XenD auto-allocate a vifname, it doesn't write the name of the auto-allocated one into xenstore. Which really sucks :-(
For convenience, we could force the vifname, either at domain creation or in Attach, and ignore any "target" in "interface", except for Detach. The vifname value could be the sequence number of network device creation in domain (for Xen, it would be equal to vif number).
Except that it is not convenient for the person using the API, because they have no easy well to determine what 'vifname' is used / free on the host system. If we need a unique identifier to hook onto for purposes of detaching devices then MAC address is only one we currently have available. I'm afraid forcing use of vifname is just not going to work. Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
participants (2)
-
Daniel P. Berrange
-
michel.ponceau@bull.net