]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Parse and format 'backingStore' for disk <mirror>
authorPeter Krempa <pkrempa@redhat.com>
Wed, 13 Mar 2019 15:08:13 +0000 (16:08 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Apr 2019 09:58:09 +0000 (11:58 +0200)
When the block copy operation is started with a reused external file in
incremental mode libvirt will need to open and insert the backing chain
for that file into qemu (in -blockdev mode). This means that we'll need
to track the backing chain and metadata such as node names for the full
chain of <mirror>.

This patch invokes the full backing chain formatter and parser for
<mirror> so that the chain can be kept with <mirror>.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
tests/qemustatusxml2xmldata/blockjob-mirror-in.xml
tests/qemuxml2argvdata/disk-mirror.xml
tests/qemuxml2xmloutdata/disk-mirror-active.xml

index 1828e0795bd41a6e43a06d6dc025293473faf426..623ef28719df5e240f6a3d6bcce546354b143cc6 100644 (file)
           </choice>
         </attribute>
       </optional>
+      <ref name="diskBackingChain"/>
     </element>
   </define>
   <define name="diskAuth">
index cde19a8a52d767732ef58a702cb4a67531df4f5f..c38102a5103c59ac7feb984367cbd0c46433bc2c 100644 (file)
@@ -9349,6 +9349,8 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def,
         if (virDomainStorageSourceParse(mirrorNode, ctxt, def->mirror, flags,
                                         xmlopt) < 0)
             return -1;
+        if (virDomainDiskBackingStoreParse(ctxt, def->mirror, flags, xmlopt) < 0)
+            return -1;
     } else {
         /* For back-compat reasons, we handle a file name encoded as
          * attributes, even though we prefer modern output in the style of
@@ -24031,6 +24033,9 @@ virDomainDiskDefFormatMirror(virBufferPtr buf,
     if (virDomainDiskSourceFormat(&childBuf, disk->mirror, 0, false, flags, xmlopt) < 0)
         return -1;
 
+    if (virDomainDiskBackingStoreFormat(&childBuf, disk->mirror, xmlopt, flags) < 0)
+        return -1;
+
     if (virXMLFormatElement(buf, "mirror", &attrBuf, &childBuf) < 0)
         return -1;
 
index 32bde1ba66e1792b25ce4a740ee43e138a669f53..df23ac00aa5c84391b1fec5569f78098d3f20408 100644 (file)
@@ -65,6 +65,7 @@
         <mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'>
           <format type='qcow2'/>
           <source file='/tmp/copy.img'/>
+          <backingStore/>
         </mirror>
         <target dev='vda' bus='virtio'/>
         <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
         <mirror type='file' file='/tmp/logcopy.img' format='qcow2' job='copy' ready='abort'>
           <format type='qcow2'/>
           <source file='/tmp/logcopy.img'/>
+          <backingStore type='block' index='1'>
+            <format type='raw'/>
+            <source dev='/dev/HostVG/backing'>
+              <privateData>
+                <nodenames>
+                  <nodename type='storage' name='test-backing-storage'/>
+                  <nodename type='format' name='test-backing-format'/>
+                </nodenames>
+              </privateData>
+            </source>
+            <backingStore/>
+          </backingStore>
         </mirror>
         <target dev='vdb' bus='virtio'/>
         <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
index e89eee47edb4617612918b8e27510a278191426d..c1e6e94e3314884d6045a3de30f74d5f50291a8a 100644 (file)
@@ -36,6 +36,7 @@
       <mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'>
         <format type='qcow2'/>
         <source file='/tmp/copy.img'/>
+        <backingStore/>
       </mirror>
       <target dev='vda' bus='virtio'/>
     </disk>
       <mirror type='file' file='/tmp/logcopy.img' format='qcow2' job='copy' ready='abort'>
         <format type='qcow2'/>
         <source file='/tmp/logcopy.img'/>
+        <backingStore type='block' index='1'>
+          <format type='raw'/>
+          <source dev='/dev/HostVG/backing'/>
+          <backingStore/>
+        </backingStore>
       </mirror>
       <target dev='vdb' bus='virtio'/>
     </disk>
index d689eac6b854274db0ce9abf2735ebf2c1f26e89..32ffc647bec47964b869b5e6fad4895b48765348 100644 (file)
@@ -40,6 +40,7 @@
       <mirror type='file' file='/tmp/copy.img' format='qcow2' job='copy'>
         <format type='qcow2'/>
         <source file='/tmp/copy.img'/>
+        <backingStore/>
       </mirror>
       <target dev='vda' bus='virtio'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
       <mirror type='file' file='/tmp/logcopy.img' format='qcow2' job='copy' ready='abort'>
         <format type='qcow2'/>
         <source file='/tmp/logcopy.img'/>
+        <backingStore type='block' index='1'>
+          <format type='raw'/>
+          <source dev='/dev/HostVG/backing'/>
+          <backingStore/>
+        </backingStore>
       </mirror>
       <target dev='vdb' bus='virtio'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>