[PATCH 2/2] Adding Storage Management driver (style and indentation)

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

 



This is just the indentation, style  and cleanup patch.

---
 src/phyp/phyp_driver.c |  100 +++++++++++++++++++++++++++--------------------
 src/phyp/phyp_driver.h |   13 ++++--
 2 files changed, 66 insertions(+), 47 deletions(-)

diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 51bab2c..7e39dfd 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -656,7 +656,8 @@ phypGetLparMem(virConnectPtr conn, const char *managed_system, int lpar_id,
     virBufferAddLit(&buf, "lshwres");
     if (system_type == HMC)
         virBufferVSprintf(&buf, " -m %s", managed_system);
-    virBufferVSprintf(&buf, " -r mem --level lpar -F %s --filter lpar_ids=%d",
+    virBufferVSprintf(&buf,
+                      " -r mem --level lpar -F %s --filter lpar_ids=%d",
                       type ? "curr_mem" : "curr_max_mem", lpar_id);
     if (virBufferError(&buf)) {
         virBufferFreeAndReset(&buf);
@@ -722,7 +723,8 @@ phypGetLparCPUGeneric(virConnectPtr conn, const char *managed_system,
     virBufferAddLit(&buf, "lshwres");
     if (system_type == HMC)
         virBufferVSprintf(&buf, " -m %s", managed_system);
-    virBufferVSprintf(&buf, " -r proc --level lpar -F %s --filter lpar_ids=%d",
+    virBufferVSprintf(&buf,
+                      " -r proc --level lpar -F %s --filter lpar_ids=%d",
                       type ? "curr_max_procs" : "curr_procs", lpar_id);
     if (virBufferError(&buf)) {
         virBufferFreeAndReset(&buf);
@@ -773,8 +775,7 @@ phypGetRemoteSlot(virConnectPtr conn, const char *managed_system,
     if (system_type == HMC)
         virBufferVSprintf(&buf, " -m %s", managed_system);
     virBufferVSprintf(&buf, " -r virtualio --rsubtype scsi -F "
-                      "remote_slot_num --filter lpar_names=%s",
-                      lpar_name);
+                      "remote_slot_num --filter lpar_names=%s", lpar_name);
     if (virBufferError(&buf)) {
         virBufferFreeAndReset(&buf);
         virReportOOMError();
@@ -1067,7 +1068,8 @@ phypNumDomainsGeneric(virConnectPtr conn, unsigned int type)
     virBufferAddLit(&buf, "lssyscfg -r lpar");
     if (system_type == HMC)
         virBufferVSprintf(&buf, " -m %s", managed_system);
-    virBufferVSprintf(&buf, " -F lpar_id,state %s |grep -c '^[0-9]*'", state);
+    virBufferVSprintf(&buf, " -F lpar_id,state %s |grep -c '^[0-9]*'",
+                      state);
     if (virBufferError(&buf)) {
         virBufferFreeAndReset(&buf);
         virReportOOMError();
@@ -1141,7 +1143,8 @@ phypListDomainsGeneric(virConnectPtr conn, int *ids, int nids,
     virBufferAddLit(&buf, "lssyscfg -r lpar");
     if (system_type == HMC)
         virBufferVSprintf(&buf, " -m %s", managed_system);
-    virBufferVSprintf(&buf, " -F lpar_id,state %s | sed -e 's/,.*$//'", state);
+    virBufferVSprintf(&buf, " -F lpar_id,state %s | sed -e 's/,.*$//'",
+                      state);
     if (virBufferError(&buf)) {
         virBufferFreeAndReset(&buf);
         virReportOOMError();
@@ -1744,7 +1747,7 @@ phypGetVIOSNextSlotNumber(virConnectPtr conn)
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
     if (!(profile = phypGetLparProfile(conn, vios_id))) {
-        VIR_ERROR("%s", "Unable to get VIOS profile name.");
+        VIR_ERROR0(_("Unable to get VIOS profile name."));
         goto err;
     }
 
@@ -1806,17 +1809,17 @@ phypCreateServerSCSIAdapter(virConnectPtr conn)
     if (!
         (vios_name =
          phypGetLparNAME(session, managed_system, vios_id, conn))) {
-        VIR_ERROR("%s", "Unable to get VIOS name");
+        VIR_ERROR0(_("Unable to get VIOS name"));
         goto err;
     }
 
     if (!(profile = phypGetLparProfile(conn, vios_id))) {
-        VIR_ERROR("%s", "Unable to get VIOS profile name.");
+        VIR_ERROR0(_("Unable to get VIOS profile name."));
         goto err;
     }
 
     if ((slot = phypGetVIOSNextSlotNumber(conn)) == -1) {
-        VIR_ERROR("%s", "Unable to get free slot number");
+        VIR_ERROR0(_("Unable to get free slot number"));
         goto err;
     }
 
@@ -2001,7 +2004,7 @@ phypAttachDevice(virDomainPtr domain, const char *xml)
     if (!
         (vios_name =
          phypGetLparNAME(session, managed_system, vios_id, conn))) {
-        VIR_ERROR("%s", "Unable to get VIOS name");
+        VIR_ERROR0(_("Unable to get VIOS name"));
         goto err;
     }
 
@@ -2011,11 +2014,11 @@ phypAttachDevice(virDomainPtr domain, const char *xml)
         /* If not found, let's create one.
          * */
         if (phypCreateServerSCSIAdapter(conn) == -1) {
-            VIR_ERROR("%s", "Unable to create new virtual adapter");
+            VIR_ERROR0(_("Unable to create new virtual adapter"));
             goto err;
         } else {
             if (!(scsi_adapter = phypGetVIOSFreeSCSIAdapter(conn))) {
-                VIR_ERROR("%s", "Unable to create new virtual adapter");
+                VIR_ERROR0(_("Unable to create new virtual adapter"));
                 goto err;
             }
         }
@@ -2036,6 +2039,7 @@ phypAttachDevice(virDomainPtr domain, const char *xml)
         virReportOOMError();
         return -1;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     ret = phypExec(session, cmd, &exit_status, conn);
@@ -2044,7 +2048,7 @@ phypAttachDevice(virDomainPtr domain, const char *xml)
         goto err;
 
     if (!(profile = phypGetLparProfile(conn, domain->id))) {
-        VIR_ERROR("%s", "Unable to get VIOS profile name.");
+        VIR_ERROR0(_("Unable to get VIOS profile name."));
         goto err;
     }
 
@@ -2330,6 +2334,7 @@ phypVolumeGetKey(virConnectPtr conn, char *key, const char *name)
         virReportOOMError();
         return -1;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     ret = phypExec(session, cmd, &exit_status, conn);
@@ -2385,6 +2390,7 @@ phypGetStoragePoolDevice(virConnectPtr conn, char *name)
         virReportOOMError();
         return NULL;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     ret = phypExec(session, cmd, &exit_status, conn);
@@ -2438,6 +2444,7 @@ phypGetStoragePoolSize(virConnectPtr conn, char *name)
         virReportOOMError();
         return -1;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     ret = phypExec(session, cmd, &exit_status, conn);
@@ -2487,12 +2494,13 @@ phypBuildVolume(virConnectPtr conn, const char *lvname, const char *spname,
         virReportOOMError();
         return -1;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     ret = phypExec(session, cmd, &exit_status, conn);
 
     if (exit_status < 0) {
-        VIR_ERROR("%s\"%s\"", "Unable to create Volume. Reason: ", ret);
+        VIR_ERROR(_("unable to create Volume. Reason: %s"), ret);
         goto err;
     }
 
@@ -2535,7 +2543,7 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,
     if (pool->name != NULL) {
         spdef->name = pool->name;
     } else {
-        VIR_ERROR("%s", "Unable to determine storage pool's name.");
+        VIR_ERROR0(_("Unable to determine storage pool's name."));
         goto err;
     }
 
@@ -2546,7 +2554,7 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,
 
     if ((spdef->capacity =
          phypGetStoragePoolSize(pool->conn, pool->name)) == -1) {
-        VIR_ERROR("%s", "Unable to determine storage pools's size.");
+        VIR_ERROR0(_("Unable to determine storage pools's size."));
         goto err;
     }
 
@@ -2559,19 +2567,19 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,
     /*XXX source adapter not working properly, should show hdiskX */
     if ((spdef->source.adapter =
          phypGetStoragePoolDevice(pool->conn, pool->name)) == NULL) {
-        VIR_ERROR("%s",
-                  "Unable to determine storage pools's source adapter.");
+        VIR_ERROR0(_
+                   ("Unable to determine storage pools's source adapter."));
         goto err;
     }
 
     if ((voldef = virStorageVolDefParseString(spdef, xml)) == NULL) {
-        VIR_ERROR("%s", "Error parsing volume XML.");
+        VIR_ERROR0(_("Error parsing volume XML."));
         goto err;
     }
 
     /* checking if this name already exists on this system */
     if (phypVolumeLookupByName(pool, voldef->name) != NULL) {
-        VIR_ERROR("%s", "StoragePool name already exists.");
+        VIR_ERROR0(_("StoragePool name already exists."));
         goto err;
     }
 
@@ -2579,13 +2587,13 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,
      * in the moment you create the volume.
      * */
     if (voldef->key) {
-        VIR_ERROR("%s",
-                  "Key must be empty, Power Hypervisor will create one for you.");
+        VIR_ERROR0(_
+                   ("Key must be empty, Power Hypervisor will create one for you."));
         goto err;
     }
 
     if (voldef->capacity) {
-        VIR_ERROR("%s", "Capacity cannot be empty.");
+        VIR_ERROR0(_("Capacity cannot be empty."));
         goto err;
     }
 
@@ -2640,6 +2648,7 @@ phypVolumeGetPhysicalVolumeByStoragePool(virStorageVolPtr vol, char *sp)
         virReportOOMError();
         return NULL;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     ret = phypExec(session, cmd, &exit_status, conn);
@@ -2693,6 +2702,7 @@ phypVolumeLookupByPath(virConnectPtr conn, const char *volname)
         virReportOOMError();
         return NULL;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     spname = phypExec(session, cmd, &exit_status, conn);
@@ -2741,17 +2751,17 @@ phypVolumeGetXMLDesc(virStorageVolPtr vol, unsigned int flags)
     if (sp->name != NULL) {
         pool.name = sp->name;
     } else {
-        VIR_ERROR("%s", "Unable to determine storage sp's name.");
+        VIR_ERROR0(_("Unable to determine storage sp's name."));
         goto err;
     }
 
     if (memmove(pool.uuid, sp->uuid, VIR_UUID_BUFLEN) == NULL) {
-        VIR_ERROR("%s", "Unable to determine storage sp's uuid.");
+        VIR_ERROR0(_("Unable to determine storage sp's uuid."));
         goto err;
     }
 
     if ((pool.capacity = phypGetStoragePoolSize(sp->conn, sp->name)) == -1) {
-        VIR_ERROR("%s", "Unable to determine storage sps's size.");
+        VIR_ERROR0(_("Unable to determine storage sps's size."));
         goto err;
     }
 
@@ -2763,20 +2773,19 @@ phypVolumeGetXMLDesc(virStorageVolPtr vol, unsigned int flags)
 
     if ((pool.source.adapter =
          phypGetStoragePoolDevice(sp->conn, sp->name)) == NULL) {
-        VIR_ERROR("%s",
-                  "Unable to determine storage sps's source adapter.");
+        VIR_ERROR0(_("Unable to determine storage sps's source adapter."));
         goto err;
     }
 
     if (vol->name != NULL)
         voldef.name = vol->name;
     else {
-        VIR_ERROR("%s", "Unable to determine storage pool's name.");
+        VIR_ERROR0(_("Unable to determine storage pool's name."));
         goto err;
     }
 
-    if (memmove(voldef.key, vol->key, PATH_MAX) == NULL) {
-        VIR_ERROR("%s", "Unable to determine volume's key.");
+    if (memmove(voldef.key, vol->key, MAX_KEY_SIZE) == NULL) {
+        VIR_ERROR0(_("Unable to determine volume's key."));
         goto err;
     }
 
@@ -2829,6 +2838,7 @@ phypVolumeGetPath(virStorageVolPtr vol)
         virReportOOMError();
         return NULL;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     sp = phypExec(session, cmd, &exit_status, conn);
@@ -3032,6 +3042,7 @@ phypDestroyStoragePool(virStoragePoolPtr pool)
         virReportOOMError();
         return -1;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     if (virAsprintf(&cmd,
@@ -3045,8 +3056,7 @@ phypDestroyStoragePool(virStoragePoolPtr pool)
     ret = phypExec(session, cmd, &exit_status, conn);
 
     if (exit_status < 0) {
-        VIR_ERROR("%s\"%s\"", "Unable to create Storage Pool. Reason: ",
-                  ret);
+        VIR_ERROR(_("Unable to create Storage Pool. Reason: %s"), ret);
         goto err;
     }
 
@@ -3090,13 +3100,13 @@ phypBuildStoragePool(virConnectPtr conn, virStoragePoolDefPtr def)
         virReportOOMError();
         return -1;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     ret = phypExec(session, cmd, &exit_status, conn);
 
     if (exit_status < 0) {
-        VIR_ERROR("%s\"%s\"", "Unable to create Storage Pool. Reason: ",
-                  ret);
+        VIR_ERROR(_("Unable to create Storage Pool. Reason: %s"), ret);
         goto err;
     }
 
@@ -3161,22 +3171,22 @@ phypGetStoragePoolXMLDesc(virStoragePoolPtr pool, unsigned int flags)
     if (pool->name != NULL)
         def.name = pool->name;
     else {
-        VIR_ERROR("%s", "Unable to determine storage pool's name.");
+        VIR_ERROR0(_("Unable to determine storage pool's name."));
         goto err;
     }
 
     if (memmove(def.uuid, pool->uuid, VIR_UUID_BUFLEN) == NULL) {
-        VIR_ERROR("%s", "Unable to determine storage pool's uuid.");
+        VIR_ERROR0(_("Unable to determine storage pool's uuid."));
         goto err;
     }
 
     if ((def.capacity =
          phypGetStoragePoolSize(pool->conn, pool->name)) == -1) {
-        VIR_ERROR("%s", "Unable to determine storage pools's size.");
+        VIR_ERROR0(_("Unable to determine storage pools's size."));
         goto err;
     }
 
-    /* Information not avaliable */
+    /* Information not available */
     def.allocation = 0;
     def.available = 0;
 
@@ -3185,8 +3195,8 @@ phypGetStoragePoolXMLDesc(virStoragePoolPtr pool, unsigned int flags)
     /*XXX source adapter not working properly, should show hdiskX */
     if ((def.source.adapter =
          phypGetStoragePoolDevice(pool->conn, pool->name)) == NULL) {
-        VIR_ERROR("%s",
-                  "Unable to determine storage pools's source adapter.");
+        VIR_ERROR0(_
+                   ("Unable to determine storage pools's source adapter."));
         goto err;
     }
 
@@ -3227,6 +3237,7 @@ phypGetStoragePoolUUID(virConnectPtr conn, unsigned char *uuid,
         virReportOOMError();
         return -1;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     ret = phypExec(session, cmd, &exit_status, conn);
@@ -3348,6 +3359,7 @@ phypNumOfStoragePools(virConnectPtr conn)
         virReportOOMError();
         return -1;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     ret = phypExec(session, cmd, &exit_status, conn);
@@ -3400,6 +3412,7 @@ phypListStoragePools(virConnectPtr conn, char **const pools, int npools)
         virReportOOMError();
         return -1;
     }
+
     cmd = virBufferContentAndReset(&buf);
 
     ret = phypExec(session, cmd, &exit_status, conn);
@@ -3437,6 +3450,7 @@ phypListStoragePools(virConnectPtr conn, char **const pools, int npools)
     VIR_FREE(ret);
     return -1;
 }
+
 virDrvOpenStatus
 phypStorageOpen(virConnectPtr conn ATTRIBUTE_UNUSED,
                 virConnectAuthPtr auth ATTRIBUTE_UNUSED,
@@ -3798,7 +3812,7 @@ phypUUIDTable_Push(virConnectPtr conn)
                 /* end of file */
                 break;
             } else {
-                VIR_ERROR(_("Failed to read from '%s'"), local_file);
+                VIR_ERROR(_("Failed to read from %s"), local_file);
                 goto err;
             }
         }
diff --git a/src/phyp/phyp_driver.h b/src/phyp/phyp_driver.h
index e738927..14103f2 100644
--- a/src/phyp/phyp_driver.h
+++ b/src/phyp/phyp_driver.h
@@ -84,7 +84,8 @@ virStorageVolPtr
 phypStorageVolCreateXML(virStoragePoolPtr pool,
                         const char *xml, unsigned int flags);
 
-virStorageVolPtr phypVolumeLookupByPath (virConnectPtr pool, const char *path);
+virStorageVolPtr phypVolumeLookupByPath(virConnectPtr pool,
+                                        const char *path);
 
 char *phypVolumeGetXMLDesc(virStorageVolPtr vol, unsigned int flags);
 
@@ -109,11 +110,15 @@ int phypNumOfStoragePools(virConnectPtr conn);
 int phypListStoragePools(virConnectPtr conn, char **const pools,
                          int npools);
 
-virStoragePoolPtr phypStoragePoolLookupByName(virConnectPtr conn, const char *name);
+virStoragePoolPtr phypStoragePoolLookupByName(virConnectPtr conn,
+                                              const char *name);
 
-virStoragePoolPtr phypGetStoragePoolLookUpByUUID(virConnectPtr conn, const unsigned char *uuid);
+virStoragePoolPtr phypGetStoragePoolLookUpByUUID(virConnectPtr conn,
+                                                 const unsigned char
+                                                 *uuid);
 
-char * phypGetStoragePoolXMLDesc(virStoragePoolPtr pool, unsigned int flags);
+char *phypGetStoragePoolXMLDesc(virStoragePoolPtr pool,
+                                unsigned int flags);
 
 virDrvOpenStatus phypStorageOpen(virConnectPtr conn ATTRIBUTE_UNUSED,
                                  virConnectAuthPtr auth ATTRIBUTE_UNUSED,
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]