[libvirt] [PATCHv2 09/14] Exit early after domain crash in monitor on device hotplug

Ján Tomko jtomko at redhat.com
Tue Jan 13 12:38:37 UTC 2015


On 01/13/2015 12:54 AM, John Ferlan wrote:
> 
> 
> On 01/07/2015 10:42 AM, Ján Tomko wrote:
>> Error out if the domain has disappeared in the meantime.
>>
>> This prevents writing the persistent definition as the domain
>> status and calling qemuDomainRemoveDevice on devices
>> that already have been dealt with in qemuProcessStop.
>> ---
>>  src/qemu/qemu_domain.c  |  9 +++++----
>>  src/qemu/qemu_driver.c  |  4 ++--
>>  src/qemu/qemu_hotplug.c | 38 +++++++++++++++++++-------------------
>>  3 files changed, 26 insertions(+), 25 deletions(-)
>>

>> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
>> index a4e4d6b..6b108bf 100644
>> --- a/src/qemu/qemu_hotplug.c
>> +++ b/src/qemu/qemu_hotplug.c
>> @@ -193,7 +193,8 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
>>  
>>      qemuDomainObjEnterMonitor(driver, vm);
>>      ret = qemuMonitorEjectMedia(priv->mon, driveAlias, force);
>> -    qemuDomainObjExitMonitor(driver, vm);
>> +    if (qemuDomainObjExitMonitor(driver, vm) < 0)
>> +        goto cleanup;
> 
> if "ret == 0" we get to cleanup... with ejected media, no Audit and the
> rest of this not done...
>>  

I've added ret = -1 in front of that. Both audit and qemuDomainPrepareDisk on
the error path would need access to the disk that's now freed.

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150113/c2908d5b/attachment-0001.sig>


More information about the libvir-list mailing list