mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
maint: Fix use of invalid reboot flags
Throughout the code, we've always used VIR_DOMAIN_SHUTDOWN* flags even for virDomainReboot() API and its implementation. Fortunately, the appropriate macros has the same value. But if we want to keep things consistent, we should be using the correct macros. This patch doesn't break anything, luckily.
This commit is contained in:
parent
39ad0001ca
commit
4ded3fb1c2
@ -3305,8 +3305,8 @@ virDomainReboot(virDomainPtr domain, unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* At most one of these two flags should be set. */
|
/* At most one of these two flags should be set. */
|
||||||
if ((flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) &&
|
if ((flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) &&
|
||||||
(flags & VIR_DOMAIN_SHUTDOWN_GUEST_AGENT)) {
|
(flags & VIR_DOMAIN_REBOOT_GUEST_AGENT)) {
|
||||||
virReportInvalidArg(flags, "%s",
|
virReportInvalidArg(flags, "%s",
|
||||||
_("flags for acpi power button and guest agent are mutually exclusive"));
|
_("flags for acpi power button and guest agent are mutually exclusive"));
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1893,8 +1893,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
|
|||||||
qemuDomainObjPrivatePtr priv;
|
qemuDomainObjPrivatePtr priv;
|
||||||
bool useAgent = false;
|
bool useAgent = false;
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN |
|
virCheckFlags(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN |
|
||||||
VIR_DOMAIN_SHUTDOWN_GUEST_AGENT , -1);
|
VIR_DOMAIN_REBOOT_GUEST_AGENT , -1);
|
||||||
|
|
||||||
qemuDriverLock(driver);
|
qemuDriverLock(driver);
|
||||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
@ -1910,8 +1910,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
|
|||||||
|
|
||||||
priv = vm->privateData;
|
priv = vm->privateData;
|
||||||
|
|
||||||
if ((flags & VIR_DOMAIN_SHUTDOWN_GUEST_AGENT) ||
|
if ((flags & VIR_DOMAIN_REBOOT_GUEST_AGENT) ||
|
||||||
(!(flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) &&
|
(!(flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) &&
|
||||||
priv->agent))
|
priv->agent))
|
||||||
useAgent = true;
|
useAgent = true;
|
||||||
|
|
||||||
|
@ -4101,9 +4101,9 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
if (mode) {
|
if (mode) {
|
||||||
if (STREQ(mode, "acpi")) {
|
if (STREQ(mode, "acpi")) {
|
||||||
flags |= VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN;
|
flags |= VIR_DOMAIN_REBOOT_ACPI_POWER_BTN;
|
||||||
} else if (STREQ(mode, "agent")) {
|
} else if (STREQ(mode, "agent")) {
|
||||||
flags |= VIR_DOMAIN_SHUTDOWN_GUEST_AGENT;
|
flags |= VIR_DOMAIN_REBOOT_GUEST_AGENT;
|
||||||
} else {
|
} else {
|
||||||
vshError(ctl, _("Unknown mode %s value, expecting 'acpi' or 'agent'"), mode);
|
vshError(ctl, _("Unknown mode %s value, expecting 'acpi' or 'agent'"), mode);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user