mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
storagePoolDefineXML: prefer using newDef to save config file
When re-defining an active storage pool, due to a bug the config
file on disk is not changed. This is because we are passing old
definition instead of new one to virStoragePoolObjSaveDef.
This issue was introduced by bfcd8fc9
,
Signed-off-by: Changkuo Shi <shi.changkuo@h3c.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
fac0dacd54
commit
a94bb4ebdf
@ -810,13 +810,14 @@ storagePoolDefineXML(virConnectPtr conn,
|
||||
|
||||
if (!(obj = virStoragePoolObjAssignDef(driver->pools, newDef)))
|
||||
goto cleanup;
|
||||
newDef = NULL;
|
||||
newDef = virStoragePoolObjGetNewDef(obj);
|
||||
def = virStoragePoolObjGetDef(obj);
|
||||
|
||||
if (virStoragePoolObjSaveDef(driver, obj, def) < 0) {
|
||||
if (virStoragePoolObjSaveDef(driver, obj, newDef ? newDef : def) < 0) {
|
||||
virStoragePoolObjRemove(driver->pools, obj);
|
||||
virObjectUnref(obj);
|
||||
obj = NULL;
|
||||
newDef = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -826,6 +827,7 @@ storagePoolDefineXML(virConnectPtr conn,
|
||||
|
||||
VIR_INFO("Defining storage pool '%s'", def->name);
|
||||
pool = virGetStoragePool(conn, def->name, def->uuid, NULL, NULL);
|
||||
newDef = NULL;
|
||||
|
||||
cleanup:
|
||||
virObjectEventStateQueue(driver->storageEventState, event);
|
||||
|
Loading…
Reference in New Issue
Block a user