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

[libvirt] [PATCH] startupPolicty: Minor cleanups



This patch does some cleanups to my previous startupPolicy patchset.
---
 daemon/remote.c        |    2 ++
 src/conf/domain_conf.c |    2 +-
 src/qemu/qemu_domain.c |   20 +++++++++-----------
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 9d70163..f736e5f 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -496,6 +496,8 @@ static int remoteRelayDomainEventDiskChange(virConnectPtr conn ATTRIBUTE_UNUSED,
     return 0;
 
 mem_error:
+    VIR_FREE(oldSrcPath_p);
+    VIR_FREE(newSrcPath_p);
     virReportOOMError();
     return -1;
 }
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 557d0b9..8f72d37 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2657,7 +2657,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
     if (startupPolicy) {
         int i;
 
-        if ((i = virDomainStartupPolicyTypeFromString(startupPolicy)) < 0) {
+        if ((i = virDomainStartupPolicyTypeFromString(startupPolicy)) <= 0) {
             virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown startupPolicy value '%s'"),
                                  startupPolicy);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 198ebcc..572ea7d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1617,9 +1617,8 @@ qemuDomainCheckDiskPresence(struct qemud_driver *driver,
 {
     int ret = -1;
     int i;
-    int accessRet;
     virDomainDiskDefPtr disk;
-    char uuid[VIR_UUID_STRING_BUFLEN] ATTRIBUTE_UNUSED;
+    char uuid[VIR_UUID_STRING_BUFLEN];
     virDomainEventPtr event = NULL;
 
     virUUIDFormat(vm->def->uuid, uuid);
@@ -1630,11 +1629,10 @@ qemuDomainCheckDiskPresence(struct qemud_driver *driver,
         if (!disk->startupPolicy || !disk->src)
             continue;
 
-        if ((accessRet = virFileAccessibleAs(disk->src, F_OK,
-                                             driver->user,
-                                             driver->group)) >= 0) {
-            /* disk accessible or virFileAccessibleAs()
-             * terminated with signal*/
+        if (virFileAccessibleAs(disk->src, F_OK,
+                                driver->user,
+                                driver->group) >= 0) {
+            /* disk accessible */
             continue;
         }
 
@@ -1643,7 +1641,7 @@ qemuDomainCheckDiskPresence(struct qemud_driver *driver,
                 break;
 
             case VIR_DOMAIN_STARTUP_POLICY_MANDATORY:
-                virReportSystemError(-accessRet,
+                virReportSystemError(errno,
                                      _("cannot access file '%s'"),
                                      disk->src);
                 goto cleanup;
@@ -1651,7 +1649,7 @@ qemuDomainCheckDiskPresence(struct qemud_driver *driver,
 
             case VIR_DOMAIN_STARTUP_POLICY_REQUISITE:
                 if (!start_with_state) {
-                    virReportSystemError(-accessRet,
+                    virReportSystemError(errno,
                                          _("cannot access file '%s'"),
                                          disk->src);
                     goto cleanup;
@@ -1664,8 +1662,8 @@ qemuDomainCheckDiskPresence(struct qemud_driver *driver,
                 break;
         }
 
-        VIR_DEBUG("Droping disk '%s' on domain '%s' (UUID '%s') "
-                  "due to not accessible source '%s'",
+        VIR_DEBUG("Dropping disk '%s' on domain '%s' (UUID '%s') "
+                  "due to inaccessible source '%s'",
                   disk->dst, vm->def->name, uuid, disk->src);
 
         event = virDomainEventDiskChangeNewFromObj(vm, disk->src, NULL, disk->info.alias,
-- 
1.7.3.4


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