[libvirt] [PATCH 05/11] qemu: block: Use 'auto-read-only' instead of 'read-only' for backing chain

Peter Krempa pkrempa at redhat.com
Thu Jul 4 14:26:29 UTC 2019


To allow using -blockdev with blockjobs need to reopen files in
read-write mode when modifying the backing chain. To achieve this we
need to use 'auto-read-only' for the backing files rather than the
normal 'read-only' property. That way qemu knows that the files need to
be reopened.

Note that the format drivers (e.g. qcow2) are still opened with the
read-only property enabled when being a member of the backing chain
since they are supposed to be immutable unless a block job is started.

QEMU v4.0 allows also dynamic behaviour for auto-read-only which allows
us to use sVirt as we only grant write permissions to files when doing
a blockjob.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_block.c                         | 26 ++++++++++++++++---
 src/qemu/qemu_block.h                         |  6 +++--
 src/qemu/qemu_command.c                       |  4 +--
 src/qemu/qemu_migration.c                     |  4 ++-
 tests/qemublocktest.c                         |  7 ++---
 .../xml2json/block-raw-noopts.json            |  2 +-
 .../xml2json/block-raw-reservations.json      |  2 +-
 .../xml2json/dir-fat-cache.json               |  2 +-
 .../xml2json/dir-fat-floppy.json              |  2 +-
 .../xml2json/dir-fat-readonly.json            |  2 +-
 .../file-backing_basic-aio_threads.json       |  8 +++---
 .../file-backing_basic-cache-directsync.json  |  8 +++---
 .../file-backing_basic-cache-none.json        |  8 +++---
 .../file-backing_basic-cache-unsafe.json      |  8 +++---
 .../file-backing_basic-cache-writeback.json   |  8 +++---
 ...file-backing_basic-cache-writethrough.json |  8 +++---
 .../xml2json/file-backing_basic-detect.json   |  8 +++---
 .../xml2json/file-backing_basic-noopts.json   |  8 +++---
 .../file-backing_basic-unmap-detect.json      |  8 +++---
 .../file-backing_basic-unmap-ignore.json      |  8 +++---
 .../xml2json/file-backing_basic-unmap.json    |  8 +++---
 .../xml2json/file-bochs-noopts.json           |  2 +-
 .../xml2json/file-cloop-noopts.json           |  2 +-
 .../xml2json/file-dmg-noopts.json             |  2 +-
 .../xml2json/file-ploop-noopts.json           |  2 +-
 .../file-qcow2-backing-chain-encryption.json  |  4 +--
 .../file-qcow2-backing-chain-noopts.json      | 20 +++++++-------
 ...file-qcow2-backing-chain-unterminated.json |  4 +--
 .../xml2json/file-raw-aio_native.json         |  2 +-
 .../xml2json/file-raw-luks.json               |  2 +-
 .../xml2json/file-raw-noopts.json             |  2 +-
 .../xml2json/file-vdi-noopts.json             |  2 +-
 .../xml2json/file-vhd-noopts.json             |  2 +-
 .../xml2json/file-vpc-noopts.json             |  2 +-
 .../xml2json/network-nbd-tls.json             |  2 +-
 ...work-qcow2-backing-chain-cache-unsafe.json |  4 +--
 ...k-qcow2-backing-chain-encryption_auth.json |  4 +--
 .../qemu-ns.x86_64-4.0.0.args                 |  2 +-
 .../qemu-ns.x86_64-latest.args                |  2 +-
 39 files changed, 115 insertions(+), 92 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index c9e6af49c9..9abdac5ca3 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1027,6 +1027,7 @@ qemuBlockStorageSourceGetBlockdevGetCacheProps(virStorageSourcePtr src,
  * @src: disk source
  * @legacy: use legacy formatting of attributes (for -drive / old qemus)
  * @onlytarget: omit any data which does not identify the image itself
+ * @autoreadonly: Use the new auto-readonly feature in qemu
  *
  * Creates a JSON object describing the underlying storage or protocol of a
  * storage source. Returns NULL on error and reports an appropriate error message.
@@ -1034,11 +1035,23 @@ qemuBlockStorageSourceGetBlockdevGetCacheProps(virStorageSourcePtr src,
 virJSONValuePtr
 qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
                                       bool legacy,
-                                      bool onlytarget)
+                                      bool onlytarget,
+                                      bool autoreadonly)
 {
     int actualType = virStorageSourceGetActualType(src);
     VIR_AUTOPTR(virJSONValue) fileprops = NULL;
     const char *driver = NULL;
+    virTristateBool aro = VIR_TRISTATE_BOOL_ABSENT;
+    virTristateBool ro = VIR_TRISTATE_BOOL_ABSENT;
+
+    if (autoreadonly) {
+        aro = VIR_TRISTATE_BOOL_YES;
+    } else {
+        if (src->readonly)
+            ro = VIR_TRISTATE_BOOL_YES;
+        else
+            ro = VIR_TRISTATE_BOOL_NO;
+    }

     switch ((virStorageType)actualType) {
     case VIR_STORAGE_TYPE_BLOCK:
@@ -1142,7 +1155,8 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
                 return NULL;

             if (virJSONValueObjectAdd(fileprops,
-                                      "b:read-only", src->readonly,
+                                      "T:read-only", ro,
+                                      "T:auto-read-only", aro,
                                       "s:discard", "unmap",
                                       NULL) < 0)
                 return NULL;
@@ -1447,6 +1461,7 @@ qemuBlockStorageSourceAttachDataFree(qemuBlockStorageSourceAttachDataPtr data)
 /**
  * qemuBlockStorageSourceAttachPrepareBlockdev:
  * @src: storage source to prepare data from
+ * @autoreadonly: use 'auto-read-only' feature of qemu
  *
  * Creates a qemuBlockStorageSourceAttachData structure containing data to attach
  * @src to a VM using the blockdev-add approach. Note that this function only
@@ -1459,7 +1474,8 @@ qemuBlockStorageSourceAttachDataFree(qemuBlockStorageSourceAttachDataPtr data)
  * error is reported
  */
 qemuBlockStorageSourceAttachDataPtr
-qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src)
+qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src,
+                                            bool autoreadonly)
 {
     VIR_AUTOPTR(qemuBlockStorageSourceAttachData) data = NULL;

@@ -1467,7 +1483,9 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src)
         return NULL;

     if (!(data->formatProps = qemuBlockStorageSourceGetBlockdevProps(src)) ||
-        !(data->storageProps = qemuBlockStorageSourceGetBackendProps(src, false, false)))
+        !(data->storageProps = qemuBlockStorageSourceGetBackendProps(src, false,
+                                                                     false,
+                                                                     autoreadonly)))
         return NULL;

     data->storageNodeName = src->nodestorage;
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index 7b94f4f0ff..12ddfad2ac 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -59,7 +59,8 @@ qemuBlockStorageSourceSupportsConcurrentAccess(virStorageSourcePtr src);
 virJSONValuePtr
 qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
                                       bool legacy,
-                                      bool onlytarget);
+                                      bool onlytarget,
+                                      bool autoreadonly);

 virURIPtr
 qemuBlockStorageSourceGetURI(virStorageSourcePtr src);
@@ -106,7 +107,8 @@ VIR_DEFINE_AUTOPTR_FUNC(qemuBlockStorageSourceAttachData,
                         qemuBlockStorageSourceAttachDataFree);

 qemuBlockStorageSourceAttachDataPtr
-qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src);
+qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src,
+                                            bool autoreadonly);

 qemuBlockStorageSourceAttachDataPtr
 qemuBlockStorageSourceDetachPrepare(virStorageSourcePtr src,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b963fc7235..27f71ce0fa 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1610,7 +1610,7 @@ qemuDiskSourceGetProps(virStorageSourcePtr src)
     virJSONValuePtr props;
     virJSONValuePtr ret;

-    if (!(props = qemuBlockStorageSourceGetBackendProps(src, true, false)))
+    if (!(props = qemuBlockStorageSourceGetBackendProps(src, true, false, false)))
         return NULL;

     if (virJSONValueObjectCreate(&ret, "a:file", &props, NULL) < 0) {
@@ -11206,7 +11206,7 @@ qemuBuildStorageSourceChainAttachPrepareBlockdev(virStorageSourcePtr top,
         return NULL;

     for (n = top; virStorageSourceIsBacking(n); n = n->backingStore) {
-        if (!(elem = qemuBlockStorageSourceAttachPrepareBlockdev(n)))
+        if (!(elem = qemuBlockStorageSourceAttachPrepareBlockdev(n, true)))
             return NULL;

         if (qemuBuildStorageSourceAttachPrepareCommon(n, elem, qemuCaps) < 0)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2436f5051b..e71933446a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -830,7 +830,9 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver,
         virAsprintf(&copysrc->nodeformat, "migration-%s-format", disk->dst) < 0)
         goto cleanup;

-    if (!(data = qemuBlockStorageSourceAttachPrepareBlockdev(copysrc)))
+    /* Migration via blockdev-mirror was supported sooner than the auto-read-only
+     * feature was added to qemu */
+    if (!(data = qemuBlockStorageSourceAttachPrepareBlockdev(copysrc, false)))
         goto cleanup;

     if (qemuDomainObjEnterMonitorAsync(driver, vm,
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 161615f7f0..5c381d1e3b 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -67,7 +67,8 @@ testBackingXMLjsonXML(const void *args)
         return -1;
     }

-    if (!(backendprops = qemuBlockStorageSourceGetBackendProps(xmlsrc, true, false))) {
+    if (!(backendprops = qemuBlockStorageSourceGetBackendProps(xmlsrc, true, false,
+                                                               false))) {
         fprintf(stderr, "failed to format disk source json\n");
         return -1;
     }
@@ -222,8 +223,8 @@ testQemuDiskXMLToProps(const void *opaque)
             goto cleanup;

         if (!(formatProps = qemuBlockStorageSourceGetBlockdevProps(n)) ||
-            !(storageSrcOnlyProps = qemuBlockStorageSourceGetBackendProps(n, false, true)) ||
-            !(storageProps = qemuBlockStorageSourceGetBackendProps(n, false, false))) {
+            !(storageSrcOnlyProps = qemuBlockStorageSourceGetBackendProps(n, false, true, true)) ||
+            !(storageProps = qemuBlockStorageSourceGetBackendProps(n, false, false, true))) {
             if (!data->fail) {
                 VIR_TEST_VERBOSE("failed to generate qemu blockdev props\n");
                 goto cleanup;
diff --git a/tests/qemublocktestdata/xml2json/block-raw-noopts.json b/tests/qemublocktestdata/xml2json/block-raw-noopts.json
index f223659c76..fa8b29a1f9 100644
--- a/tests/qemublocktestdata/xml2json/block-raw-noopts.json
+++ b/tests/qemublocktestdata/xml2json/block-raw-noopts.json
@@ -8,6 +8,6 @@
   "driver": "host_device",
   "filename": "/dev/blah",
   "node-name": "0123456789ABCDEF0123456789ABCDE",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/block-raw-reservations.json b/tests/qemublocktestdata/xml2json/block-raw-reservations.json
index 2fb106d673..970723279d 100644
--- a/tests/qemublocktestdata/xml2json/block-raw-reservations.json
+++ b/tests/qemublocktestdata/xml2json/block-raw-reservations.json
@@ -9,6 +9,6 @@
   "filename": "/dev/blah",
   "pr-manager": "node-a-st-pr-alias",
   "node-name": "node-a-st",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/dir-fat-cache.json b/tests/qemublocktestdata/xml2json/dir-fat-cache.json
index ef33add681..2a24175ef4 100644
--- a/tests/qemublocktestdata/xml2json/dir-fat-cache.json
+++ b/tests/qemublocktestdata/xml2json/dir-fat-cache.json
@@ -18,6 +18,6 @@
     "direct": true,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/dir-fat-floppy.json b/tests/qemublocktestdata/xml2json/dir-fat-floppy.json
index db7954a6bc..3b4accb8ef 100644
--- a/tests/qemublocktestdata/xml2json/dir-fat-floppy.json
+++ b/tests/qemublocktestdata/xml2json/dir-fat-floppy.json
@@ -10,6 +10,6 @@
   "floppy": true,
   "rw": false,
   "node-name": "node-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/dir-fat-readonly.json b/tests/qemublocktestdata/xml2json/dir-fat-readonly.json
index a306fb4d47..986e3a3ffd 100644
--- a/tests/qemublocktestdata/xml2json/dir-fat-readonly.json
+++ b/tests/qemublocktestdata/xml2json/dir-fat-readonly.json
@@ -10,6 +10,6 @@
   "floppy": false,
   "rw": false,
   "node-name": "node-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json
index a9bdd1bcc2..e77421d372 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json
@@ -10,7 +10,7 @@
   "filename": "/var/lib/libvirt/images/a",
   "aio": "threads",
   "node-name": "node-a-s",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -25,7 +25,7 @@
   "filename": "/var/lib/libvirt/images/b",
   "aio": "threads",
   "node-name": "node-b-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -47,7 +47,7 @@
     }
   ],
   "node-name": "node-c-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -61,6 +61,6 @@
   "filename": "/var/lib/libvirt/images/d",
   "aio": "threads",
   "node-name": "node-d-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.json
index 18cd183cd8..1d5ae09813 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-directsync.json
@@ -17,7 +17,7 @@
     "direct": true,
     "no-flush": false
   },
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -39,7 +39,7 @@
     "direct": true,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -69,7 +69,7 @@
     "direct": true,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -90,6 +90,6 @@
     "direct": true,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json
index 18cd183cd8..1d5ae09813 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-none.json
@@ -17,7 +17,7 @@
     "direct": true,
     "no-flush": false
   },
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -39,7 +39,7 @@
     "direct": true,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -69,7 +69,7 @@
     "direct": true,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -90,6 +90,6 @@
     "direct": true,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json
index 4e92061c65..4afd7366cf 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-unsafe.json
@@ -17,7 +17,7 @@
     "direct": false,
     "no-flush": true
   },
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -39,7 +39,7 @@
     "direct": false,
     "no-flush": true
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -69,7 +69,7 @@
     "direct": false,
     "no-flush": true
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -90,6 +90,6 @@
     "direct": false,
     "no-flush": true
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.json
index a105b47483..9ed806eb04 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writeback.json
@@ -17,7 +17,7 @@
     "direct": false,
     "no-flush": false
   },
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -39,7 +39,7 @@
     "direct": false,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -69,7 +69,7 @@
     "direct": false,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -90,6 +90,6 @@
     "direct": false,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethrough.json b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethrough.json
index a105b47483..9ed806eb04 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethrough.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-cache-writethrough.json
@@ -17,7 +17,7 @@
     "direct": false,
     "no-flush": false
   },
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -39,7 +39,7 @@
     "direct": false,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -69,7 +69,7 @@
     "direct": false,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -90,6 +90,6 @@
     "direct": false,
     "no-flush": false
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json
index 44a6e90fcd..6be2df9d1d 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json
@@ -10,7 +10,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/a",
   "node-name": "node-a-s",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -24,7 +24,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/b",
   "node-name": "node-b-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -46,7 +46,7 @@
     }
   ],
   "node-name": "node-c-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -59,6 +59,6 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/d",
   "node-name": "node-d-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json
index b0fd9b6988..5916347b93 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json
@@ -9,7 +9,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/a",
   "node-name": "node-a-s",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -23,7 +23,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/b",
   "node-name": "node-b-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -37,7 +37,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/c",
   "node-name": "node-c-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -50,6 +50,6 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/d",
   "node-name": "node-d-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json
index 6cf4e77090..27e6e5ab60 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json
@@ -11,7 +11,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/a",
   "node-name": "node-a-s",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -26,7 +26,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/b",
   "node-name": "node-b-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -49,7 +49,7 @@
     }
   ],
   "node-name": "node-c-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -63,6 +63,6 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/d",
   "node-name": "node-d-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json
index b6e454297f..63c5cd2799 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json
@@ -11,7 +11,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/a",
   "node-name": "node-a-s",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -26,7 +26,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/b",
   "node-name": "node-b-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -49,7 +49,7 @@
     }
   ],
   "node-name": "node-c-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -63,6 +63,6 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/d",
   "node-name": "node-d-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json
index 21a10c8543..ac952c8acd 100644
--- a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json
@@ -10,7 +10,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/a",
   "node-name": "node-a-s",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -25,7 +25,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/b",
   "node-name": "node-b-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -48,7 +48,7 @@
     }
   ],
   "node-name": "node-c-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -62,6 +62,6 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/d",
   "node-name": "node-d-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-bochs-noopts.json b/tests/qemublocktestdata/xml2json/file-bochs-noopts.json
index 6ab43b2a1c..3692820436 100644
--- a/tests/qemublocktestdata/xml2json/file-bochs-noopts.json
+++ b/tests/qemublocktestdata/xml2json/file-bochs-noopts.json
@@ -8,6 +8,6 @@
   "driver": "file",
   "filename": "/path/to/i.img",
   "node-name": "test2",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-cloop-noopts.json b/tests/qemublocktestdata/xml2json/file-cloop-noopts.json
index f709c3d3bd..7ae8b5ca5f 100644
--- a/tests/qemublocktestdata/xml2json/file-cloop-noopts.json
+++ b/tests/qemublocktestdata/xml2json/file-cloop-noopts.json
@@ -8,6 +8,6 @@
   "driver": "file",
   "filename": "/path/to/i.img",
   "node-name": "test2",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-dmg-noopts.json b/tests/qemublocktestdata/xml2json/file-dmg-noopts.json
index 55261de4b2..db722a55cc 100644
--- a/tests/qemublocktestdata/xml2json/file-dmg-noopts.json
+++ b/tests/qemublocktestdata/xml2json/file-dmg-noopts.json
@@ -8,6 +8,6 @@
   "driver": "file",
   "filename": "/path/to/i.img",
   "node-name": "test2",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-ploop-noopts.json b/tests/qemublocktestdata/xml2json/file-ploop-noopts.json
index 81fa263098..7817b0980e 100644
--- a/tests/qemublocktestdata/xml2json/file-ploop-noopts.json
+++ b/tests/qemublocktestdata/xml2json/file-ploop-noopts.json
@@ -8,6 +8,6 @@
   "driver": "file",
   "filename": "/path/to/i.img",
   "node-name": "test2",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.json
index 376fce9f9e..57f1f61c05 100644
--- a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.json
+++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.json
@@ -13,7 +13,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/a",
   "node-name": "node-a-s",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -31,6 +31,6 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/b",
   "node-name": "node-b-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json
index 6bc6e2fe30..197ee2a4b6 100644
--- a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json
+++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json
@@ -9,7 +9,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1507297895",
   "node-name": "#block004",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -23,7 +23,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1484071872",
   "node-name": "#block256",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -37,7 +37,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1483615252",
   "node-name": "#block418",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -51,7 +51,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1483605924",
   "node-name": "#block624",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -65,7 +65,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1483605920",
   "node-name": "#block869",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -79,7 +79,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1483546244",
   "node-name": "#block1047",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -93,7 +93,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1483545901",
   "node-name": "#block1279",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -107,7 +107,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1483545313",
   "node-name": "#block1444",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -121,7 +121,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1483536402",
   "node-name": "#block1602",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -135,6 +135,6 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.qcow2",
   "node-name": "#block1864",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.json
index 454c07faec..3ffefa831c 100644
--- a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.json
+++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.json
@@ -9,7 +9,7 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1507297895",
   "node-name": "#block004",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -22,6 +22,6 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/rhel7.3.1484071872",
   "node-name": "#block256",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-raw-aio_native.json b/tests/qemublocktestdata/xml2json/file-raw-aio_native.json
index 4e63561311..1ae76895cd 100644
--- a/tests/qemublocktestdata/xml2json/file-raw-aio_native.json
+++ b/tests/qemublocktestdata/xml2json/file-raw-aio_native.json
@@ -17,6 +17,6 @@
     "direct": true,
     "no-flush": false
   },
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-raw-luks.json b/tests/qemublocktestdata/xml2json/file-raw-luks.json
index c26dd3bba5..e4ed61db07 100644
--- a/tests/qemublocktestdata/xml2json/file-raw-luks.json
+++ b/tests/qemublocktestdata/xml2json/file-raw-luks.json
@@ -9,6 +9,6 @@
   "driver": "file",
   "filename": "/path/luks.img",
   "node-name": "test2",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-raw-noopts.json b/tests/qemublocktestdata/xml2json/file-raw-noopts.json
index cace1f6448..01160c8253 100644
--- a/tests/qemublocktestdata/xml2json/file-raw-noopts.json
+++ b/tests/qemublocktestdata/xml2json/file-raw-noopts.json
@@ -8,6 +8,6 @@
   "driver": "file",
   "filename": "/var/lib/libvirt/images/i.img",
   "node-name": "0123456789ABCDEF0123456789ABCDE",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-vdi-noopts.json b/tests/qemublocktestdata/xml2json/file-vdi-noopts.json
index 15f9da2091..5d4d6dfe5a 100644
--- a/tests/qemublocktestdata/xml2json/file-vdi-noopts.json
+++ b/tests/qemublocktestdata/xml2json/file-vdi-noopts.json
@@ -8,6 +8,6 @@
   "driver": "file",
   "filename": "/path/to/i.img",
   "node-name": "test2",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-vhd-noopts.json b/tests/qemublocktestdata/xml2json/file-vhd-noopts.json
index ce96c4be8a..6c810d2036 100644
--- a/tests/qemublocktestdata/xml2json/file-vhd-noopts.json
+++ b/tests/qemublocktestdata/xml2json/file-vhd-noopts.json
@@ -8,6 +8,6 @@
   "driver": "file",
   "filename": "/path/to/i.img",
   "node-name": "test2",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/file-vpc-noopts.json b/tests/qemublocktestdata/xml2json/file-vpc-noopts.json
index 9cba99e567..69b8102cf4 100644
--- a/tests/qemublocktestdata/xml2json/file-vpc-noopts.json
+++ b/tests/qemublocktestdata/xml2json/file-vpc-noopts.json
@@ -8,6 +8,6 @@
   "driver": "file",
   "filename": "/path/to/i.img",
   "node-name": "test2",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/network-nbd-tls.json b/tests/qemublocktestdata/xml2json/network-nbd-tls.json
index a1529a6c44..0dc453fb7e 100644
--- a/tests/qemublocktestdata/xml2json/network-nbd-tls.json
+++ b/tests/qemublocktestdata/xml2json/network-nbd-tls.json
@@ -14,6 +14,6 @@
   },
   "tls-creds": "node-a-s-tls0",
   "node-name": "node-a-s",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe.json b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe.json
index e66f62d24b..9ee18dba51 100644
--- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe.json
+++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe.json
@@ -34,7 +34,7 @@
     "direct": false,
     "no-flush": true
   },
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -59,6 +59,6 @@
     "direct": false,
     "no-flush": true
   },
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth.json b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth.json
index 921cb3ea69..fb19641982 100644
--- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth.json
+++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth.json
@@ -30,7 +30,7 @@
   ],
   "key-secret": "node-a-s-secalias",
   "node-name": "node-a-s",
-  "read-only": false,
+  "auto-read-only": true,
   "discard": "unmap"
 }
 {
@@ -53,6 +53,6 @@
   "user": "testuser-iscsi",
   "password-secret": "node-b-s-secalias",
   "node-name": "node-b-s",
-  "read-only": true,
+  "auto-read-only": true,
   "discard": "unmap"
 }
diff --git a/tests/qemuxml2argvdata/qemu-ns.x86_64-4.0.0.args b/tests/qemuxml2argvdata/qemu-ns.x86_64-4.0.0.args
index 6e059d336a..2f49af885b 100644
--- a/tests/qemuxml2argvdata/qemu-ns.x86_64-4.0.0.args
+++ b/tests/qemuxml2argvdata/qemu-ns.x86_64-4.0.0.args
@@ -30,7 +30,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -boot strict=on \
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1",\
-"node-name":"libvirt-1-storage","read-only":false,"discard":"unmap"}' \
+"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw",\
 "file":"libvirt-1-storage"}' \
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
diff --git a/tests/qemuxml2argvdata/qemu-ns.x86_64-latest.args b/tests/qemuxml2argvdata/qemu-ns.x86_64-latest.args
index ebb7b0da37..f898ab2e07 100644
--- a/tests/qemuxml2argvdata/qemu-ns.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/qemu-ns.x86_64-latest.args
@@ -30,7 +30,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 -boot strict=on \
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1",\
-"node-name":"libvirt-1-storage","read-only":false,"discard":"unmap"}' \
+"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw",\
 "file":"libvirt-1-storage"}' \
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
-- 
2.21.0




More information about the libvir-list mailing list