[Libvir] [Libvirt] Proposal to add 3 functions for VBDs (Virtual Block Devices)
Daniel Veillard
veillard at redhat.com
Thu Aug 24 15:51:29 UTC 2006
On Thu, Aug 24, 2006 at 05:32:19PM +0200, michel.ponceau at bull.net wrote:
> After the new VCPU functions, we also need Virtual Block Device management
> equivalent to Xen commands:
> 'xm block-list', 'xm block-attach', 'xm block-detach'.
> I propose to add in Libvirt the following 3 functions:
> /**
> * virDomainGetVbdevs:
> * @domain: pointer to domain object, or NULL for Domain0
> * @info: pointer to an array of virVbdevInfo structures
> * @maxinfo: number of structures in info array
> *
> * Extract information about virtual block devices of domain, store it in
> info.
> *
> * Returns the number of info filled in case of success, -1 in case of
> failure.
> */
> int virDomainGetVbdevs(virDomainPtr domain, virVbdevInfoPtr info, int
> maxinfo)
>
> /**
> * virDomainCreateVbdev:
> * @domain: pointer to domain object, or NULL for Domain0
> * @number: virtual device number
> * @mode: read-only (VIR_VBDMD_RO), or read/write (VIR_VBDMD_RW)
> * @bkendID: ID of domain hosting the backend device (usually 0 for
> domain0)
> * @bkend: pointer to backend device path
> *
> * Create a virtual block device.
> *
> * Returns 0 in case of success, -1 in case of failure.
> */
> int virDomainCreateVbdev(virDomainPtr domain, unsigned int number, int
> mode,
> int bkendID, char *bkend)
>
> /**
> * virDomainDestroyVbdev:
> * @domain: pointer to domain object, or NULL for Domain0
> * @number: virtual device number
> *
> * Destroy a virtual block device.
> *
> * Returns 0 in case of success, -1 in case of failure.
> */
> int virDomainDestroyVbdev(virDomainPtr domain, unsigned int number)
Humm, my concern here is how general is that API ? bkendID is certainly
a Xen'ism, with no equivalent in other virtualization frameworks. If we
add dynamic block devices creation and destruction, it must be clear what
those operation means outside of a pure Xen context. In general devices
are not named by one number, bkendID is a xen concept, I don't see why
it should appear as is in the API.
> Structure in libvirt.h:
> /**
> * virVbdevInfo: information structure for a Virtual Block Device in a
> domain
> */
> typedef struct _virVbdevInfo virVbdevInfo;
> struct _virVbdevInfo {
> unsigned int number; /* virtual device number */
> int state;
> int evtChn;
> int ringRef;
> int bkendID; /* ID of domain hosting the backend device
> */
> char bkend[128];
> };
> typedef virVbdevInfo *virVbdevInfoPtr;
Way way too Xen specific, too undefined in general, as is this really
cannot show up in libvirt API. I would prefer discussing the concept of
the operation first instead of starting from a Xen standpoint and trying to
make it an API.
What are conceptually the operations you want to do ? How would you name
the objects exposed in those oeprations ?
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
More information about the libvir-list
mailing list