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:
Michal Privoznik 2012-11-28 17:31:14 +01:00
parent 39ad0001ca
commit 4ded3fb1c2
3 changed files with 8 additions and 8 deletions

View File

@ -3305,8 +3305,8 @@ virDomainReboot(virDomainPtr domain, unsigned int flags)
}
/* At most one of these two flags should be set. */
if ((flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) &&
(flags & VIR_DOMAIN_SHUTDOWN_GUEST_AGENT)) {
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;

View File

@ -1893,8 +1893,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
qemuDomainObjPrivatePtr priv;
bool useAgent = false;
virCheckFlags(VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN |
VIR_DOMAIN_SHUTDOWN_GUEST_AGENT , -1);
virCheckFlags(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN |
VIR_DOMAIN_REBOOT_GUEST_AGENT , -1);
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@ -1910,8 +1910,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
priv = vm->privateData;
if ((flags & VIR_DOMAIN_SHUTDOWN_GUEST_AGENT) ||
(!(flags & VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN) &&
if ((flags & VIR_DOMAIN_REBOOT_GUEST_AGENT) ||
(!(flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) &&
priv->agent))
useAgent = true;

View File

@ -4101,9 +4101,9 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd)
if (mode) {
if (STREQ(mode, "acpi")) {
flags |= VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN;
flags |= VIR_DOMAIN_REBOOT_ACPI_POWER_BTN;
} else if (STREQ(mode, "agent")) {
flags |= VIR_DOMAIN_SHUTDOWN_GUEST_AGENT;
flags |= VIR_DOMAIN_REBOOT_GUEST_AGENT;
} else {
vshError(ctl, _("Unknown mode %s value, expecting 'acpi' or 'agent'"), mode);
return false;