Patchwork [23/24] allow if=none for drive_add

login
register
mail settings
Submitter Gerd Hoffmann
Date Sept. 25, 2009, 7:42 p.m.
Message ID <1253907769-1067-24-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/34296/
State Superseded
Headers show

Comments

Gerd Hoffmann - Sept. 25, 2009, 7:42 p.m.
Allow adding unconnected host drives by specifying if=none like it is
possible with -drive.  They can be put in use with drive attributes,
like this:

  drive_add dummy if=none,id=mydisk,file=/some/disk.img
  device_add virtio-blk-pci,drive=mydisk

which is the monitor aequivalent to these command line switches:

  -drive if=none,id=mydisk,file=/some/disk.img
  -device virtio-blk-pci,drive=mydisk

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/pci-hotplug.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index 562b6b8..3924419 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -87,6 +87,9 @@  void drive_hot_add(Monitor *mon, const QDict *qdict)
                        dinfo->bus,
                        dinfo->unit);
         break;
+    case IF_NONE:
+        monitor_printf(mon, "OK\n");
+        break;
     default:
         monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
         goto err;