[libvirt] [PATCH v1] storage: prefer using newDef to save configfile

Shichangkuo posted 1 patch 10 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/D1E4D02760513D4B90DC3B40FF32AF350104B1D3AF@H3CMLB14-EX.srv.huawei-3com.com
Test syntax-check passed
src/storage/storage_driver.c |    6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

[libvirt] [PATCH v1] storage: prefer using newDef to save configfile

Posted by Shichangkuo 10 weeks ago
When re-defining an active storage pool, the configfile has not
changed. This issue was introduced by bfcd8fc, storage: Use
virStoragePoolObjGetDef accessor for driver. So we prefer using
newDef to save configfile.

Signed-off-by: shichangkuo <shi.changkuo@h3c.com>
 src/storage/storage_driver.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 254818e..8070d15 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -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);
         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;

     virObjectEventStateQueue(driver->storageEventState, event);

This e-mail and its attachments contain confidential information from New H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!

libvir-list mailing list