yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
218e99
From f093ad3c94cae221641ea0dd13ec3cf666a0fccd Mon Sep 17 00:00:00 2001
218e99
From: Kevin Wolf <kwolf@redhat.com>
218e99
Date: Fri, 19 Jul 2013 20:07:29 +0200
218e99
Subject: [PATCH 30/38] blockdev: Rename 'readonly' option to 'read-only'
218e99
218e99
Message-id: <1378736903-18489-31-git-send-email-kwolf@redhat.com>
218e99
Patchwork-id: 54217
218e99
O-Subject: [RHEL-7.0 qemu-kvm PATCH 30/32] blockdev: Rename 'readonly' option to 'read-only'
218e99
Bugzilla: 1005818
218e99
RH-Acked-by: Fam Zheng <famz@redhat.com>
218e99
RH-Acked-by: Max Reitz <mreitz@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
Bugzilla: 1005818
218e99
218e99
Option name cleanup before it becomes a QMP API.
218e99
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
Reviewed-by: Eric Blake <eblake@redhat.com>
218e99
(cherry picked from commit 0f227a947004aa9043d4386f4a47d6739499b88f)
218e99
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
---
218e99
 blockdev.c                 |   10 ++++++----
218e99
 tests/qemu-iotests/051.out |    2 +-
218e99
 2 files changed, 7 insertions(+), 5 deletions(-)
218e99
218e99
diff --git a/blockdev.c b/blockdev.c
218e99
index 08b1aaf..5d4f2f8 100644
218e99
--- a/blockdev.c
218e99
+++ b/blockdev.c
218e99
@@ -378,7 +378,7 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
218e99
     secs  = qemu_opt_get_number(opts, "secs", 0);
218e99
 
218e99
     snapshot = qemu_opt_get_bool(opts, "snapshot", 0);
218e99
-    ro = qemu_opt_get_bool(opts, "readonly", 0);
218e99
+    ro = qemu_opt_get_bool(opts, "read-only", 0);
218e99
     copy_on_read = qemu_opt_get_bool(opts, "copy-on-read", false);
218e99
 
218e99
     file = qemu_opt_get(opts, "file");
218e99
@@ -684,7 +684,7 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
218e99
     } else if (ro == 1) {
218e99
         if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY &&
218e99
             type != IF_NONE && type != IF_PFLASH) {
218e99
-            error_report("readonly not supported by this bus type");
218e99
+            error_report("read-only not supported by this bus type");
218e99
             goto err;
218e99
         }
218e99
     }
218e99
@@ -692,7 +692,7 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
218e99
     bdrv_flags |= ro ? 0 : BDRV_O_RDWR;
218e99
 
218e99
     if (ro && copy_on_read) {
218e99
-        error_report("warning: disabling copy_on_read on readonly drive");
218e99
+        error_report("warning: disabling copy_on_read on read-only drive");
218e99
     }
218e99
 
218e99
     QINCREF(bs_opts);
218e99
@@ -749,6 +749,8 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
218e99
     qemu_opt_rename(all_opts, "bps_rd", "throttling.bps-read");
218e99
     qemu_opt_rename(all_opts, "bps_wr", "throttling.bps-write");
218e99
 
218e99
+    qemu_opt_rename(all_opts, "readonly", "read-only");
218e99
+
218e99
     return blockdev_init(all_opts, block_default_type);
218e99
 }
218e99
 
218e99
@@ -1701,7 +1703,7 @@ QemuOptsList qemu_common_drive_opts = {
218e99
             .type = QEMU_OPT_STRING,
218e99
             .help = "pci address (virtio only)",
218e99
         },{
218e99
-            .name = "readonly",
218e99
+            .name = "read-only",
218e99
             .type = QEMU_OPT_BOOL,
218e99
             .help = "open drive file as read-only",
218e99
         },{
218e99
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
218e99
index 95ff245..8630382 100644
218e99
--- a/tests/qemu-iotests/051.out
218e99
+++ b/tests/qemu-iotests/051.out
218e99
@@ -137,7 +137,7 @@ QEMU 1.5.50 monitor - type 'help' for more information
218e99
 (qemu) q?[K?[Dqu?[K?[D?[Dqui?[K?[D?[D?[Dquit?[K
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,if=ide,readonly=on
218e99
-QEMU_PROG: -drive file=TEST_DIR/t.qcow2,if=ide,readonly=on: readonly not supported by this bus type
218e99
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,if=ide,readonly=on: read-only not supported by this bus type
218e99
 
218e99
 Testing: -drive file=TEST_DIR/t.qcow2,if=virtio,readonly=on
218e99
 QEMU 1.5.50 monitor - type 'help' for more information
218e99
-- 
218e99
1.7.1
218e99