render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
9119d9
From c3c7acfac6cdb9707675b7c64ad21e0cb926ebf1 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <c3c7acfac6cdb9707675b7c64ad21e0cb926ebf1@dist-git>
9119d9
From: John Ferlan <jferlan@redhat.com>
9119d9
Date: Thu, 18 Sep 2014 09:29:49 -0400
9119d9
Subject: [PATCH] virsh: Add iothread to 'attach-disk'
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1101574
9119d9
9119d9
Add an iothread parameter to allow attaching to an IOThread, such as:
9119d9
9119d9
virsh attach-disk $dom $source $target --live --config --iothread 2 \
9119d9
     --targetbus virtio --driver qemu --subdriver raw  --type disk
9119d9
9119d9
(cherry picked from commit bc5a8090afa84095634ccee1e1a6ca9a2a9b177a)
9119d9
Signed-off-by: John Ferlan <jferlan@redhat.com>
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 tools/virsh-domain.c | 13 ++++++++++---
9119d9
 tools/virsh.pod      |  5 ++++-
9119d9
 2 files changed, 14 insertions(+), 4 deletions(-)
9119d9
9119d9
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
9119d9
index 64a0f3d..f964856 100644
9119d9
--- a/tools/virsh-domain.c
9119d9
+++ b/tools/virsh-domain.c
9119d9
@@ -311,6 +311,10 @@ static const vshCmdOptDef opts_attach_disk[] = {
9119d9
      .type = VSH_OT_STRING,
9119d9
      .help = N_("subdriver of disk device")
9119d9
     },
9119d9
+    {.name = "iothread",
9119d9
+     .type = VSH_OT_STRING,
9119d9
+     .help = N_("IOThread to be used by supported device")
9119d9
+    },
9119d9
     {.name = "cache",
9119d9
      .type = VSH_OT_STRING,
9119d9
      .help = N_("cache mode of disk device")
9119d9
@@ -527,8 +531,8 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
9119d9
     virDomainPtr dom = NULL;
9119d9
     const char *source = NULL, *target = NULL, *driver = NULL,
9119d9
                 *subdriver = NULL, *type = NULL, *mode = NULL,
9119d9
-                *cache = NULL, *serial = NULL, *straddr = NULL,
9119d9
-                *wwn = NULL, *targetbus = NULL;
9119d9
+                *iothread = NULL, *cache = NULL, *serial = NULL,
9119d9
+                *straddr = NULL, *wwn = NULL, *targetbus = NULL;
9119d9
     struct DiskAddress diskAddr;
9119d9
     bool isFile = false, functionReturn = false;
9119d9
     int ret;
9119d9
@@ -558,6 +562,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
9119d9
         vshCommandOptStringReq(ctl, cmd, "subdriver", &subdriver) < 0 ||
9119d9
         vshCommandOptStringReq(ctl, cmd, "type", &type) < 0 ||
9119d9
         vshCommandOptStringReq(ctl, cmd, "mode", &mode) < 0 ||
9119d9
+        vshCommandOptStringReq(ctl, cmd, "iothread", &iothread) < 0 ||
9119d9
         vshCommandOptStringReq(ctl, cmd, "cache", &cache) < 0 ||
9119d9
         vshCommandOptStringReq(ctl, cmd, "serial", &serial) < 0 ||
9119d9
         vshCommandOptStringReq(ctl, cmd, "wwn", &wwn) < 0 ||
9119d9
@@ -601,13 +606,15 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
9119d9
     virBufferAddLit(&buf, ">\n");
9119d9
     virBufferAdjustIndent(&buf, 2);
9119d9
 
9119d9
-    if (driver || subdriver || cache) {
9119d9
+    if (driver || subdriver || iothread || cache) {
9119d9
         virBufferAddLit(&buf, "
9119d9
 
9119d9
         if (driver)
9119d9
             virBufferAsprintf(&buf, " name='%s'", driver);
9119d9
         if (subdriver)
9119d9
             virBufferAsprintf(&buf, " type='%s'", subdriver);
9119d9
+        if (iothread)
9119d9
+            virBufferAsprintf(&buf, " iothread='%s'", iothread);
9119d9
         if (cache)
9119d9
             virBufferAsprintf(&buf, " cache='%s'", cache);
9119d9
 
9119d9
diff --git a/tools/virsh.pod b/tools/virsh.pod
9119d9
index 5bdd264..0f5523f 100644
9119d9
--- a/tools/virsh.pod
9119d9
+++ b/tools/virsh.pod
9119d9
@@ -2221,7 +2221,8 @@ expected.
9119d9
 
9119d9
 =item B<attach-disk> I<domain> I<source> I<target> [[[I<--live>] [I<--config>]
9119d9
 | [I<--current>]] | [I<--persistent>]] [I<--targetbus bus>] [I<--driver
9119d9
-driver>] [I<--subdriver subdriver>] [I<--cache cache>] [I<--type type>]
9119d9
+driver>] [I<--subdriver subdriver>] [I<--iothread iothread>]
9119d9
+[I<--cache cache>] [I<--type type>]
9119d9
 [I<--mode mode>] [I<--sourcetype sourcetype>] [I<--serial serial>] [I<--wwn
9119d9
 wwn>] [I<--rawio>] [I<--address address>] [I<--multifunction>] [I<--print-xml>]
9119d9
 
9119d9
@@ -2248,6 +2249,8 @@ I<mode> can specify the two specific mode I<readonly> or I<shareable>.
9119d9
 I<sourcetype> can indicate the type of source (block|file)
9119d9
 I<cache> can be one of "default", "none", "writethrough", "writeback",
9119d9
 "directsync" or "unsafe".
9119d9
+I<iothread> is the number within the range of domain IOThreads to which
9119d9
+this disk may be attached (QEMU only).
9119d9
 I<serial> is the serial of disk device. I<wwn> is the wwn of disk device.
9119d9
 I<rawio> indicates the disk needs rawio capability.
9119d9
 I<address> is the address of disk device in the form of pci:domain.bus.slot.function,
9119d9
-- 
9119d9
2.1.0
9119d9