[libvirt] [PATCH] Add "io" option to virsh attach-disk sub-command.

Gordon Messmer gordon at dragonsdawn.net
Sun May 7 20:27:29 UTC 2017


---
  tools/virsh-domain.c | 14 +++++++++++---
  tools/virsh.pod      |  2 ++
  2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0d19d0e..d2a2a05 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -267,6 +267,10 @@ static const vshCmdOptDef opts_attach_disk[] = {
       .type = VSH_OT_STRING,
       .help = N_("cache mode of disk device")
      },
+    {.name = "io",
+     .type = VSH_OT_STRING,
+     .help = N_("io mode of disk device")
+    },
      {.name = "type",
       .type = VSH_OT_STRING,
       .help = N_("target device type")
@@ -504,8 +508,9 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
      virDomainPtr dom = NULL;
      const char *source = NULL, *target = NULL, *driver = NULL,
                  *subdriver = NULL, *type = NULL, *mode = NULL,
-                *iothread = NULL, *cache = NULL, *serial = NULL,
-                *straddr = NULL, *wwn = NULL, *targetbus = NULL;
+                *iothread = NULL, *cache = NULL, *io = NULL,
+                *serial = NULL, *straddr = NULL, *wwn = NULL,
+                *targetbus = NULL;
      struct DiskAddress diskAddr;
      bool isFile = false, functionReturn = false;
      int ret;
@@ -537,6 +542,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
          vshCommandOptStringReq(ctl, cmd, "mode", &mode) < 0 ||
          vshCommandOptStringReq(ctl, cmd, "iothread", &iothread) < 0 ||
          vshCommandOptStringReq(ctl, cmd, "cache", &cache) < 0 ||
+        vshCommandOptStringReq(ctl, cmd, "io", &io) < 0 ||
          vshCommandOptStringReq(ctl, cmd, "serial", &serial) < 0 ||
          vshCommandOptStringReq(ctl, cmd, "wwn", &wwn) < 0 ||
          vshCommandOptStringReq(ctl, cmd, "address", &straddr) < 0 ||
@@ -579,7 +585,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
      virBufferAddLit(&buf, ">\n");
      virBufferAdjustIndent(&buf, 2);

-    if (driver || subdriver || iothread || cache) {
+    if (driver || subdriver || iothread || cache || io) {
          virBufferAddLit(&buf, "<driver");

          if (driver)
@@ -590,6 +596,8 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
              virBufferAsprintf(&buf, " iothread='%s'", iothread);
          if (cache)
              virBufferAsprintf(&buf, " cache='%s'", cache);
+        if (io)
+            virBufferAsprintf(&buf, " io='%s'", io);

          virBufferAddLit(&buf, "/>\n");
      }
diff --git a/tools/virsh.pod b/tools/virsh.pod
index cd1f25f..9656411 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2860,6 +2860,8 @@ I<mode> can specify the two specific mode 
I<readonly> or I<shareable>.
  I<sourcetype> can indicate the type of source (block|file)
  I<cache> can be one of "default", "none", "writethrough", "writeback",
  "directsync" or "unsafe".
+I<io> io is "threads", or "native" and selects between pthread based disk
+I/O and native Linux AIO.
  I<iothread> is the number within the range of domain IOThreads to which
  this disk may be attached (QEMU only).
  I<serial> is the serial of disk device. I<wwn> is the wwn of disk device.
-- 
2.9.3




More information about the libvir-list mailing list