Re: [PATCH 08/13] qemu: add support for libiscsi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013年02月26日 01:44, Paolo Bonzini wrote:
libiscsi provides a userspace iSCSI initiator.

The main advantage over the kernel initiator is that it is very
easy to provide different initiator names for VMs on the same host.
Thus libiscsi supports usage of persistent reservations in the VM,
which otherwise would only be possible with NPIV.

libiscsi uses "iscsi" as the scheme, not "iscsi+tcp".  We can change
this in the tests (while remaining backwards-compatible manner, because
QEMU uses TCP as the default transport for both Gluster and NBD).

Signed-off-by: Paolo Bonzini<pbonzini@xxxxxxxxxx>
---
  src/qemu/qemu_command.c                            | 49 +++++++++++++++++++++-
  tests/qemuargv2xmltest.c                           |  1 +
  .../qemuxml2argv-disk-drive-network-gluster.args   |  2 +-
  .../qemuxml2argv-disk-drive-network-iscsi.args     |  1 +
  ...ml2argv-disk-drive-network-nbd-ipv6-export.args |  2 +-
  .../qemuxml2argv-disk-drive-network-nbd-ipv6.args  |  2 +-
  tests/qemuxml2argvtest.c                           |  2 +
  7 files changed, 54 insertions(+), 5 deletions(-)
  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi.args

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 733d3bf..07700cc 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2145,6 +2145,23 @@ qemuParseGlusterString(virDomainDiskDefPtr def)
  }

  static int
+qemuParseISCSIString(virDomainDiskDefPtr def)
+{
+    virURIPtr uri = NULL;
+
+    if (!(uri = virURIParse(def->src)))
+        return -1;
+
+    if (uri->path&&  strchr(uri->path + 1, '/')) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("invalid address for iSCSI target"), disk->src);
+        return -1;
+    }
+
+    return qemuParseDriveURIString(def, uri, "iscsi");
+}
+
+static int
  qemuParseNBDString(virDomainDiskDefPtr disk)
  {
      virDomainDiskHostDefPtr h = NULL;
@@ -2238,8 +2255,14 @@ qemuBuildDriveURIString(virDomainDiskDefPtr disk, virBufferPtr opt,
      virBufferAddLit(opt, "file=");
      transp = virDomainDiskProtocolTransportTypeToString(disk->hosts->transport);

-    if (virAsprintf(&tmpscheme, "%s+%s", scheme, transp)<  0)
-        goto no_memory;
+    if (disk->hosts->transport == VIR_DOMAIN_DISK_PROTO_TRANS_TCP) {
+        tmpscheme = strdup(scheme);
+        if (tmpscheme == NULL)
+            goto no_memory;

Why not keeping the "+tcp" for Gluster and NBD instead? I'm afraid of
of relying on qemu's default. Can it be changed?

Osier

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]