[libvirt] [PATCH 04/11] Fix vm usage after ExitMonitor on device removal

Michal Privoznik mprivozn at redhat.com
Wed Dec 17 12:18:47 UTC 2014


On 16.12.2014 17:41, Ján Tomko wrote:
> In the device type-specific functions, exit early
> if the domain has disappeared, because the cleanup
> should have been done by qemuProcessStop.
>
> In processDeviceDeletedEvent, only save status XML if the domain
> is still running and exit early in qemuProcessUpdateDevices
> if the domain disappeared.
> ---
>   src/qemu/qemu_driver.c  |  3 ++-
>   src/qemu/qemu_hotplug.c | 18 ++++++++++++------
>   src/qemu/qemu_process.c |  2 ++
>   3 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 99eb7c3..07b061e 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -4112,7 +4112,8 @@ processDeviceDeletedEvent(virQEMUDriverPtr driver,
>
>       qemuDomainRemoveDevice(driver, vm, &dev);
>
> -    if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
> +    if (virDomainObjIsActive(vm) &&
> +        virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)

Can we rather make qemuDomainRemoveDevice() return -1 on error and check 
for that in callers? That way we will fix even case when the function is 
called with unsupported device. ACK to the rest of the patch, though.

Michal




More information about the libvir-list mailing list