domain: add support for iscsi network disks

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@redhat.com>
This commit is contained in:
Paolo Bonzini 2013-02-25 18:44:26 +01:00 committed by Eric Blake
parent a67aebd699
commit 1d94891288
6 changed files with 40 additions and 3 deletions

View File

@ -1443,7 +1443,7 @@
to the directory to use as the disk. If the disk <code>type</code> to the directory to use as the disk. If the disk <code>type</code>
is "network", then the <code>protocol</code> attribute specifies is "network", then the <code>protocol</code> attribute specifies
the protocol to access to the requested image; possible values 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 <code>protocol</code> attribute is "rbd", "sheepdog" or "gluster", an
additional attribute <code>name</code> is mandatory to specify which additional attribute <code>name</code> is mandatory to specify which
volume/image will be used; for "nbd" it is optional. When the disk volume/image will be used; for "nbd" it is optional. When the disk
@ -1451,7 +1451,8 @@
or more <code>host</code> sub-elements used to specify the hosts or more <code>host</code> sub-elements used to specify the hosts
to connect. to connect.
<span class="since">Since 0.0.3; <code>type='dir'</code> since <span class="since">Since 0.0.3; <code>type='dir'</code> since
0.7.5; <code>type='network'</code> since 0.8.7</span><br/> 0.7.5; <code>type='network'</code> since
0.8.7; <code>protocol='iscsi'</code> since 1.0.4</span><br/>
For a "file" disk type which represents a cdrom or floppy For a "file" disk type which represents a cdrom or floppy
(the <code>device</code> attribute), it is possible to define (the <code>device</code> attribute), it is possible to define
policy what to do with the disk if the source file is not accessible. policy what to do with the disk if the source file is not accessible.
@ -1702,6 +1703,11 @@
<td> a server running nbd-server </td> <td> a server running nbd-server </td>
<td> only one </td> <td> only one </td>
</tr> </tr>
<tr>
<td> iscsi </td>
<td> an iSCSI server </td>
<td> only one </td>
</tr>
<tr> <tr>
<td> rbd </td> <td> rbd </td>
<td> monitor servers of RBD </td> <td> monitor servers of RBD </td>

View File

@ -1090,6 +1090,7 @@
<value>rbd</value> <value>rbd</value>
<value>sheepdog</value> <value>sheepdog</value>
<value>gluster</value> <value>gluster</value>
<value>iscsi</value>
</choice> </choice>
</attribute> </attribute>
<optional> <optional>

View File

@ -250,7 +250,8 @@ VIR_ENUM_IMPL(virDomainDiskProtocol, VIR_DOMAIN_DISK_PROTOCOL_LAST,
"nbd", "nbd",
"rbd", "rbd",
"sheepdog", "sheepdog",
"gluster") "gluster",
"iscsi")
VIR_ENUM_IMPL(virDomainDiskProtocolTransport, VIR_DOMAIN_DISK_PROTO_TRANS_LAST, VIR_ENUM_IMPL(virDomainDiskProtocolTransport, VIR_DOMAIN_DISK_PROTO_TRANS_LAST,
"tcp", "tcp",

View File

@ -500,6 +500,7 @@ enum virDomainDiskProtocol {
VIR_DOMAIN_DISK_PROTOCOL_RBD, VIR_DOMAIN_DISK_PROTOCOL_RBD,
VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG, VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG,
VIR_DOMAIN_DISK_PROTOCOL_GLUSTER, VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
VIR_DOMAIN_DISK_PROTOCOL_ISCSI,
VIR_DOMAIN_DISK_PROTOCOL_LAST VIR_DOMAIN_DISK_PROTOCOL_LAST
}; };

View File

@ -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>

View File

@ -174,6 +174,7 @@ mymain(void)
DO_TEST("disk-drive-network-nbd-ipv6"); DO_TEST("disk-drive-network-nbd-ipv6");
DO_TEST("disk-drive-network-nbd-ipv6-export"); DO_TEST("disk-drive-network-nbd-ipv6-export");
DO_TEST("disk-drive-network-nbd-unix"); DO_TEST("disk-drive-network-nbd-unix");
DO_TEST("disk-drive-network-iscsi");
DO_TEST("disk-scsi-device"); DO_TEST("disk-scsi-device");
DO_TEST("disk-scsi-vscsi"); DO_TEST("disk-scsi-vscsi");
DO_TEST("disk-scsi-virtio-scsi"); DO_TEST("disk-scsi-virtio-scsi");