[libvirt] [PATCH 7/8] Asynchronous event for BlockPull completion
Adam Litke
agl at us.ibm.com
Tue Jun 14 14:05:40 UTC 2011
On 06/14/2011 05:03 AM, Daniel P. Berrange wrote:
>> +static virDomainEventPtr
>> +virDomainEventBlockPullNew(int id, const char *name, unsigned char *uuid,
>> + const char *path, int status)
>> +{
>> + virDomainEventPtr ev =
>> + virDomainEventNewInternal(VIR_DOMAIN_EVENT_ID_BLOCK_PULL,
>> + id, name, uuid);
>> +
>> + if (ev) {
>> + if (!(ev->data.blockPull.path = strdup(path))) {
>> + virDomainEventFree(ev);
>> + return NULL;
>
> You want a virReportOOMError() call there.
Yes, of course.
>> +static int
>> +qemuProcessHandleBlockPull(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
>> + virDomainObjPtr vm,
>> + const char *diskAlias,
>> + int status)
>> +{
>> + struct qemud_driver *driver = qemu_driver;
>> + virDomainEventPtr blockPullEvent = NULL;
>> + const char *path;
>> + virDomainDiskDefPtr disk;
>> +
>> + virDomainObjLock(vm);
>> + disk = qemuProcessFindDomainDiskByAlias(vm, diskAlias);
>> +
>> + if (disk)
>> + path = disk->src;
>> + else
>> + path = "";
>
> If we can't find the disk associated with the alias, then
> I think we should just discard the event rather than emitting
> one with a zero-length path.
Yes, this makes sense. Dome for the next series.
--
Adam Litke
IBM Linux Technology Center
More information about the libvir-list
mailing list