On 2013年03月21日 19:53, 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<pbonz...@redhat.com>
---
  docs/formatdomain.html.in                          | 11 +++--
  src/qemu/qemu_command.c                            | 57 +++++++++++++++++++++-
  tests/qemuargv2xmltest.c                           |  1 +
  .../qemuxml2argv-disk-drive-network-gluster.args   |  2 +-
  .../qemuxml2argv-disk-drive-network-iscsi.args     |  1 +
  .../qemuxml2argv-disk-drive-network-iscsi.xml      |  7 +++
  ...ml2argv-disk-drive-network-nbd-ipv6-export.args |  2 +-
  .../qemuxml2argv-disk-drive-network-nbd-ipv6.args  |  2 +-
  tests/qemuxml2argvtest.c                           |  2 +
  9 files changed, 76 insertions(+), 9 deletions(-)
  create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi.args

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index e4ed3f7..f17b808 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1446,10 +1446,13 @@
          are "nbd", "iscsi", "rbd", "sheepdog" or "gluster".  If the
          <code>protocol</code>  attribute is "rbd", "sheepdog" or "gluster", an
          additional attribute<code>name</code>  is mandatory to specify which
-        volume/image will be used; for "nbd" it is optional.  When the disk
-<code>type</code>  is "network", the<code>source</code>  may have zero
-        or more<code>host</code>  sub-elements used to specify the hosts
-        to connect.
+        volume/image will be used; for "nbd" it is optional.  For "iscsi",
+        the<code>name</code>  attribute may include a logical unit number,
+        separated from the target's name by a slash (for example,
+<code>iqn.1992-01.com.example/1</code>); the default LUN is zero.
+        When the disk<code>type</code>  is "network", the<code>source</code>
+        may have zero or more<code>host</code>  sub-elements used to
+        specify the hosts to connect.
          <span class="since">Since 0.0.3;<code>type='dir'</code>  since
          0.7.5;<code>type='network'</code>  since
          0.8.7;<code>protocol='iscsi'</code>  since 1.0.4</span><br/>
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8626b62..4774650 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2391,6 +2391,31 @@ qemuParseGlusterString(virDomainDiskDefPtr def)
  }

  static int
+qemuParseISCSIString(virDomainDiskDefPtr def)
+{
+    virURIPtr uri = NULL;
+    char *slash;
+    unsigned lun;
+
+    if (!(uri = virURIParse(def->src)))
+        return -1;
+
+    if (uri->path&&
+        (slash = strchr(uri->path + 1, '/')) != NULL) {
+
+        if (slash[1] == '\0')
+            *slash = '\0';
+        else if (virStrToLong_ui(slash + 1, NULL, 10,&lun) == -1) {

Hm, we might need to change the helpers like virStrToLong_ui to accept
a NULL 4th argument to avoid the useless ("lun" here) variable. But
it doesn't relate with this patch.

Just small changes for the new "logical unit", previous ACK stands.

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

Reply via email to