[PATCH 31/34] conf: Add 'index' attribute for <disk><mirror><source>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Similarly to the disk source we need to keep the disk index (which is in
the qemu driver used for identification of the source for block jobs)
for the <mirror> element so that when it's replaced as a disk source
after pivoting all the allocated data is present.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_conf.c                          | 4 ++--
 tests/qemuxml2argvdata/disk-mirror.xml          | 4 ++--
 tests/qemuxml2xmloutdata/disk-mirror-active.xml | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 585b5515f9..2bb4d6eafc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9364,7 +9364,7 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def,
         if (!(def->mirror = virDomainStorageSourceParseFull("string(./@type)",
                                                             NULL,
                                                             "./source",
-                                                            NULL,
+                                                            "string(./source/@index)",
                                                             false, true, ctxt, flags, xmlopt)))
             return -1;

@@ -24130,7 +24130,7 @@ virDomainDiskDefFormatMirror(virBufferPtr buf,
     virBufferAddLit(buf, ">\n");
     virBufferAdjustIndent(buf, 2);
     virBufferEscapeString(buf, "<format type='%s'/>\n", formatStr);
-    if (virDomainDiskSourceFormat(buf, disk->mirror, 0, flags, true, false, true,
+    if (virDomainDiskSourceFormat(buf, disk->mirror, 0, flags, true, true, true,
                                   xmlopt) < 0)
         return -1;
     virBufferAdjustIndent(buf, -2);
diff --git a/tests/qemuxml2argvdata/disk-mirror.xml b/tests/qemuxml2argvdata/disk-mirror.xml
index c1e6e94e33..5a825c54ac 100644
--- a/tests/qemuxml2argvdata/disk-mirror.xml
+++ b/tests/qemuxml2argvdata/disk-mirror.xml
@@ -45,8 +45,8 @@
       <backingStore/>
       <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'>
+        <source file='/tmp/logcopy.img' index='1'/>
+        <backingStore type='block' index='2'>
           <format type='raw'/>
           <source dev='/dev/HostVG/backing'/>
           <backingStore/>
diff --git a/tests/qemuxml2xmloutdata/disk-mirror-active.xml b/tests/qemuxml2xmloutdata/disk-mirror-active.xml
index 32ffc647be..bebdb849c2 100644
--- a/tests/qemuxml2xmloutdata/disk-mirror-active.xml
+++ b/tests/qemuxml2xmloutdata/disk-mirror-active.xml
@@ -51,8 +51,8 @@
       <backingStore/>
       <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'>
+        <source file='/tmp/logcopy.img' index='1'/>
+        <backingStore type='block' index='2'>
           <format type='raw'/>
           <source dev='/dev/HostVG/backing'/>
           <backingStore/>
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux