[PATCH v2 08/12] storage: Use virStoragePoolObj{Is|Set}Active

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

 



Use the new accessor APIs for storage_driver, test_driver, and
gluster backend.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/storage/storage_backend_gluster.c |  2 +-
 src/storage/storage_driver.c          | 16 ++++++++--------
 src/test/test_driver.c                | 10 +++++-----
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
index 90f31b0..05e7bff 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -544,7 +544,7 @@ virStorageBackendGlusterCheckPool(virStoragePoolObjPtr pool,
     /* Return previous state remembered by the status XML. If the pool is not
      * available we will fail to refresh it and end up in the same situation.
      * This will save one attempt to open the connection to the remote server */
-    *active = pool->active;
+    *active = virStoragePoolObjIsActive(pool);
     return 0;
 }
 
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index a7a77ba..89eaee9 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -145,9 +145,9 @@ storagePoolUpdateState(virStoragePoolObjPtr obj)
         }
     }
 
-    obj->active = active;
+    virStoragePoolObjSetActive(obj, active);
 
-    if (!obj->active)
+    if (!virStoragePoolObjIsActive(obj))
         virStoragePoolUpdateInactive(&obj);
 
  cleanup:
@@ -226,7 +226,7 @@ storageDriverAutostart(void)
                                _("Failed to autostart storage pool '%s': %s"),
                                obj->def->name, virGetLastErrorMessage());
             } else {
-                obj->active = true;
+                virStoragePoolObjSetActive(obj, true);
             }
             VIR_FREE(stateFile);
         }
@@ -735,7 +735,7 @@ storagePoolCreateXML(virConnectPtr conn,
                                             0);
 
     VIR_INFO("Creating storage pool '%s'", obj->def->name);
-    obj->active = true;
+    virStoragePoolObjSetActive(obj, true);
 
     pool = virGetStoragePool(conn, obj->def->name, obj->def->uuid, NULL, NULL);
 
@@ -940,7 +940,7 @@ storagePoolCreate(virStoragePoolPtr pool,
                                             VIR_STORAGE_POOL_EVENT_STARTED,
                                             0);
 
-    obj->active = true;
+    virStoragePoolObjSetActive(obj, true);
     ret = 0;
 
  cleanup:
@@ -1040,7 +1040,7 @@ storagePoolDestroy(virStoragePoolPtr pool)
                                             VIR_STORAGE_POOL_EVENT_STOPPED,
                                             0);
 
-    obj->active = false;
+    virStoragePoolObjSetActive(obj, false);
 
     virStoragePoolUpdateInactive(&obj);
 
@@ -1156,7 +1156,7 @@ storagePoolRefresh(virStoragePoolPtr pool,
                                                 obj->def->uuid,
                                                 VIR_STORAGE_POOL_EVENT_STOPPED,
                                                 0);
-        obj->active = false;
+        virStoragePoolObjSetActive(obj, false);
 
         virStoragePoolUpdateInactive(&obj);
 
@@ -1194,7 +1194,7 @@ storagePoolGetInfo(virStoragePoolPtr pool,
         goto cleanup;
 
     memset(info, 0, sizeof(virStoragePoolInfo));
-    if (obj->active)
+    if (virStoragePoolObjIsActive(obj))
         info->state = VIR_STORAGE_POOL_RUNNING;
     else
         info->state = VIR_STORAGE_POOL_INACTIVE;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 36e5ba1..33ce9e4 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1131,7 +1131,7 @@ testParseStorage(testDriverPtr privconn,
             virStoragePoolObjUnlock(obj);
             goto error;
         }
-        obj->active = true;
+        virStoragePoolObjSetActive(obj, true);
 
         /* Find storage volumes */
         if (testOpenVolumesForPool(file, ctxt, obj, i+1) < 0) {
@@ -4328,7 +4328,7 @@ testStoragePoolCreate(virStoragePoolPtr pool,
     if (!(obj = testStoragePoolObjFindInactiveByName(privconn, pool->name)))
         return -1;
 
-    obj->active = true;
+    virStoragePoolObjSetActive(obj, true);
 
     event = virStoragePoolEventLifecycleNew(pool->name, pool->uuid,
                                             VIR_STORAGE_POOL_EVENT_STARTED,
@@ -4476,7 +4476,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
      * code will not Remove the pool */
     virStoragePoolObjSetConfigFile(obj, NULL);
 
-    obj->active = true;
+    virStoragePoolObjSetActive(obj, true);
 
     event = virStoragePoolEventLifecycleNew(obj->def->name, obj->def->uuid,
                                             VIR_STORAGE_POOL_EVENT_STARTED,
@@ -4624,7 +4624,7 @@ testStoragePoolDestroy(virStoragePoolPtr pool)
     if (!(obj = testStoragePoolObjFindActiveByName(privconn, pool->name)))
         return -1;
 
-    obj->active = false;
+    virStoragePoolObjSetActive(obj, false);
 
     if (obj->def->source.adapter.type ==
         VIR_STORAGE_ADAPTER_TYPE_FC_HOST) {
@@ -4702,7 +4702,7 @@ testStoragePoolGetInfo(virStoragePoolPtr pool,
         return -1;
 
     memset(info, 0, sizeof(virStoragePoolInfo));
-    if (obj->active)
+    if (virStoragePoolObjIsActive(obj))
         info->state = VIR_STORAGE_POOL_RUNNING;
     else
         info->state = VIR_STORAGE_POOL_INACTIVE;
-- 
2.9.5

--
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]
  Powered by Linux