From: Peter Krempa <pkre...@redhat.com>

The 'data_file_raw' flag of qcow2 notifies that all data inside the
'data_file' is a raw image so can be used standalone without the
metadata without any problem (except for not updating the dirty
bitmaps).

Our migration safety checks will allow skipping the migration safety
check for these files as during migration we know it's safe to re-create
this on the destination in a location that isn't shared.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/qemu/qemu_monitor.h                       | 3 +++
 src/qemu/qemu_monitor_json.c                  | 3 +++
 tests/qemublocktest.c                         | 2 ++
 tests/qemublocktestdata/bitmap/synthetic.json | 1 +
 tests/qemublocktestdata/bitmap/synthetic.out  | 1 +
 5 files changed, 10 insertions(+)

diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 750e7444fc..8ef85ceb0a 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -748,6 +748,9 @@ struct _qemuBlockNamedNodeData {

     /* qcow2 subcluster allocation -> extended_l2 */
     bool qcow2extendedL2;
+
+    /* qcow2 data file 'raw' feature is enabled */
+    bool qcow2dataFileRaw;
 };

 GHashTable *
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 2c8ae5198c..9caade7bc9 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2775,6 +2775,9 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos 
G_GNUC_UNUSED,

             ignore_value(virJSONValueObjectGetBoolean(qcow2props, 
"extended-l2",
                                                       &ent->qcow2extendedL2));
+
+            ignore_value(virJSONValueObjectGetBoolean(qcow2props, 
"data-file-raw",
+                                                      &ent->qcow2dataFileRaw));
         }
     }

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 095a54e22c..47746207cc 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -589,6 +589,8 @@ testQemuDetectBitmapsWorker(GHashTable *nodedata,
     virBufferAsprintf(buf, "%s:\n", nodename);
     if (data->qcow2v2)
         virBufferAddLit(buf, " qcow2 v2\n");
+    if (data->qcow2dataFileRaw)
+        virBufferAddLit(buf, " data-file-raw\n");
     virBufferAdjustIndent(buf, 1);

     for (i = 0; i < data->nbitmaps; i++) {
diff --git a/tests/qemublocktestdata/bitmap/synthetic.json 
b/tests/qemublocktestdata/bitmap/synthetic.json
index cd468a42a2..1753830f69 100644
--- a/tests/qemublocktestdata/bitmap/synthetic.json
+++ b/tests/qemublocktestdata/bitmap/synthetic.json
@@ -15,6 +15,7 @@
           "compat": "0.10",
           "compression-type": "zlib",
           "lazy-refcounts": false,
+          "data-file-raw": true,
           "bitmaps": [
             {
               "flags": [
diff --git a/tests/qemublocktestdata/bitmap/synthetic.out 
b/tests/qemublocktestdata/bitmap/synthetic.out
index 2d9545fc9b..45423903a0 100644
--- a/tests/qemublocktestdata/bitmap/synthetic.out
+++ b/tests/qemublocktestdata/bitmap/synthetic.out
@@ -1,5 +1,6 @@
 libvirt-1-format:
  qcow2 v2
+ data-file-raw
   current: record:1 busy:0 persist:1 inconsist:1 gran:65536 dirty:0
    top-ok: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
  top-inactive: record:0 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
-- 
2.51.0

Reply via email to