mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +00:00
qemu: Don't deny ShutdownVMDaemon for non-running VMs
Clients that require this already seem to do so. Calling this function with pid < 1 also should not cause problems.
This commit is contained in:
parent
4da188ea3d
commit
348c6fc0ab
@ -3604,10 +3604,8 @@ static void qemudShutdownVMDaemon(struct qemud_driver *driver,
|
|||||||
virDomainDefPtr def;
|
virDomainDefPtr def;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!virDomainObjIsActive(vm))
|
VIR_DEBUG("Shutting down VM '%s' pid=%d migrated=%d",
|
||||||
return;
|
vm->def->name, vm->pid, migrated);
|
||||||
|
|
||||||
VIR_DEBUG("Shutting down VM '%s' migrated=%d", vm->def->name, migrated);
|
|
||||||
|
|
||||||
/* This method is routinely used in clean up paths. Disable error
|
/* This method is routinely used in clean up paths. Disable error
|
||||||
* reporting so we don't squash a legit error. */
|
* reporting so we don't squash a legit error. */
|
||||||
@ -3630,6 +3628,7 @@ static void qemudShutdownVMDaemon(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This will safely handle a non-running guest with pid=0 or pid=-1*/
|
||||||
if (virKillProcess(vm->pid, 0) == 0 &&
|
if (virKillProcess(vm->pid, 0) == 0 &&
|
||||||
virKillProcess(vm->pid, SIGTERM) < 0)
|
virKillProcess(vm->pid, SIGTERM) < 0)
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
|
Loading…
Reference in New Issue
Block a user