mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
hostdev: Add iSCSI hostdev XML
Introduce a new structure to handle an iSCSI host device based on the existing virDomainHostdevSubsysSCSI by adding a "protocol='iscsi'" to the <source/> element. The existing scsi_host subsystem RNG was modified to read an optional "protocol='adapter'", although it won't be written out nor is it documented as an option (by choice). The new hostdev structure mimics the existing <disk/> element for an iSCSI device (network) device. New XML is: <hostdev mode='subsystem' type='scsi' managed='yes'> <source protocol='iscsi' name='iqn.1992-01.com.example'> <host name='example.org' port='3260'/> <auth username='myname'> <secret type='iscsi' usage='mycluster_myname'/> </auth> </source> <address type='drive' controller='0' bus='0' target='2' unit='5'/> </hostdev> The controller element will mimic the existing scsi_host code insomuch as when 'lsi' and 'virtio-scsi' are used.
This commit is contained in:
parent
c3f4942939
commit
54ac483e68
@ -2824,57 +2824,107 @@
|
|||||||
</devices>
|
</devices>
|
||||||
...</pre>
|
...</pre>
|
||||||
|
|
||||||
|
|
||||||
|
<p>or:</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
...
|
||||||
|
<devices>
|
||||||
|
<hostdev mode='subsystem' type='scsi'>
|
||||||
|
<source protocol='iscsi' name='iqn.2014-08.com.example:iscsi-nopool/1'>
|
||||||
|
<host name='example.com' port='3260'/>
|
||||||
|
<auth username='myuser'>
|
||||||
|
<secret type='iscsi' usage='libvirtiscsi'/>
|
||||||
|
</auth>
|
||||||
|
</source>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
|
</hostdev>
|
||||||
|
</devices>
|
||||||
|
...</pre>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>hostdev</code></dt>
|
<dt><code>hostdev</code></dt>
|
||||||
<dd>The <code>hostdev</code> element is the main container for describing
|
<dd>The <code>hostdev</code> element is the main container for describing
|
||||||
host devices. For usb device passthrough <code>mode</code> is always
|
host devices. For each device, the <code>mode</code> is always
|
||||||
"subsystem" and <code>type</code> is "usb" for a USB device, "pci"
|
"subsystem" and the <code>type</code> is one of the following values
|
||||||
for a PCI device and "scsi" for a SCSI device. When
|
with additional attributes noted.
|
||||||
<code>managed</code> is "yes" for a PCI
|
<dl>
|
||||||
device, it is detached from the host before being passed on to
|
<dt>usb</dt>
|
||||||
the guest, and reattached to the host after the guest exits.
|
<dd>For USB devices, the user is responsible to call
|
||||||
If <code>managed</code> is omitted or "no", and for USB
|
<code>virNodeDeviceDettach</code> (or
|
||||||
devices, the user is responsible to
|
<code>virsh nodedev-detach</code>) before starting the guest
|
||||||
call <code>virNodeDeviceDettach</code> (or <code>virsh
|
or hot-plugging the device and <code>virNodeDeviceReAttach</code>
|
||||||
nodedev-dettach</code>) before starting the guest or
|
(or <code>virsh nodedev-reattach</code>) after hot-unplug or
|
||||||
hot-plugging the device,
|
stopping the guest.
|
||||||
and <code>virNodeDeviceReAttach</code> (or <code>virsh
|
</dd>
|
||||||
nodedev-reattach</code>) after hot-unplug or stopping the
|
<dt>pci</dt>
|
||||||
guest. For SCSI device, user is responsible to make sure the device
|
<dd>For PCI devices, when <code>managed</code> is "yes" it is
|
||||||
is not used by host.
|
detached from the host before being passed on to the guest
|
||||||
The optional <code>sgio</code> (<span class="since">since 1.0.6</span>)
|
and reattached to the host after the guest exits. If
|
||||||
attribute indicates whether the kernel will filter unprivileged
|
<code>managed</code> is omitted or "no", follow the steps
|
||||||
SG_IO commands for the disk, valid settings are "filtered" or
|
described for a USB device to detach before starting the
|
||||||
"unfiltered". Defaults to "filtered".
|
guest or hot-plugging and reattach after stopping the guest
|
||||||
|
or hot-unplug.
|
||||||
|
</dd>
|
||||||
|
<dt>scsi</dt>
|
||||||
|
<dd>For SCSI devices, user is responsible to make sure the device
|
||||||
|
is not used by host. The optional <code>sgio</code>
|
||||||
|
(<span class="since">since 1.0.6</span>) attribute indicates
|
||||||
|
whether the kernel will filter unprivileged SG_IO commands for
|
||||||
|
the disk, valid settings are "filtered" or "unfiltered".
|
||||||
|
The default is "filtered".
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
</dd>
|
</dd>
|
||||||
<dt><code>source</code></dt>
|
<dt><code>source</code></dt>
|
||||||
<dd>The source element describes the device as seen from the host.
|
<dd>The source element describes the device as seen from the host using
|
||||||
The USB device can either be addressed by vendor / product id using the
|
the following mechanism to describe:
|
||||||
<code>vendor</code> and <code>product</code> elements or by the device's
|
<dl>
|
||||||
address on the hosts using the <code>address</code> element. PCI devices
|
<dt>usb</dt>
|
||||||
on the other hand can only be described by their <code>address</code>.
|
<dd>The USB device can either be addressed by vendor / product id
|
||||||
SCSI devices are described by both the <code>adapter</code> and
|
using the <code>vendor</code> and <code>product</code> elements
|
||||||
<code>address</code> elements.
|
or by the device's address on the host using the
|
||||||
|
<code>address</code> element.
|
||||||
<span class="since">Since 1.0.0</span>, the <code>source</code> element
|
<p>
|
||||||
of USB devices may contain <code>startupPolicy</code> attribute which can
|
<span class="since">Since 1.0.0</span>, the <code>source</code>
|
||||||
be used to define policy what to do if the specified host USB device is
|
element of USB devices may contain <code>startupPolicy</code>
|
||||||
not found. The attribute accepts the following values:
|
attribute which can be used to define policy what to do if the
|
||||||
<table class="top_table">
|
specified host USB device is not found. The attribute accepts
|
||||||
<tr>
|
the following values:
|
||||||
<td> mandatory </td>
|
</p>
|
||||||
<td> fail if missing for any reason (the default) </td>
|
<table class="top_table">
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td> mandatory </td>
|
||||||
<td> requisite </td>
|
<td> fail if missing for any reason (the default) </td>
|
||||||
<td> fail if missing on boot up,
|
</tr>
|
||||||
drop if missing on migrate/restore/revert </td>
|
<tr>
|
||||||
</tr>
|
<td> requisite </td>
|
||||||
<tr>
|
<td> fail if missing on boot up,
|
||||||
<td> optional </td>
|
drop if missing on migrate/restore/revert </td>
|
||||||
<td> drop if missing at any start attempt </td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
</table>
|
<td> optional </td>
|
||||||
|
<td> drop if missing at any start attempt </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</dd>
|
||||||
|
<dt>pci</dt>
|
||||||
|
<dd>PCI devices can only be described by their <code>address</code>.
|
||||||
|
</dd>
|
||||||
|
<dt>scsi</dt>
|
||||||
|
<dd>SCSI devices are described by both the <code>adapter</code>
|
||||||
|
and <code>address</code> elements.
|
||||||
|
<p>
|
||||||
|
<span class="since">Since 1.2.8</span>, the <code>source</code>
|
||||||
|
element of a SCSI device may contain the <code>protocol</code>
|
||||||
|
attribute. When the attribute is set to "iscsi", the host
|
||||||
|
device XML follows the network <a href="#elementsDisks">disk</a>
|
||||||
|
device using the same <code>name</code> attribute and optionally
|
||||||
|
using the <code>auth</code> element to provide the authentication
|
||||||
|
credentials to the iSCSI server.
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
</dd>
|
</dd>
|
||||||
<dt><code>vendor</code>, <code>product</code></dt>
|
<dt><code>vendor</code>, <code>product</code></dt>
|
||||||
<dd>The <code>vendor</code> and <code>product</code> elements each have an
|
<dd>The <code>vendor</code> and <code>product</code> elements each have an
|
||||||
@ -3589,7 +3639,7 @@
|
|||||||
before being passed on to the guest, and reattached to the host
|
before being passed on to the guest, and reattached to the host
|
||||||
after the guest exits. If <code>managed</code> is omitted or "no",
|
after the guest exits. If <code>managed</code> is omitted or "no",
|
||||||
the user is responsible to call <code>virNodeDeviceDettach</code>
|
the user is responsible to call <code>virNodeDeviceDettach</code>
|
||||||
(or <code>virsh nodedev-dettach</code>) before starting the guest
|
(or <code>virsh nodedev-detach</code>) before starting the guest
|
||||||
or hot-plugging the device, and <code>virNodeDeviceReAttach</code>
|
or hot-plugging the device, and <code>virNodeDeviceReAttach</code>
|
||||||
(or <code>virsh nodedev-reattach</code>) after hot-unplug or
|
(or <code>virsh nodedev-reattach</code>) after hot-unplug or
|
||||||
stopping the guest.
|
stopping the guest.
|
||||||
|
@ -3589,12 +3589,51 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
</optional>
|
</optional>
|
||||||
<element name="source">
|
<element name="source">
|
||||||
<interleave>
|
<choice>
|
||||||
<ref name="sourceinfoadapter"/>
|
<group> <!-- scsi_host adapter -->
|
||||||
<element name="address">
|
<optional>
|
||||||
<ref name="scsiaddress"/>
|
<attribute name="protocol">
|
||||||
</element>
|
<choice>
|
||||||
</interleave>
|
<value>adapter</value> <!-- scsi_host, default, optional -->
|
||||||
|
</choice>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
|
<interleave>
|
||||||
|
<ref name="sourceinfoadapter"/>
|
||||||
|
<element name="address">
|
||||||
|
<ref name="scsiaddress"/>
|
||||||
|
</element>
|
||||||
|
</interleave>
|
||||||
|
</group>
|
||||||
|
<group> <!-- iscsi adapter -->
|
||||||
|
<attribute name="protocol">
|
||||||
|
<choice>
|
||||||
|
<value>iscsi</value> <!-- iscsi, required -->
|
||||||
|
</choice>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name">
|
||||||
|
<text/>
|
||||||
|
</attribute>
|
||||||
|
<interleave>
|
||||||
|
<oneOrMore>
|
||||||
|
<element name='host'>
|
||||||
|
<attribute name='name'>
|
||||||
|
<text/>
|
||||||
|
</attribute>
|
||||||
|
<optional>
|
||||||
|
<attribute name='port'>
|
||||||
|
<ref name="PortNumber"/>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
|
<empty/>
|
||||||
|
</element>
|
||||||
|
</oneOrMore>
|
||||||
|
<optional>
|
||||||
|
<ref name='diskAuth'/>
|
||||||
|
</optional>
|
||||||
|
</interleave>
|
||||||
|
</group>
|
||||||
|
</choice>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
|
||||||
|
@ -597,6 +597,11 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysPCIBackend,
|
|||||||
"vfio",
|
"vfio",
|
||||||
"xen")
|
"xen")
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIProtocol,
|
||||||
|
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST,
|
||||||
|
"adapter",
|
||||||
|
"iscsi")
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
|
VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
|
||||||
"storage",
|
"storage",
|
||||||
"misc",
|
"misc",
|
||||||
@ -4212,11 +4217,97 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr sourcenode,
|
||||||
|
virDomainHostdevSubsysSCSIPtr def)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
int auth_secret_usage = -1;
|
||||||
|
xmlNodePtr cur;
|
||||||
|
virStorageAuthDefPtr authdef = NULL;
|
||||||
|
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &def->u.iscsi;
|
||||||
|
|
||||||
|
/* Similar to virDomainDiskSourceParse for a VIR_STORAGE_TYPE_NETWORK */
|
||||||
|
|
||||||
|
if (!(iscsisrc->path = virXMLPropString(sourcenode, "name"))) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
_("missing iSCSI hostdev source path name"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (virDomainStorageHostParse(sourcenode, &iscsisrc->hosts,
|
||||||
|
&iscsisrc->nhosts) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (iscsisrc->nhosts < 1) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
_("missing the host address for the iSCSI hostdev"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
if (iscsisrc->nhosts > 1) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
_("only one source host address may be specified "
|
||||||
|
"for the iSCSI hostdev"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = sourcenode->children;
|
||||||
|
while (cur != NULL) {
|
||||||
|
if (cur->type == XML_ELEMENT_NODE &&
|
||||||
|
xmlStrEqual(cur->name, BAD_CAST "auth")) {
|
||||||
|
if (!(authdef = virStorageAuthDefParse(sourcenode->doc, cur)))
|
||||||
|
goto cleanup;
|
||||||
|
if ((auth_secret_usage =
|
||||||
|
virSecretUsageTypeFromString(authdef->secrettype)) < 0) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("invalid secret type %s"),
|
||||||
|
authdef->secrettype);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
if (auth_secret_usage != VIR_SECRET_USAGE_TYPE_ISCSI) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("hostdev invalid secret type '%s'"),
|
||||||
|
authdef->secrettype);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
iscsisrc->auth = authdef;
|
||||||
|
authdef = NULL;
|
||||||
|
}
|
||||||
|
cur = cur->next;
|
||||||
|
}
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
virStorageAuthDefFree(authdef);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
|
virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
|
||||||
virDomainHostdevSubsysSCSIPtr scsisrc)
|
virDomainHostdevSubsysSCSIPtr scsisrc)
|
||||||
{
|
{
|
||||||
return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc);
|
char *protocol = NULL;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
if ((protocol = virXMLPropString(sourcenode, "protocol"))) {
|
||||||
|
scsisrc->protocol =
|
||||||
|
virDomainHostdevSubsysSCSIProtocolTypeFromString(protocol);
|
||||||
|
if (scsisrc->protocol < 0) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("Unknown SCSI subsystem protocol '%s'"),
|
||||||
|
protocol);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
|
||||||
|
ret = virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsisrc);
|
||||||
|
else
|
||||||
|
ret = virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
VIR_FREE(protocol);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if a drive type address $controller:0:0:$unit is already
|
/* Check if a drive type address $controller:0:0:$unit is already
|
||||||
@ -15761,6 +15852,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
|
|||||||
virDomainHostdevSubsysPCIPtr pcisrc = &def->source.subsys.u.pci;
|
virDomainHostdevSubsysPCIPtr pcisrc = &def->source.subsys.u.pci;
|
||||||
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
|
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
|
||||||
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
|
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
|
||||||
|
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
|
||||||
|
|
||||||
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
||||||
pcisrc->backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
|
pcisrc->backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
|
||||||
@ -15777,17 +15869,27 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
virBufferAddLit(buf, "<source");
|
virBufferAddLit(buf, "<source");
|
||||||
if (def->startupPolicy) {
|
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
|
||||||
const char *policy;
|
if (def->startupPolicy) {
|
||||||
policy = virDomainStartupPolicyTypeToString(def->startupPolicy);
|
const char *policy;
|
||||||
virBufferAsprintf(buf, " startupPolicy='%s'", policy);
|
policy = virDomainStartupPolicyTypeToString(def->startupPolicy);
|
||||||
}
|
virBufferAsprintf(buf, " startupPolicy='%s'", policy);
|
||||||
if (usbsrc->autoAddress && (flags & VIR_DOMAIN_XML_MIGRATABLE))
|
}
|
||||||
virBufferAddLit(buf, " autoAddress='yes'");
|
if (usbsrc->autoAddress && (flags & VIR_DOMAIN_XML_MIGRATABLE))
|
||||||
|
virBufferAddLit(buf, " autoAddress='yes'");
|
||||||
|
|
||||||
if (def->missing &&
|
if (def->missing && !(flags & VIR_DOMAIN_XML_INACTIVE))
|
||||||
!(flags & VIR_DOMAIN_XML_INACTIVE))
|
virBufferAddLit(buf, " missing='yes'");
|
||||||
virBufferAddLit(buf, " missing='yes'");
|
}
|
||||||
|
|
||||||
|
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
|
||||||
|
scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
|
||||||
|
const char *protocol =
|
||||||
|
virDomainHostdevSubsysSCSIProtocolTypeToString(scsisrc->protocol);
|
||||||
|
|
||||||
|
virBufferAsprintf(buf, " protocol='%s' name='%s'",
|
||||||
|
protocol, iscsisrc->path);
|
||||||
|
}
|
||||||
|
|
||||||
virBufferAddLit(buf, ">\n");
|
virBufferAddLit(buf, ">\n");
|
||||||
|
|
||||||
@ -15828,12 +15930,20 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
|
||||||
virBufferAsprintf(buf, "<adapter name='%s'/>\n",
|
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
|
||||||
scsihostsrc->adapter);
|
virBufferAddLit(buf, "<host");
|
||||||
virBufferAsprintf(buf, "<address %sbus='%d' target='%d' unit='%d'/>\n",
|
virBufferEscapeString(buf, " name='%s'", iscsisrc->hosts[0].name);
|
||||||
includeTypeInAddr ? "type='scsi' " : "",
|
virBufferEscapeString(buf, " port='%s'", iscsisrc->hosts[0].port);
|
||||||
scsihostsrc->bus, scsihostsrc->target,
|
virBufferAddLit(buf, "/>\n");
|
||||||
scsihostsrc->unit);
|
} else {
|
||||||
|
virBufferAsprintf(buf, "<adapter name='%s'/>\n",
|
||||||
|
scsihostsrc->adapter);
|
||||||
|
virBufferAsprintf(buf,
|
||||||
|
"<address %sbus='%d' target='%d' unit='%d'/>\n",
|
||||||
|
includeTypeInAddr ? "type='scsi' " : "",
|
||||||
|
scsihostsrc->bus, scsihostsrc->target,
|
||||||
|
scsihostsrc->unit);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -15842,8 +15952,16 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI &&
|
||||||
|
scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI &&
|
||||||
|
iscsisrc->auth) {
|
||||||
|
if (virStorageAuthDefFormat(buf, iscsisrc->auth) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
virBufferAdjustIndent(buf, -2);
|
virBufferAdjustIndent(buf, -2);
|
||||||
virBufferAddLit(buf, "</source>\n");
|
virBufferAddLit(buf, "</source>\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||||
|
/usr/bin/qemu -S -M \
|
||||||
|
pc -m 214 -smp 1 -nographic -nodefaults -monitor \
|
||||||
|
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
|
||||||
|
-device lsi,id=scsi0,bus=pci.0,addr=0x3 -usb \
|
||||||
|
-drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-ide0-0-0 \
|
||||||
|
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||||
|
-drive file=iscsi://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org\
|
||||||
|
:3260/iqn.1992-01.com.example,if=none,format=raw,id=drive-hostdev0 \
|
||||||
|
-device scsi-generic,bus=scsi0.0,scsi-id=4,drive=drive-hostdev0,id=hostdev0 \
|
||||||
|
-drive file=iscsi://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org\
|
||||||
|
:3260/iqn.1992-01.com.example/1,if=none,format=raw,id=drive-hostdev1 \
|
||||||
|
-device scsi-generic,bus=scsi0.0,scsi-id=5,drive=drive-hostdev1,id=hostdev1 \
|
||||||
|
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
|
@ -0,0 +1,46 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>QEMUGuest2</name>
|
||||||
|
<uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219100</memory>
|
||||||
|
<currentMemory unit='KiB'>219100</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='block' device='disk'>
|
||||||
|
<source dev='/dev/HostVG/QEMUGuest2'/>
|
||||||
|
<target dev='hda' bus='ide'/>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
|
</disk>
|
||||||
|
<controller type='scsi' index='0'/>
|
||||||
|
<controller type='usb' index='0'/>
|
||||||
|
<controller type='ide' index='0'/>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
||||||
|
<source protocol='iscsi' name='iqn.1992-01.com.example'>
|
||||||
|
<host name='example.org' port='3260'/>
|
||||||
|
<auth username='myname'>
|
||||||
|
<secret type='iscsi' usage='mycluster_myname'/>
|
||||||
|
</auth>
|
||||||
|
</source>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='4'/>
|
||||||
|
</hostdev>
|
||||||
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
||||||
|
<source protocol='iscsi' name='iqn.1992-01.com.example/1'>
|
||||||
|
<host name='example.org' port='3260'/>
|
||||||
|
<auth username='myname'>
|
||||||
|
<secret type='iscsi' usage='mycluster_myname'/>
|
||||||
|
</auth>
|
||||||
|
</source>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='5'/>
|
||||||
|
</hostdev>
|
||||||
|
<memballoon model='virtio'/>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -0,0 +1,14 @@
|
|||||||
|
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||||
|
/usr/bin/qemu -S -M \
|
||||||
|
pc -m 214 -smp 1 -nographic -nodefaults -monitor \
|
||||||
|
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
|
||||||
|
-device lsi,id=scsi0,bus=pci.0,addr=0x3 -usb \
|
||||||
|
-drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-ide0-0-0 \
|
||||||
|
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||||
|
-drive file=iscsi://example.org:3260/iqn.1992-01.com.example,if=none,\
|
||||||
|
format=raw,id=drive-hostdev0 \
|
||||||
|
-device scsi-generic,bus=scsi0.0,scsi-id=4,drive=drive-hostdev0,id=hostdev0 \
|
||||||
|
-drive file=iscsi://example.org:3260/iqn.1992-01.com.example/1,if=none,\
|
||||||
|
format=raw,id=drive-hostdev1 \
|
||||||
|
-device scsi-generic,bus=scsi0.0,scsi-id=5,drive=drive-hostdev1,id=hostdev1 \
|
||||||
|
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
|
@ -0,0 +1,40 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>QEMUGuest2</name>
|
||||||
|
<uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219100</memory>
|
||||||
|
<currentMemory unit='KiB'>219100</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='block' device='disk'>
|
||||||
|
<source dev='/dev/HostVG/QEMUGuest2'/>
|
||||||
|
<target dev='hda' bus='ide'/>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
|
</disk>
|
||||||
|
<controller type='scsi' index='0'/>
|
||||||
|
<controller type='usb' index='0'/>
|
||||||
|
<controller type='ide' index='0'/>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
||||||
|
<source protocol='iscsi' name='iqn.1992-01.com.example'>
|
||||||
|
<host name='example.org' port='3260'/>
|
||||||
|
</source>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='4'/>
|
||||||
|
</hostdev>
|
||||||
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
||||||
|
<source protocol='iscsi' name='iqn.1992-01.com.example/1'>
|
||||||
|
<host name='example.org' port='3260'/>
|
||||||
|
</source>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='5'/>
|
||||||
|
</hostdev>
|
||||||
|
<memballoon model='virtio'/>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -0,0 +1,16 @@
|
|||||||
|
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||||
|
/usr/bin/qemu -S -M \
|
||||||
|
pc -m 214 -smp 1 -nographic -nodefaults -monitor \
|
||||||
|
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
|
||||||
|
-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 -usb \
|
||||||
|
-drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-ide0-0-0 \
|
||||||
|
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||||
|
-drive file=iscsi://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org\
|
||||||
|
:3260/iqn.1992-01.com.example,if=none,format=raw,id=drive-hostdev0 \
|
||||||
|
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=2,lun=4,\
|
||||||
|
drive=drive-hostdev0,id=hostdev0 \
|
||||||
|
-drive file=iscsi://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org\
|
||||||
|
:3260/iqn.1992-01.com.example/1,if=none,format=raw,id=drive-hostdev1 \
|
||||||
|
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=2,lun=5,\
|
||||||
|
drive=drive-hostdev1,id=hostdev1 \
|
||||||
|
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
|
@ -0,0 +1,46 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>QEMUGuest2</name>
|
||||||
|
<uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219100</memory>
|
||||||
|
<currentMemory unit='KiB'>219100</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='block' device='disk'>
|
||||||
|
<source dev='/dev/HostVG/QEMUGuest2'/>
|
||||||
|
<target dev='hda' bus='ide'/>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
|
</disk>
|
||||||
|
<controller type='scsi' index='0' model='virtio-scsi'/>
|
||||||
|
<controller type='usb' index='0'/>
|
||||||
|
<controller type='ide' index='0'/>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
||||||
|
<source protocol='iscsi' name='iqn.1992-01.com.example'>
|
||||||
|
<host name='example.org' port='3260'/>
|
||||||
|
<auth username='myname'>
|
||||||
|
<secret type='iscsi' usage='mycluster_myname'/>
|
||||||
|
</auth>
|
||||||
|
</source>
|
||||||
|
<address type='drive' controller='0' bus='0' target='2' unit='4'/>
|
||||||
|
</hostdev>
|
||||||
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
||||||
|
<source protocol='iscsi' name='iqn.1992-01.com.example/1'>
|
||||||
|
<host name='example.org' port='3260'/>
|
||||||
|
<auth username='myname'>
|
||||||
|
<secret type='iscsi' usage='mycluster_myname'/>
|
||||||
|
</auth>
|
||||||
|
</source>
|
||||||
|
<address type='drive' controller='0' bus='0' target='2' unit='5'/>
|
||||||
|
</hostdev>
|
||||||
|
<memballoon model='virtio'/>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -0,0 +1,16 @@
|
|||||||
|
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||||
|
/usr/bin/qemu -S -M \
|
||||||
|
pc -m 214 -smp 1 -nographic -nodefaults -monitor \
|
||||||
|
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
|
||||||
|
-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 -usb \
|
||||||
|
-drive file=/dev/HostVG/QEMUGuest2,if=none,id=drive-ide0-0-0 \
|
||||||
|
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||||
|
-drive file=iscsi://example.org:3260/iqn.1992-01.com.example,if=none,\
|
||||||
|
format=raw,id=drive-hostdev0 \
|
||||||
|
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=2,lun=4,\
|
||||||
|
drive=drive-hostdev0,id=hostdev0 \
|
||||||
|
-drive file=iscsi://example.org:3260/iqn.1992-01.com.example/1,if=none,\
|
||||||
|
format=raw,id=drive-hostdev1 \
|
||||||
|
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=2,lun=5,\
|
||||||
|
drive=drive-hostdev1,id=hostdev1 \
|
||||||
|
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
|
@ -0,0 +1,40 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>QEMUGuest2</name>
|
||||||
|
<uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219100</memory>
|
||||||
|
<currentMemory unit='KiB'>219100</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='block' device='disk'>
|
||||||
|
<source dev='/dev/HostVG/QEMUGuest2'/>
|
||||||
|
<target dev='hda' bus='ide'/>
|
||||||
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||||
|
</disk>
|
||||||
|
<controller type='scsi' index='0' model='virtio-scsi'/>
|
||||||
|
<controller type='usb' index='0'/>
|
||||||
|
<controller type='ide' index='0'/>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
||||||
|
<source protocol='iscsi' name='iqn.1992-01.com.example'>
|
||||||
|
<host name='example.org' port='3260'/>
|
||||||
|
</source>
|
||||||
|
<address type='drive' controller='0' bus='0' target='2' unit='4'/>
|
||||||
|
</hostdev>
|
||||||
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
||||||
|
<source protocol='iscsi' name='iqn.1992-01.com.example/1'>
|
||||||
|
<host name='example.org' port='3260'/>
|
||||||
|
</source>
|
||||||
|
<address type='drive' controller='0' bus='0' target='2' unit='5'/>
|
||||||
|
</hostdev>
|
||||||
|
<memballoon model='virtio'/>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -1353,6 +1353,22 @@ mymain(void)
|
|||||||
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
|
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
|
||||||
QEMU_CAPS_DEVICE_SCSI_GENERIC,
|
QEMU_CAPS_DEVICE_SCSI_GENERIC,
|
||||||
QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
|
QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
|
||||||
|
DO_TEST("hostdev-scsi-lsi-iscsi", QEMU_CAPS_DRIVE,
|
||||||
|
QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
|
||||||
|
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
|
||||||
|
QEMU_CAPS_DEVICE_SCSI_GENERIC);
|
||||||
|
DO_TEST("hostdev-scsi-lsi-iscsi-auth", QEMU_CAPS_DRIVE,
|
||||||
|
QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
|
||||||
|
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
|
||||||
|
QEMU_CAPS_DEVICE_SCSI_GENERIC);
|
||||||
|
DO_TEST("hostdev-scsi-virtio-iscsi", QEMU_CAPS_DRIVE,
|
||||||
|
QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
|
||||||
|
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
|
||||||
|
QEMU_CAPS_DEVICE_SCSI_GENERIC);
|
||||||
|
DO_TEST("hostdev-scsi-virtio-iscsi-auth", QEMU_CAPS_DRIVE,
|
||||||
|
QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
|
||||||
|
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
|
||||||
|
QEMU_CAPS_DEVICE_SCSI_GENERIC);
|
||||||
|
|
||||||
DO_TEST("mlock-on", QEMU_CAPS_MLOCK);
|
DO_TEST("mlock-on", QEMU_CAPS_MLOCK);
|
||||||
DO_TEST_FAILURE("mlock-on", NONE);
|
DO_TEST_FAILURE("mlock-on", NONE);
|
||||||
|
@ -361,6 +361,11 @@ mymain(void)
|
|||||||
|
|
||||||
DO_TEST_DIFFERENT("hostdev-scsi-autogen-address");
|
DO_TEST_DIFFERENT("hostdev-scsi-autogen-address");
|
||||||
|
|
||||||
|
DO_TEST("hostdev-scsi-lsi-iscsi");
|
||||||
|
DO_TEST("hostdev-scsi-lsi-iscsi-auth");
|
||||||
|
DO_TEST("hostdev-scsi-virtio-iscsi");
|
||||||
|
DO_TEST("hostdev-scsi-virtio-iscsi-auth");
|
||||||
|
|
||||||
DO_TEST_DIFFERENT("s390-defaultconsole");
|
DO_TEST_DIFFERENT("s390-defaultconsole");
|
||||||
|
|
||||||
DO_TEST("pcihole64");
|
DO_TEST("pcihole64");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user