9ae3a8
From c8fa26b697c9ca4fc90909e9c93471ea8b616c76 Mon Sep 17 00:00:00 2001
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Date: Wed, 17 Jul 2013 14:45:34 +0200
9ae3a8
Subject: [PATCH 32/38] qcow2: Use dashes instead of underscores in options
9ae3a8
9ae3a8
Message-id: <1378736903-18489-33-git-send-email-kwolf@redhat.com>
9ae3a8
Patchwork-id: 54219
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH 32/32] qcow2: Use dashes instead of underscores in options
9ae3a8
Bugzilla: 1005818
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Bugzilla: 1005818
9ae3a8
9ae3a8
This is what QMP wants to use. The options haven't been enabled in any
9ae3a8
release yet, so we're still free to change them.
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
(cherry picked from commit 64aa99d3e0333dea73d7505190659a02ca909292)
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
---
9ae3a8
 block/qcow2.c              |    2 +-
9ae3a8
 block/qcow2.h              |    8 ++++----
9ae3a8
 tests/qemu-iotests/051     |   14 +++++++-------
9ae3a8
 tests/qemu-iotests/051.out |   30 +++++++++++++++---------------
9ae3a8
 4 files changed, 27 insertions(+), 27 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/qcow2.c b/block/qcow2.c
9ae3a8
index 9383990..abdc202 100644
9ae3a8
--- a/block/qcow2.c
9ae3a8
+++ b/block/qcow2.c
9ae3a8
@@ -291,7 +291,7 @@ static QemuOptsList qcow2_runtime_opts = {
9ae3a8
     .head = QTAILQ_HEAD_INITIALIZER(qcow2_runtime_opts.head),
9ae3a8
     .desc = {
9ae3a8
         {
9ae3a8
-            .name = "lazy_refcounts",
9ae3a8
+            .name = QCOW2_OPT_LAZY_REFCOUNTS,
9ae3a8
             .type = QEMU_OPT_BOOL,
9ae3a8
             .help = "Postpone refcount updates",
9ae3a8
         },
9ae3a8
diff --git a/block/qcow2.h b/block/qcow2.h
9ae3a8
index 3b2d5cd..dba9771 100644
9ae3a8
--- a/block/qcow2.h
9ae3a8
+++ b/block/qcow2.h
9ae3a8
@@ -59,10 +59,10 @@
9ae3a8
 #define DEFAULT_CLUSTER_SIZE 65536
9ae3a8
 
9ae3a8
 
9ae3a8
-#define QCOW2_OPT_LAZY_REFCOUNTS "lazy_refcounts"
9ae3a8
-#define QCOW2_OPT_DISCARD_REQUEST "pass_discard_request"
9ae3a8
-#define QCOW2_OPT_DISCARD_SNAPSHOT "pass_discard_snapshot"
9ae3a8
-#define QCOW2_OPT_DISCARD_OTHER "pass_discard_other"
9ae3a8
+#define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"
9ae3a8
+#define QCOW2_OPT_DISCARD_REQUEST "pass-discard-request"
9ae3a8
+#define QCOW2_OPT_DISCARD_SNAPSHOT "pass-discard-snapshot"
9ae3a8
+#define QCOW2_OPT_DISCARD_OTHER "pass-discard-other"
9ae3a8
 
9ae3a8
 typedef struct QCowHeader {
9ae3a8
     uint32_t magic;
9ae3a8
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
9ae3a8
index 1cf8bf7..1f39c6a 100755
9ae3a8
--- a/tests/qemu-iotests/051
9ae3a8
+++ b/tests/qemu-iotests/051
9ae3a8
@@ -72,11 +72,11 @@ echo
9ae3a8
 echo === Enable and disable lazy refcounting on the command line, plus some invalid values ===
9ae3a8
 echo
9ae3a8
 
9ae3a8
-run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=on
9ae3a8
-run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=off
9ae3a8
-run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=
9ae3a8
-run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=42
9ae3a8
-run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=foo
9ae3a8
+run_qemu -drive file=$TEST_IMG,format=qcow2,lazy-refcounts=on
9ae3a8
+run_qemu -drive file=$TEST_IMG,format=qcow2,lazy-refcounts=off
9ae3a8
+run_qemu -drive file=$TEST_IMG,format=qcow2,lazy-refcounts=
9ae3a8
+run_qemu -drive file=$TEST_IMG,format=qcow2,lazy-refcounts=42
9ae3a8
+run_qemu -drive file=$TEST_IMG,format=qcow2,lazy-refcounts=foo
9ae3a8
 
9ae3a8
 
9ae3a8
 echo
9ae3a8
@@ -85,8 +85,8 @@ echo
9ae3a8
 
9ae3a8
 _make_test_img -ocompat=0.10 $size
9ae3a8
 
9ae3a8
-run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=on
9ae3a8
-run_qemu -drive file=$TEST_IMG,format=qcow2,lazy_refcounts=off
9ae3a8
+run_qemu -drive file=$TEST_IMG,format=qcow2,lazy-refcounts=on
9ae3a8
+run_qemu -drive file=$TEST_IMG,format=qcow2,lazy-refcounts=off
9ae3a8
 
9ae3a8
 echo
9ae3a8
 echo === No medium ===
9ae3a8
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
9ae3a8
index 8630382..9588d0c 100644
9ae3a8
--- a/tests/qemu-iotests/051.out
9ae3a8
+++ b/tests/qemu-iotests/051.out
9ae3a8
@@ -22,35 +22,35 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,unknown_opt=foo: could not
9ae3a8
 
9ae3a8
 === Enable and disable lazy refcounting on the command line, plus some invalid values ===
9ae3a8
 
9ae3a8
-Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=on
9ae3a8
+Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
9ae3a8
 QEMU 1.5.50 monitor - type 'help' for more information
9ae3a8
 (qemu) q?[K?[Dqu?[K?[D?[Dqui?[K?[D?[D?[Dquit?[K
9ae3a8
 
9ae3a8
-Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=off
9ae3a8
+Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
9ae3a8
 QEMU 1.5.50 monitor - type 'help' for more information
9ae3a8
 (qemu) q?[K?[Dqu?[K?[D?[Dqui?[K?[D?[D?[Dquit?[K
9ae3a8
 
9ae3a8
-Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=
9ae3a8
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=: Parameter 'lazy_refcounts' expects 'on' or 'off'
9ae3a8
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=: could not open disk image TEST_DIR/t.qcow2: Invalid argument
9ae3a8
+Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=
9ae3a8
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=: Parameter 'lazy-refcounts' expects 'on' or 'off'
9ae3a8
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=: could not open disk image TEST_DIR/t.qcow2: Invalid argument
9ae3a8
 
9ae3a8
-Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=42
9ae3a8
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=42: Parameter 'lazy_refcounts' expects 'on' or 'off'
9ae3a8
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=42: could not open disk image TEST_DIR/t.qcow2: Invalid argument
9ae3a8
+Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=42
9ae3a8
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=42: Parameter 'lazy-refcounts' expects 'on' or 'off'
9ae3a8
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=42: could not open disk image TEST_DIR/t.qcow2: Invalid argument
9ae3a8
 
9ae3a8
-Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=foo
9ae3a8
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=foo: Parameter 'lazy_refcounts' expects 'on' or 'off'
9ae3a8
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=foo: could not open disk image TEST_DIR/t.qcow2: Invalid argument
9ae3a8
+Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=foo
9ae3a8
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=foo: Parameter 'lazy-refcounts' expects 'on' or 'off'
9ae3a8
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=foo: could not open disk image TEST_DIR/t.qcow2: Invalid argument
9ae3a8
 
9ae3a8
 
9ae3a8
 === With version 2 images enabling lazy refcounts must fail ===
9ae3a8
 
9ae3a8
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 
9ae3a8
-Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=on
9ae3a8
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=on: Lazy refcounts require a qcow2 image with at least qemu 1.1 compatibility level
9ae3a8
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=on: could not open disk image TEST_DIR/t.qcow2: Invalid argument
9ae3a8
+Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
9ae3a8
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on: Lazy refcounts require a qcow2 image with at least qemu 1.1 compatibility level
9ae3a8
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on: could not open disk image TEST_DIR/t.qcow2: Invalid argument
9ae3a8
 
9ae3a8
-Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy_refcounts=off
9ae3a8
+Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
9ae3a8
 QEMU 1.5.50 monitor - type 'help' for more information
9ae3a8
 (qemu) q?[K?[Dqu?[K?[D?[Dqui?[K?[D?[D?[Dquit?[K
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8