]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: qemumonitorjson: Test extraction of LUKS node names
authorPeter Krempa <pkrempa@redhat.com>
Thu, 27 Jul 2017 08:26:41 +0000 (10:26 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 27 Jul 2017 08:34:13 +0000 (10:34 +0200)
Test file created by:

qemu-img create -f luks /var/lib/libvirt/images/luks 10M \
        -o key-secret=asdf --object secret,id=asdf,format=raw,data=asdf

Used in libvirt as:
 <disk type='file' device='disk'>
   <driver name='qemu' type='raw'/>
   <source file='/var/lib/libvirt/images/luks'/>
   <target dev='vda' bus='virtio'/>
   <encryption format='luks'>
     <secret type='passphrase' uuid='9b2c831a-fdb9-4c09-873c-1959580589e1'/>
   </encryption>
 </disk>

Reviewed-by: Eric Blake <eblake@redhat.com>
tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-blockstats.json [new file with mode: 0644]
tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json [new file with mode: 0644]
tests/qemumonitorjsondata/qemumonitorjson-nodename-luks.result [new file with mode: 0644]
tests/qemumonitorjsontest.c

diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-blockstats.json
new file mode 100644 (file)
index 0000000..6f971b2
--- /dev/null
@@ -0,0 +1,58 @@
+[
+    {
+      "device": "drive-virtio-disk0",
+      "parent": {
+        "stats": {
+          "flush_total_time_ns": 0,
+          "wr_highest_offset": 0,
+          "wr_total_time_ns": 0,
+          "failed_wr_operations": 0,
+          "failed_rd_operations": 0,
+          "wr_merged": 0,
+          "wr_bytes": 0,
+          "timed_stats": [
+
+          ],
+          "failed_flush_operations": 0,
+          "account_invalid": false,
+          "rd_total_time_ns": 0,
+          "flush_operations": 0,
+          "wr_operations": 0,
+          "rd_merged": 0,
+          "rd_bytes": 0,
+          "invalid_flush_operations": 0,
+          "account_failed": false,
+          "rd_operations": 0,
+          "invalid_wr_operations": 0,
+          "invalid_rd_operations": 0
+        },
+        "node-name": "#block033"
+      },
+      "stats": {
+        "flush_total_time_ns": 0,
+        "wr_highest_offset": 0,
+        "wr_total_time_ns": 0,
+        "failed_wr_operations": 0,
+        "failed_rd_operations": 0,
+        "wr_merged": 0,
+        "wr_bytes": 0,
+        "timed_stats": [
+
+        ],
+        "failed_flush_operations": 0,
+        "account_invalid": true,
+        "rd_total_time_ns": 89560,
+        "flush_operations": 0,
+        "wr_operations": 0,
+        "rd_merged": 0,
+        "rd_bytes": 512,
+        "invalid_flush_operations": 0,
+        "account_failed": true,
+        "idle_time_ns": 323120536984,
+        "rd_operations": 1,
+        "invalid_wr_operations": 0,
+        "invalid_rd_operations": 0
+      },
+      "node-name": "#block136"
+    }
+]
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json
new file mode 100644 (file)
index 0000000..8de6d6c
--- /dev/null
@@ -0,0 +1,109 @@
+[
+    {
+      "iops_rd": 0,
+      "detect_zeroes": "off",
+      "image": {
+        "virtual-size": 10485760,
+        "filename": "json:{\"driver\": \"luks\", \"file\": {\"driver\": \"file\", \"filename\": \"/var/lib/libvirt/images/luks\"}, \"key-secret\": \"virtio-disk0-luks-secret0\"}",
+        "format": "luks",
+        "actual-size": 262144,
+        "format-specific": {
+          "type": "luks",
+          "data": {
+            "ivgen-alg": "plain64",
+            "hash-alg": "sha256",
+            "cipher-alg": "aes-256",
+            "uuid": "687ef639-c687-40d3-a103-7b4bdaa6e74a",
+            "cipher-mode": "xts",
+            "slots": [
+              {
+                "active": true,
+                "iters": 1886334,
+                "key-offset": 4096,
+                "stripes": 4000
+              },
+              {
+                "active": false,
+                "key-offset": 262144
+              },
+              {
+                "active": false,
+                "key-offset": 520192
+              },
+              {
+                "active": false,
+                "key-offset": 778240
+              },
+              {
+                "active": false,
+                "key-offset": 1036288
+              },
+              {
+                "active": false,
+                "key-offset": 1294336
+              },
+              {
+                "active": false,
+                "key-offset": 1552384
+              },
+              {
+                "active": false,
+                "key-offset": 1810432
+              }
+            ],
+            "payload-offset": 2068480,
+            "master-key-iters": 484865
+          }
+        },
+        "encrypted": true,
+        "dirty-flag": false
+      },
+      "iops_wr": 0,
+      "ro": false,
+      "node-name": "#block136",
+      "backing_file_depth": 0,
+      "drv": "luks",
+      "iops": 0,
+      "bps_wr": 0,
+      "write_threshold": 0,
+      "encrypted": true,
+      "bps": 0,
+      "bps_rd": 0,
+      "cache": {
+        "no-flush": false,
+        "direct": false,
+        "writeback": true
+      },
+      "file": "json:{\"driver\": \"luks\", \"file\": {\"driver\": \"file\", \"filename\": \"/var/lib/libvirt/images/luks\"}, \"key-secret\": \"virtio-disk0-luks-secret0\"}",
+      "encryption_key_missing": false
+    },
+    {
+      "iops_rd": 0,
+      "detect_zeroes": "off",
+      "image": {
+        "virtual-size": 12554240,
+        "filename": "/var/lib/libvirt/images/luks",
+        "format": "file",
+        "actual-size": 262144,
+        "dirty-flag": false
+      },
+      "iops_wr": 0,
+      "ro": false,
+      "node-name": "#block033",
+      "backing_file_depth": 0,
+      "drv": "file",
+      "iops": 0,
+      "bps_wr": 0,
+      "write_threshold": 0,
+      "encrypted": false,
+      "bps": 0,
+      "bps_rd": 0,
+      "cache": {
+        "no-flush": false,
+        "direct": false,
+        "writeback": true
+      },
+      "file": "/var/lib/libvirt/images/luks",
+      "encryption_key_missing": false
+    }
+]
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks.result
new file mode 100644 (file)
index 0000000..6a6b375
--- /dev/null
@@ -0,0 +1,6 @@
+drive-virtio-disk0
+filename    : '/var/lib/libvirt/images/luks'
+format node : '#block136'
+format drv  : 'luks'
+storage node: '#block033'
+storage drv : 'file'
index 0601c118848b403337fee6fbf2f93782ac01405f..4d302f67a9fa86e47bb14475b386fa8793abe3ed 100644 (file)
@@ -2931,6 +2931,7 @@ mymain(void)
     DO_TEST_BLOCK_NODE_DETECT("relative");
     DO_TEST_BLOCK_NODE_DETECT("gluster");
     DO_TEST_BLOCK_NODE_DETECT("blockjob");
+    DO_TEST_BLOCK_NODE_DETECT("luks");
 
 #undef DO_TEST_BLOCK_NODE_DETECT