]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: Use virStoragePoolObj{Is|Set}Active
authorJohn Ferlan <jferlan@redhat.com>
Wed, 26 Jul 2017 16:15:42 +0000 (12:15 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 19 Sep 2017 12:30:19 +0000 (08:30 -0400)
Use the new accessor APIs for storage_driver, test_driver, and
gluster backend.

src/storage/storage_backend_gluster.c
src/storage/storage_driver.c
src/test/test_driver.c

index 90f31b00ed6397c5ddd24df238f0c6ccf7091989..05e7bff638dcb447c717a9c0ab158f4ee3f4468b 100644 (file)
@@ -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;
 }
 
index c9e3f4675739a2d4fd1799e57af490bfdc2bac61..37e9981b5bf0fbbd551ebe68faaac68dcf9b5364 100644 (file)
@@ -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;
index e2f0a87b746ac49c3134519bec2b377b6b65fa03..d8ae2dea436bcfb918c5fa04faa156b35dd2bad9 100644 (file)
@@ -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) {
@@ -4344,7 +4344,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,
@@ -4492,7 +4492,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,
@@ -4640,7 +4640,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) {
@@ -4718,7 +4718,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;