I think that, instead of designate the backend domain by its id, it
would be better to designate it by its name.
This is because the id isn't fix, excepted for the domain-0.
Philippe Berthault.
michel.ponceau(a)bull.net a écrit :
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)
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;
/* Virtual Block Device access modes: read-only or read/write */
#define VIR_VBDMD_RO 0
#define VIR_VBDMD_RW 1
------------------------------------------------------------------------
--
Libvir-list mailing list
Libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list