[libvirt] [PATCH 01/14] conf: rename lifecycle enum values to correspond with typedef keyword

Pavel Hrdina phrdina at redhat.com
Mon Oct 16 11:06:14 UTC 2017


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/conf/domain_conf.c        |  6 +++---
 src/conf/domain_conf.h        | 10 +++++-----
 src/libxl/libxl_conf.c        | 12 ++++++------
 src/libxl/libxl_domain.c      | 20 ++++++++++----------
 src/lxc/lxc_native.c          |  4 ++--
 src/qemu/qemu_command.c       |  4 ++--
 src/qemu/qemu_driver.c        |  8 ++++----
 src/qemu/qemu_parse_command.c |  6 +++---
 src/qemu/qemu_process.c       |  4 ++--
 src/test/test_driver.c        |  8 ++++----
 src/vmx/vmx.c                 |  4 ++--
 src/vz/vz_sdk.c               |  8 ++++----
 src/xenapi/xenapi_utils.c     | 10 +++++-----
 src/xenconfig/xen_sxpr.c      |  4 ++--
 14 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0f306b7e15..fe2c3a29b6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -208,7 +208,7 @@ VIR_ENUM_IMPL(virDomainCapsFeature, VIR_DOMAIN_CAPS_FEATURE_LAST,
               "syslog",
               "wake_alarm")
 
-VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_LAST,
+VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_ACTION_LAST,
               "destroy",
               "restart",
               "rename-restart",
@@ -18583,14 +18583,14 @@ virDomainDefParseXML(xmlDocPtr xml,
     if (virDomainEventActionParseXML(ctxt, "on_reboot",
                                      "string(./on_reboot[1])",
                                      &def->onReboot,
-                                     VIR_DOMAIN_LIFECYCLE_RESTART,
+                                     VIR_DOMAIN_LIFECYCLE_ACTION_RESTART,
                                      virDomainLifecycleTypeFromString) < 0)
         goto error;
 
     if (virDomainEventActionParseXML(ctxt, "on_poweroff",
                                      "string(./on_poweroff[1])",
                                      &def->onPoweroff,
-                                     VIR_DOMAIN_LIFECYCLE_DESTROY,
+                                     VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY,
                                      virDomainLifecycleTypeFromString) < 0)
         goto error;
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a42efcfa68..4a821fb0f2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1792,12 +1792,12 @@ typedef enum {
 } virDomainCapsFeature;
 
 typedef enum {
-    VIR_DOMAIN_LIFECYCLE_DESTROY,
-    VIR_DOMAIN_LIFECYCLE_RESTART,
-    VIR_DOMAIN_LIFECYCLE_RESTART_RENAME,
-    VIR_DOMAIN_LIFECYCLE_PRESERVE,
+    VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY,
+    VIR_DOMAIN_LIFECYCLE_ACTION_RESTART,
+    VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME,
+    VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE,
 
-    VIR_DOMAIN_LIFECYCLE_LAST
+    VIR_DOMAIN_LIFECYCLE_ACTION_LAST
 } virDomainLifecycleAction;
 
 typedef enum {
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 34233a955f..15111af0b7 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -98,19 +98,19 @@ static libxl_action_on_shutdown
 libxlActionFromVirLifecycle(virDomainLifecycleAction action)
 {
     switch (action) {
-    case VIR_DOMAIN_LIFECYCLE_DESTROY:
+    case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY:
         return LIBXL_ACTION_ON_SHUTDOWN_DESTROY;
 
-    case VIR_DOMAIN_LIFECYCLE_RESTART:
-        return  LIBXL_ACTION_ON_SHUTDOWN_RESTART;
+    case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART:
+        return LIBXL_ACTION_ON_SHUTDOWN_RESTART;
 
-    case VIR_DOMAIN_LIFECYCLE_RESTART_RENAME:
+    case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME:
         return LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME;
 
-    case VIR_DOMAIN_LIFECYCLE_PRESERVE:
+    case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE:
         return LIBXL_ACTION_ON_SHUTDOWN_PRESERVE;
 
-    case VIR_DOMAIN_LIFECYCLE_LAST:
+    case VIR_DOMAIN_LIFECYCLE_ACTION_LAST:
         break;
     }
 
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 7caa674749..3b260ee15c 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -468,13 +468,13 @@ libxlDomainShutdownThread(void *opaque)
                                            VIR_DOMAIN_EVENT_STOPPED,
                                            VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
         switch ((virDomainLifecycleAction) vm->def->onPoweroff) {
-        case VIR_DOMAIN_LIFECYCLE_DESTROY:
+        case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY:
             goto destroy;
-        case VIR_DOMAIN_LIFECYCLE_RESTART:
-        case VIR_DOMAIN_LIFECYCLE_RESTART_RENAME:
+        case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART:
+        case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME:
             goto restart;
-        case VIR_DOMAIN_LIFECYCLE_PRESERVE:
-        case VIR_DOMAIN_LIFECYCLE_LAST:
+        case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE:
+        case VIR_DOMAIN_LIFECYCLE_ACTION_LAST:
             goto endjob;
         }
     } else if (xl_reason == LIBXL_SHUTDOWN_REASON_CRASH) {
@@ -508,13 +508,13 @@ libxlDomainShutdownThread(void *opaque)
                                            VIR_DOMAIN_EVENT_STOPPED,
                                            VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
         switch ((virDomainLifecycleAction) vm->def->onReboot) {
-        case VIR_DOMAIN_LIFECYCLE_DESTROY:
+        case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY:
             goto destroy;
-        case VIR_DOMAIN_LIFECYCLE_RESTART:
-        case VIR_DOMAIN_LIFECYCLE_RESTART_RENAME:
+        case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART:
+        case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME:
             goto restart;
-        case VIR_DOMAIN_LIFECYCLE_PRESERVE:
-        case VIR_DOMAIN_LIFECYCLE_LAST:
+        case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE:
+        case VIR_DOMAIN_LIFECYCLE_ACTION_LAST:
             goto endjob;
         }
     } else {
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 5fc6e7cda4..08f82f2580 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -1015,9 +1015,9 @@ lxcParseConfigString(const char *config,
     vmdef->id = -1;
     virDomainDefSetMemoryTotal(vmdef, 64 * 1024);
 
-    vmdef->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART;
+    vmdef->onReboot = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART;
     vmdef->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY;
-    vmdef->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY;
+    vmdef->onPoweroff = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY;
     vmdef->virtType = VIR_DOMAIN_VIRT_LXC;
 
     /* Value not handled by the LXC driver, setting to
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 46f0bdd18c..174385324c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6494,8 +6494,8 @@ qemuBuildPMCommandLine(virCommandPtr cmd,
     bool allowReboot = true;
 
     /* Only add -no-reboot option if each event destroys domain */
-    if (def->onReboot == VIR_DOMAIN_LIFECYCLE_DESTROY &&
-        def->onPoweroff == VIR_DOMAIN_LIFECYCLE_DESTROY &&
+    if (def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY &&
+        def->onPoweroff == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY &&
         (def->onCrash == VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY ||
          def->onCrash == VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY)) {
         allowReboot = false;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 36c9fae2b7..d9abe40f29 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1981,8 +1981,8 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
     if (!(vm = qemuDomObjFromDomain(dom)))
         goto cleanup;
 
-    if (vm->def->onPoweroff == VIR_DOMAIN_LIFECYCLE_RESTART ||
-        vm->def->onPoweroff == VIR_DOMAIN_LIFECYCLE_RESTART_RENAME) {
+    if (vm->def->onPoweroff == VIR_DOMAIN_LIFECYCLE_ACTION_RESTART ||
+        vm->def->onPoweroff == VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME) {
         isReboot = true;
         agentFlag = QEMU_AGENT_SHUTDOWN_REBOOT;
         VIR_INFO("Domain on_poweroff setting overridden, attempting reboot");
@@ -2076,8 +2076,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
     if (!(vm = qemuDomObjFromDomain(dom)))
         goto cleanup;
 
-    if (vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_DESTROY ||
-        vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_PRESERVE) {
+    if (vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY ||
+        vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE) {
         agentFlag = QEMU_AGENT_SHUTDOWN_POWERDOWN;
         isReboot = false;
         VIR_INFO("Domain on_reboot setting overridden, shutting down");
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 4896f2afb9..659db96d10 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1833,9 +1833,9 @@ qemuParseCommandLine(virCapsPtr caps,
         goto error;
     def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
 
-    def->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART;
+    def->onReboot = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART;
     def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY;
-    def->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY;
+    def->onPoweroff = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY;
     def->virtType = VIR_DOMAIN_VIRT_QEMU;
     if (VIR_STRDUP(def->emulator, progargv[0]) < 0)
         goto error;
@@ -2142,7 +2142,7 @@ qemuParseCommandLine(virCapsPtr caps,
         } else if (STREQ(arg, "-no-acpi")) {
             def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ABSENT;
         } else if (STREQ(arg, "-no-reboot")) {
-            def->onReboot = VIR_DOMAIN_LIFECYCLE_DESTROY;
+            def->onReboot = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY;
         } else if (STREQ(arg, "-no-kvm")) {
             def->virtType = VIR_DOMAIN_VIRT_QEMU;
         } else if (STREQ(arg, "-enable-kvm")) {
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 0cb023095b..1898d1c8a3 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -496,8 +496,8 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
         VIR_WARN("Failed to save status on vm %s", vm->def->name);
 
-    if (vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_DESTROY ||
-        vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_PRESERVE) {
+    if (vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY ||
+        vm->def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE) {
 
         if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
             goto cleanup;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 5742cf4198..8e9e31145f 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1920,22 +1920,22 @@ static int testDomainReboot(virDomainPtr domain,
                          VIR_DOMAIN_SHUTDOWN_USER);
 
     switch (privdom->def->onReboot) {
-    case VIR_DOMAIN_LIFECYCLE_DESTROY:
+    case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY:
         virDomainObjSetState(privdom, VIR_DOMAIN_SHUTOFF,
                              VIR_DOMAIN_SHUTOFF_SHUTDOWN);
         break;
 
-    case VIR_DOMAIN_LIFECYCLE_RESTART:
+    case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART:
         virDomainObjSetState(privdom, VIR_DOMAIN_RUNNING,
                              VIR_DOMAIN_RUNNING_BOOTED);
         break;
 
-    case VIR_DOMAIN_LIFECYCLE_PRESERVE:
+    case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE:
         virDomainObjSetState(privdom, VIR_DOMAIN_SHUTOFF,
                              VIR_DOMAIN_SHUTOFF_SHUTDOWN);
         break;
 
-    case VIR_DOMAIN_LIFECYCLE_RESTART_RENAME:
+    case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME:
         virDomainObjSetState(privdom, VIR_DOMAIN_RUNNING,
                              VIR_DOMAIN_RUNNING_BOOTED);
         break;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 8aae635c17..2cb48bb729 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1578,8 +1578,8 @@ virVMXParseConfig(virVMXContext *ctx,
     }
 
     /* def:lifecycle */
-    def->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART;
-    def->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY;
+    def->onReboot = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART;
+    def->onPoweroff = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY;
     def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY;
 
     /* def:os */
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 5f377147c6..c4ffbde9a4 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1887,8 +1887,8 @@ prlsdkLoadDomain(vzDriverPtr driver,
 
     def->virtType = VIR_DOMAIN_VIRT_VZ;
 
-    def->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART;
-    def->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY;
+    def->onReboot = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART;
+    def->onPoweroff = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY;
     def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY;
 
     /* get RAM parameters */
@@ -2591,8 +2591,8 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
         return -1;
     }
 
-    if (def->onReboot != VIR_DOMAIN_LIFECYCLE_RESTART ||
-        def->onPoweroff != VIR_DOMAIN_LIFECYCLE_DESTROY ||
+    if (def->onReboot != VIR_DOMAIN_LIFECYCLE_ACTION_RESTART ||
+        def->onPoweroff != VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY ||
         def->onCrash != VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY) {
 
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 0b16f89a4d..c4bbecc336 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -131,9 +131,9 @@ enum xen_on_normal_exit
 actionShutdownLibvirt2XenapiEnum(virDomainLifecycleAction action)
 {
     enum xen_on_normal_exit num = XEN_ON_NORMAL_EXIT_RESTART;
-    if (action == VIR_DOMAIN_LIFECYCLE_DESTROY)
+    if (action == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY)
         num = XEN_ON_NORMAL_EXIT_DESTROY;
-    else if (action == VIR_DOMAIN_LIFECYCLE_RESTART)
+    else if (action == VIR_DOMAIN_LIFECYCLE_ACTION_RESTART)
         num = XEN_ON_NORMAL_EXIT_RESTART;
     return num;
 }
@@ -201,11 +201,11 @@ map2LibvirtBootOrder(char c)
 virDomainLifecycleAction
 xenapiNormalExitEnum2virDomainLifecycle(enum xen_on_normal_exit action)
 {
-    virDomainLifecycleAction num = VIR_DOMAIN_LIFECYCLE_RESTART;
+    virDomainLifecycleAction num = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART;
     if (action == XEN_ON_NORMAL_EXIT_DESTROY)
-        num = VIR_DOMAIN_LIFECYCLE_DESTROY;
+        num = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY;
     else if (action == XEN_ON_NORMAL_EXIT_RESTART)
-        num = VIR_DOMAIN_LIFECYCLE_RESTART;
+        num = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART;
     return num;
 }
 
diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c
index fefa61ac23..cf62215e54 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -1251,7 +1251,7 @@ xenParseSxpr(const struct sexpr *root,
             goto error;
         }
     } else {
-        def->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY;
+        def->onPoweroff = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY;
     }
 
     tmp = sexpr_node(root, "domain/on_reboot");
@@ -1262,7 +1262,7 @@ xenParseSxpr(const struct sexpr *root,
             goto error;
         }
     } else {
-        def->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART;
+        def->onReboot = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART;
     }
 
     tmp = sexpr_node(root, "domain/on_crash");
-- 
2.13.6




More information about the libvir-list mailing list