mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
Move reboot/shutdown flags combination check into QEMU driver
The fact that only the guest agent, or ACPI flag can be used when requesting reboot/shutdown is merely a limitation of the QEMU driver impl at this time. Thus it should not be in libvirt.c code Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
c4ef575c97
commit
dff4a753c4
@ -3237,7 +3237,9 @@ error:
|
||||
*
|
||||
* If @flags is set to zero, then the hypervisor will choose the
|
||||
* method of shutdown it considers best. To have greater control
|
||||
* pass exactly one of the virDomainShutdownFlagValues.
|
||||
* pass one or more of the virDomainShutdownFlagValues. The order
|
||||
* in which the hypervisor tries each shutdown method is undefined,
|
||||
* and a hypervisor is not required to support all methods.
|
||||
*
|
||||
* Returns 0 in case of success and -1 in case of failure.
|
||||
*/
|
||||
@ -3260,14 +3262,6 @@ virDomainShutdownFlags(virDomainPtr domain, unsigned int flags)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* At most one of these two flags should be set. */
|
||||
if ((flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) &&
|
||||
(flags & VIR_DOMAIN_SHUTDOWN_GUEST_AGENT)) {
|
||||
virReportInvalidArg(flags, "%s",
|
||||
_("flags for acpi power button and guest agent are mutually exclusive"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
conn = domain->conn;
|
||||
|
||||
if (conn->driver->domainShutdownFlags) {
|
||||
@ -3296,7 +3290,9 @@ error:
|
||||
*
|
||||
* If @flags is set to zero, then the hypervisor will choose the
|
||||
* method of shutdown it considers best. To have greater control
|
||||
* pass exactly one of the virDomainRebootFlagValues.
|
||||
* pass one or more of the virDomainShutdownFlagValues. The order
|
||||
* in which the hypervisor tries each shutdown method is undefined,
|
||||
* and a hypervisor is not required to support all methods.
|
||||
*
|
||||
* To use guest agent (VIR_DOMAIN_REBOOT_GUEST_AGENT) the domain XML
|
||||
* must have <channel> configured.
|
||||
@ -3322,14 +3318,6 @@ virDomainReboot(virDomainPtr domain, unsigned int flags)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* At most one of these two flags should be set. */
|
||||
if ((flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) &&
|
||||
(flags & VIR_DOMAIN_REBOOT_GUEST_AGENT)) {
|
||||
virReportInvalidArg(flags, "%s",
|
||||
_("flags for acpi power button and guest agent are mutually exclusive"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
conn = domain->conn;
|
||||
|
||||
if (conn->driver->domainReboot) {
|
||||
|
@ -1814,6 +1814,14 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) {
|
||||
virCheckFlags(VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN |
|
||||
VIR_DOMAIN_SHUTDOWN_GUEST_AGENT, -1);
|
||||
|
||||
/* At most one of these two flags should be set. */
|
||||
if ((flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) &&
|
||||
(flags & VIR_DOMAIN_SHUTDOWN_GUEST_AGENT)) {
|
||||
virReportInvalidArg(flags, "%s",
|
||||
_("flags for acpi power button and guest agent are mutually exclusive"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
qemuDriverLock(driver);
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
qemuDriverUnlock(driver);
|
||||
@ -1896,6 +1904,14 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
|
||||
virCheckFlags(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN |
|
||||
VIR_DOMAIN_REBOOT_GUEST_AGENT , -1);
|
||||
|
||||
/* At most one of these two flags should be set. */
|
||||
if ((flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) &&
|
||||
(flags & VIR_DOMAIN_REBOOT_GUEST_AGENT)) {
|
||||
virReportInvalidArg(flags, "%s",
|
||||
_("flags for acpi power button and guest agent are mutually exclusive"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
qemuDriverLock(driver);
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
qemuDriverUnlock(driver);
|
||||
|
Loading…
Reference in New Issue
Block a user