On 04/02/2015 06:10 AM, Erik Skultety wrote:
Properly format storage pool state XML.
Your previous patch 3/7 had a better commit message:
Introduce virStoragePoolSaveStatus to properly format the status XML in
the same manner as virStoragePoolDefFormat, except for adding a
<poolstatus> ... </poolstatus> around the definition. This is similar to
virNetworkObjFormat used to save the live/active network information.
By itself - no it doesn't solve the bug (same for 4 and 5)
---
src/conf/storage_conf.c | 35 +++++++++++++++++++++++++++++++++++
src/conf/storage_conf.h | 4 +++-
src/libvirt_private.syms | 1 +
3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 73b937e..ee564f2 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1928,6 +1928,41 @@ static int virStoragePoolSaveXML(const char *path,
return ret;
}
+
+
+int virStoragePoolSaveState(const char *stateFile,
+ virStoragePoolDefPtr def)
Again it's
int
virStorage...
ACK with those adjustments.
John
FYI: Coverity is happy with all 6 patches...
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ int ret = -1;
+ char *xml;
+
+ virBufferAddLit(&buf, "<poolstatus>\n");
+ virBufferAdjustIndent(&buf, 2);
+
+ if (virStoragePoolDefFormatBuf(&buf, def) < 0)
+ goto error;
+
+ virBufferAdjustIndent(&buf, -2);
+ virBufferAddLit(&buf, "</poolstatus>\n");
+
+ if (virBufferCheckError(&buf) < 0)
+ goto error;
+
+ if (!(xml = virBufferContentAndReset(&buf)))
+ goto error;
+
+ if (virStoragePoolSaveXML(stateFile, def, xml))
+ goto error;
+
+ ret = 0;
+
+ error:
+ VIR_FREE(xml);
+ return ret;
+}
+
+
int
virStoragePoolSaveConfig(const char *configFile,
virStoragePoolDefPtr def)
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 4584075..da378b7 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -371,7 +371,9 @@ virStoragePoolObjPtr
virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
virStoragePoolDefPtr def);
-int virStoragePoolSaveConfig(const char *configDir,
+int virStoragePoolSaveState(const char *stateFile,
+ virStoragePoolDefPtr def);
+int virStoragePoolSaveConfig(const char *configFile,
virStoragePoolDefPtr def);
int virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
virStoragePoolObjPtr pool,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9e71b1a..56acb01 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -813,6 +813,7 @@ virStoragePoolObjRemove;
virStoragePoolObjSaveDef;
virStoragePoolObjUnlock;
virStoragePoolSaveConfig;
+virStoragePoolSaveState;
virStoragePoolSourceAdapterTypeFromString;
virStoragePoolSourceAdapterTypeToString;
virStoragePoolSourceClear;