Use the new accessor APIs for storage_driver and test_driver. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/storage/storage_driver.c | 20 +++++++++----------- src/test/test_driver.c | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 89eaee9..c9156e6 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -196,7 +196,7 @@ storageDriverAutostart(void) continue; } - if (obj->autostart && + if (virStoragePoolObjIsAutostart(obj) && !virStoragePoolObjIsActive(obj)) { if (backend->startPool && backend->startPool(conn, obj) < 0) { @@ -1249,11 +1249,7 @@ storagePoolGetAutostart(virStoragePoolPtr pool, if (virStoragePoolGetAutostartEnsureACL(pool->conn, obj->def) < 0) goto cleanup; - if (!virStoragePoolObjGetConfigFile(obj)) { - *autostart = 0; - } else { - *autostart = obj->autostart; - } + *autostart = virStoragePoolObjIsAutostart(obj) ? 1 : 0; ret = 0; @@ -1269,6 +1265,8 @@ storagePoolSetAutostart(virStoragePoolPtr pool, virStoragePoolObjPtr obj; const char *configFile; const char *autostartLink; + bool new_autostart; + bool cur_autostart; int ret = -1; storageDriverLock(); @@ -1286,10 +1284,10 @@ storagePoolSetAutostart(virStoragePoolPtr pool, autostartLink = virStoragePoolObjGetAutostartLink(obj); - autostart = (autostart != 0); - - if (obj->autostart != autostart) { - if (autostart) { + new_autostart = (autostart != 0); + cur_autostart = virStoragePoolObjIsAutostart(obj); + if (cur_autostart != new_autostart) { + if (new_autostart) { if (virFileMakePath(driver->autostartDir) < 0) { virReportSystemError(errno, _("cannot create autostart directory %s"), @@ -1312,7 +1310,7 @@ storagePoolSetAutostart(virStoragePoolPtr pool, goto cleanup; } } - obj->autostart = autostart; + virStoragePoolObjSetAutostart(obj, autostart); } ret = 0; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 33ce9e4..b793187 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4748,7 +4748,7 @@ testStoragePoolGetAutostart(virStoragePoolPtr pool, if (!virStoragePoolObjGetConfigFile(obj)) *autostart = 0; else - *autostart = obj->autostart; + *autostart = virStoragePoolObjIsAutostart(obj) ? 1 : 0; virStoragePoolObjUnlock(obj); return 0; @@ -4773,7 +4773,7 @@ testStoragePoolSetAutostart(virStoragePoolPtr pool, } autostart = (autostart != 0); - obj->autostart = autostart; + virStoragePoolObjSetAutostart(obj, autostart); ret = 0; cleanup: -- 2.9.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list