提交 bb15e65a 编写于 作者: J John Ferlan

storage: Use virStoragePoolObj{Is|Set}Autostart

Use the new accessor APIs for storage_driver and test_driver.
上级 0147f727
......@@ -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;
......
......@@ -4764,7 +4764,7 @@ testStoragePoolGetAutostart(virStoragePoolPtr pool,
if (!virStoragePoolObjGetConfigFile(obj))
*autostart = 0;
else
*autostart = obj->autostart;
*autostart = virStoragePoolObjIsAutostart(obj) ? 1 : 0;
virStoragePoolObjUnlock(obj);
return 0;
......@@ -4789,7 +4789,7 @@ testStoragePoolSetAutostart(virStoragePoolPtr pool,
}
autostart = (autostart != 0);
obj->autostart = autostart;
virStoragePoolObjSetAutostart(obj, autostart);
ret = 0;
cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册