[libvirt] [PATCH 1/2] conf: Format the "nocow" field.

John Ferlan jferlan at redhat.com
Wed Dec 7 15:31:50 UTC 2016


Commit id 'a9fd30e63' added a '<nocow/>' field to be parsed, but
didn't Format the field on output. This patch fixes that and adds
the vol-qcow2-nocow test to/for storagevolxml2xml

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/conf/storage_conf.c                        | 2 ++
 tests/storagevolxml2xmlout/vol-qcow2-nocow.xml | 1 +
 tests/storagevolxml2xmltest.c                  | 1 +
 3 files changed, 4 insertions(+)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7e7bb72..dc7cc25 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1590,6 +1590,8 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
             return -1;
 
     virBufferEscapeString(buf, "<compat>%s</compat>\n", def->compat);
+    if (def->nocow)
+        virBufferAddLit(buf, "<nocow/>\n");
 
     if (def->features) {
         size_t i;
diff --git a/tests/storagevolxml2xmlout/vol-qcow2-nocow.xml b/tests/storagevolxml2xmlout/vol-qcow2-nocow.xml
index 31dc578..a67f807 100644
--- a/tests/storagevolxml2xmlout/vol-qcow2-nocow.xml
+++ b/tests/storagevolxml2xmlout/vol-qcow2-nocow.xml
@@ -17,6 +17,7 @@
     <encryption format='qcow'>
       <secret type='passphrase' uuid='e78d4b51-a2af-485f-b0f5-afca709a80f4'/>
     </encryption>
+    <nocow/>
   </target>
   <backingStore>
     <path>/dev/null</path>
diff --git a/tests/storagevolxml2xmltest.c b/tests/storagevolxml2xmltest.c
index db82bea..5a0e096 100644
--- a/tests/storagevolxml2xmltest.c
+++ b/tests/storagevolxml2xmltest.c
@@ -115,6 +115,7 @@ mymain(void)
     DO_TEST("pool-gluster", "vol-gluster-dir-neg-uid");
     DO_TEST_FULL("pool-dir", "vol-qcow2-nocapacity",
                  VIR_VOL_XML_PARSE_NO_CAPACITY);
+    DO_TEST("pool-dir", "vol-qcow2-nocow");
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
2.7.4




More information about the libvir-list mailing list