[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] 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.
---

Worth backporting to v0.10.2-maint and v0.9.11-maint (will cause conflict)?
The v0.9.6-maint doesn't have these flags yet.

 src/libvirt.c          |    4 ++--
 src/qemu/qemu_driver.c |    8 ++++----
 tools/virsh-domain.c   |    4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 23c36f9..ce17998 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -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;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d027880..b18e037 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
 
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 5ff8a82..6d5a0ec 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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;
-- 
1.7.8.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]