mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
conf: Add <hostdev model='virtio-{non-}transitional'/>
qemu vhost-scsi devices map to XML roughly like: <hostdev mode='subsystem' type='scsi_host'> <source protocol='vhost' wwpn=X/> </hostdev> To support vhost-scsi-pci-{non-}traditional in qemu, we need to to extend the SCSI Host hostdev XML to handle model= value. This matches the XML model= format used for mediated devices. This is just the domain_conf bits and some XML test cases. Use of virtio-X naming here does not match the hostdev protocol=vhost nor does it match the qemu vhost-X device naming, however it's more consistent with all other model= names in this area, and also matches the inconsistency of <vsock> devices which use model=virtio but map to vhost-vsock on the qemu commandline Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
4d964373b5
commit
ef41ff4219
@ -4730,7 +4730,12 @@
|
||||
<dd><span class="since">since 2.5.0</span>For SCSI devices, user
|
||||
is responsible to make sure the device is not used by host. This
|
||||
<code>type</code> passes all LUNs presented by a single HBA to
|
||||
the guest.
|
||||
the guest. <span class="since">Since 5.2.0,</span> the
|
||||
<code>model</code> attribute can be specified further
|
||||
with "virtio-transitional", "virtio-non-transitional", or
|
||||
"virtio". See
|
||||
<a href="#elementsVirtioTransitional">Virtio transitional devices</a>
|
||||
for more details.
|
||||
</dd>
|
||||
<dt><code>mdev</code></dt>
|
||||
<dd>For mediated devices (<span class="since">Since 3.2.0</span>)
|
||||
|
@ -4630,6 +4630,15 @@
|
||||
<attribute name="type">
|
||||
<value>scsi_host</value>
|
||||
</attribute>
|
||||
<optional>
|
||||
<attribute name="model">
|
||||
<choice>
|
||||
<value>virtio</value>
|
||||
<value>virtio-transitional</value>
|
||||
<value>virtio-non-transitional</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<element name="source">
|
||||
<choice>
|
||||
<group>
|
||||
|
@ -786,6 +786,14 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIHostProtocol,
|
||||
"vhost",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIVHostModel,
|
||||
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_LAST,
|
||||
"default",
|
||||
"virtio",
|
||||
"virtio-transitional",
|
||||
"virtio-non-transitional",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
|
||||
"storage",
|
||||
"misc",
|
||||
@ -7781,6 +7789,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
int backend;
|
||||
virDomainHostdevSubsysPCIPtr pcisrc = &def->source.subsys.u.pci;
|
||||
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
|
||||
virDomainHostdevSubsysSCSIVHostPtr scsihostsrc = &def->source.subsys.u.scsi_host;
|
||||
virDomainHostdevSubsysMediatedDevPtr mdevsrc = &def->source.subsys.u.mdev;
|
||||
VIR_AUTOFREE(char *) managed = NULL;
|
||||
VIR_AUTOFREE(char *) sgio = NULL;
|
||||
@ -7869,14 +7878,26 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
||||
}
|
||||
}
|
||||
|
||||
if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) {
|
||||
if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV &&
|
||||
def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) {
|
||||
if (model) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("'model' attribute in <hostdev> is only supported "
|
||||
"when type='mdev'"));
|
||||
"when type='%s'"),
|
||||
virDomainHostdevSubsysTypeToString(def->source.subsys.type));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) {
|
||||
if (model &&
|
||||
((scsihostsrc->model = virDomainHostdevSubsysSCSIVHostModelTypeFromString(model)) < 0)) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("unknown hostdev model '%s'"),
|
||||
model);
|
||||
return -1;
|
||||
}
|
||||
} else if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) {
|
||||
if (!model) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Missing 'model' attribute in mediated device's "
|
||||
@ -26810,6 +26831,7 @@ virDomainHostdevDefFormat(virBufferPtr buf,
|
||||
const char *mode = virDomainHostdevModeTypeToString(def->mode);
|
||||
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
|
||||
virDomainHostdevSubsysMediatedDevPtr mdevsrc = &def->source.subsys.u.mdev;
|
||||
virDomainHostdevSubsysSCSIVHostPtr scsihostsrc = &def->source.subsys.u.scsi_host;
|
||||
const char *type;
|
||||
|
||||
if (!mode) {
|
||||
@ -26860,6 +26882,12 @@ virDomainHostdevDefFormat(virBufferPtr buf,
|
||||
virTristateBoolTypeToString(scsisrc->rawio));
|
||||
}
|
||||
|
||||
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST &&
|
||||
scsihostsrc->model) {
|
||||
virBufferAsprintf(buf, " model='%s'",
|
||||
virDomainHostdevSubsysSCSIVHostModelTypeToString(scsihostsrc->model));
|
||||
}
|
||||
|
||||
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) {
|
||||
virBufferAsprintf(buf, " model='%s'",
|
||||
virMediatedDeviceModelTypeToString(mdevsrc->model));
|
||||
|
@ -394,11 +394,23 @@ typedef enum {
|
||||
|
||||
VIR_ENUM_DECL(virDomainHostdevSubsysSCSIHostProtocol);
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_DEFAULT,
|
||||
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO,
|
||||
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL,
|
||||
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TRANSITIONAL,
|
||||
|
||||
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_LAST,
|
||||
} virDomainHostdevSubsysSCSIVHostModelType;
|
||||
|
||||
VIR_ENUM_DECL(virDomainHostdevSubsysSCSIVHostModel);
|
||||
|
||||
typedef struct _virDomainHostdevSubsysSCSIVHost virDomainHostdevSubsysSCSIVHost;
|
||||
typedef virDomainHostdevSubsysSCSIVHost *virDomainHostdevSubsysSCSIVHostPtr;
|
||||
struct _virDomainHostdevSubsysSCSIVHost {
|
||||
int protocol; /* enum virDomainHostdevSubsysSCSIHostProtocolType */
|
||||
char *wwpn;
|
||||
int model; /* enum virDomainHostdevSubsysSCSIVHostModelType */
|
||||
};
|
||||
|
||||
typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys;
|
||||
|
@ -407,6 +407,8 @@ virDomainHostdevInsert;
|
||||
virDomainHostdevModeTypeToString;
|
||||
virDomainHostdevRemove;
|
||||
virDomainHostdevSubsysPCIBackendTypeToString;
|
||||
virDomainHostdevSubsysSCSIVHostModelTypeFromString;
|
||||
virDomainHostdevSubsysSCSIVHostModelTypeToString;
|
||||
virDomainHostdevSubsysTypeToString;
|
||||
virDomainHPTResizingTypeToString;
|
||||
virDomainHubTypeFromString;
|
||||
|
@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
addr=0x1 \
|
||||
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
|
||||
-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \
|
||||
-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.2,\
|
||||
addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
|
||||
-netdev user,id=hostnet0 \
|
||||
-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\
|
||||
id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
|
||||
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
|
||||
bus=pci.3,addr=0x0 \
|
||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||
resourcecontrol=deny \
|
||||
-msg timestamp=on
|
||||
|
@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
addr=0x1 \
|
||||
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
|
||||
-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \
|
||||
-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.2,addr=0x0,\
|
||||
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
|
||||
-netdev user,id=hostnet0 \
|
||||
-device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\
|
||||
mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
|
||||
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
|
||||
bus=pci.3,addr=0x0 \
|
||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||
resourcecontrol=deny \
|
||||
-msg timestamp=on
|
||||
|
@ -15,6 +15,9 @@
|
||||
<mac address='00:11:22:33:44:55'/>
|
||||
<model type='virtio-non-transitional'/>
|
||||
</interface>
|
||||
<hostdev mode='subsystem' type='scsi_host' managed='no' model='virtio-non-transitional'>
|
||||
<source protocol='vhost' wwpn='naa.5123456789abcde0'/>
|
||||
</hostdev>
|
||||
<controller type='usb' model='none'/>
|
||||
<memballoon model='none'/>
|
||||
</devices>
|
||||
|
@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
addr=0x1 \
|
||||
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
|
||||
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
|
||||
-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci,disable-legacy=off,disable-modern=off,scsi=off,\
|
||||
bus=pci.2,addr=0x2,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
|
||||
-netdev user,id=hostnet0 \
|
||||
-device virtio-net-pci,disable-legacy=off,disable-modern=off,netdev=hostnet0,\
|
||||
id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \
|
||||
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
|
||||
bus=pci.3,addr=0x0 \
|
||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||
resourcecontrol=deny \
|
||||
-msg timestamp=on
|
||||
|
@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
addr=0x1 \
|
||||
-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
|
||||
-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
|
||||
-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
|
||||
-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x2,\
|
||||
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
|
||||
-netdev user,id=hostnet0 \
|
||||
-device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\
|
||||
mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \
|
||||
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
|
||||
bus=pci.3,addr=0x0 \
|
||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||
resourcecontrol=deny \
|
||||
-msg timestamp=on
|
||||
|
@ -15,6 +15,9 @@
|
||||
<mac address='00:11:22:33:44:55'/>
|
||||
<model type='virtio-transitional'/>
|
||||
</interface>
|
||||
<hostdev mode='subsystem' type='scsi_host' managed='no' model='virtio-transitional'>
|
||||
<source protocol='vhost' wwpn='naa.5123456789abcde0'/>
|
||||
</hostdev>
|
||||
<controller type='usb' model='none'/>
|
||||
<memballoon model='none'/>
|
||||
</devices>
|
||||
|
@ -40,6 +40,11 @@
|
||||
<target chassis='3' port='0xa'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='pci' index='4' model='pcie-root-port'>
|
||||
<model name='pcie-root-port'/>
|
||||
<target chassis='4' port='0xb'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
|
||||
</controller>
|
||||
<interface type='user'>
|
||||
<mac address='00:11:22:33:44:55'/>
|
||||
<model type='virtio-non-transitional'/>
|
||||
@ -47,6 +52,10 @@
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<hostdev mode='subsystem' type='scsi_host' managed='no' model='virtio-non-transitional'>
|
||||
<source protocol='vhost' wwpn='naa.5123456789abcde0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
|
||||
</hostdev>
|
||||
<memballoon model='none'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -39,6 +39,11 @@
|
||||
<target chassis='3' port='0x9'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<controller type='pci' index='4' model='pcie-root-port'>
|
||||
<model name='pcie-root-port'/>
|
||||
<target chassis='4' port='0xa'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<interface type='user'>
|
||||
<mac address='00:11:22:33:44:55'/>
|
||||
<model type='virtio-transitional'/>
|
||||
@ -46,6 +51,10 @@
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<hostdev mode='subsystem' type='scsi_host' managed='no' model='virtio-transitional'>
|
||||
<source protocol='vhost' wwpn='naa.5123456789abcde0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
|
||||
</hostdev>
|
||||
<memballoon model='none'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
Loading…
x
Reference in New Issue
Block a user