[libvirt] [PATCH 07/13] domain: add support for iscsi network disks

Paolo Bonzini pbonzini at redhat.com
Mon Feb 25 17:44:26 UTC 2013


This plumbs in the XML description of iSCSI shares.  The next patches
will add support for the libiscsi userspace initiator.

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 docs/formatdomain.html.in                          |  7 +++++-
 docs/schemas/domaincommon.rng                      |  1 +
 src/conf/domain_conf.c                             |  3 ++-
 src/conf/domain_conf.h                             |  1 +
 .../qemuxml2argv-disk-drive-network-iscsi.xml      | 27 ++++++++++++++++++++++
 tests/qemuxml2xmltest.c                            |  1 +
 6 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 094b509..fd6d5ae 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1438,7 +1438,7 @@
         to the directory to use as the disk. If the disk <code>type</code>
         is "network", then the <code>protocol</code> attribute specifies
         the protocol to access to the requested image; possible values
-        are "nbd", "rbd", "sheepdog" or "gluster".  If the
+        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
@@ -1698,6 +1698,11 @@
             <td> only one </td>
           </tr>
           <tr>
+            <td> iscsi </td>
+            <td> an iSCSI server </td>
+            <td> only one </td>
+          </tr>
+          <tr>
             <td> rbd </td>
             <td> monitor servers of RBD </td>
             <td> one or more </td>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 63be4aa..980410f 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1084,6 +1084,7 @@
                     <value>rbd</value>
                     <value>sheepdog</value>
                     <value>gluster</value>
+                    <value>iscsi</value>
                   </choice>
                 </attribute>
                 <optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0c75838..b42c79c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -235,7 +235,8 @@ VIR_ENUM_IMPL(virDomainDiskProtocol, VIR_DOMAIN_DISK_PROTOCOL_LAST,
               "nbd",
               "rbd",
               "sheepdog",
-              "gluster")
+              "gluster",
+              "iscsi")
 
 VIR_ENUM_IMPL(virDomainDiskProtocolTransport, VIR_DOMAIN_DISK_PROTO_TRANS_LAST,
               "tcp",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4ffa4aa..7cd0264 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -494,6 +494,7 @@ enum virDomainDiskProtocol {
     VIR_DOMAIN_DISK_PROTOCOL_RBD,
     VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG,
     VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
+    VIR_DOMAIN_DISK_PROTOCOL_ISCSI,
 
     VIR_DOMAIN_DISK_PROTOCOL_LAST
 };
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi.xml
new file mode 100644
index 0000000..dd85032
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-iscsi.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='network' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source protocol='iscsi' name='iqn.1992-01.com.example'>
+        <host name='example.org' port='6000'/>
+      </source>
+      <target dev='vda' bus='virtio'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 7a01954..e0d3b20 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -171,6 +171,7 @@ mymain(void)
     DO_TEST("disk-drive-network-nbd-ipv6");
     DO_TEST("disk-drive-network-nbd-ipv6-export");
     DO_TEST("disk-drive-network-nbd-unix");
+    DO_TEST("disk-drive-network-iscsi");
     DO_TEST("disk-scsi-device");
     DO_TEST("disk-scsi-vscsi");
     DO_TEST("disk-scsi-virtio-scsi");
-- 
1.8.1.2





More information about the libvir-list mailing list