提交 0f5958f5 编写于 作者: C Cole Robinson

qemu: Support memballoon model=virtio-{non-}transitional

Add new <memballoon> model values for virtio transitional devices. Ex:

  <memballoon model='virtio-transitional'/>

* "virtio-transitional" maps to qemu "virtio-balloon-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-balloon-pci-non-transitional"
Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
Signed-off-by: NCole Robinson <crobinso@redhat.com>
上级 62eef965
......@@ -7959,8 +7959,12 @@ qemu-kvm -net nic,model=? /dev/null
</p>
<ul>
<li>'virtio' - default with QEMU/KVM</li>
<li>'virtio-transitional' <span class="since">Since 5.2.0</span></li>
<li>'virtio-non-transitional' <span class="since">Since 5.2.0</span></li>
<li>'xen' - default with Xen</li>
</ul>
See <a href="#elementsVirtioTransitional">Virtio transitional devices</a>
for more details.
</dd>
<dt><code>autodeflate</code></dt>
<dd>
......
......@@ -4093,6 +4093,8 @@
<attribute name="model">
<choice>
<value>virtio</value>
<value>virtio-transitional</value>
<value>virtio-non-transitional</value>
<value>xen</value>
<value>none</value>
</choice>
......
......@@ -599,6 +599,8 @@ VIR_ENUM_IMPL(virDomainMemballoonModel, VIR_DOMAIN_MEMBALLOON_MODEL_LAST,
"virtio",
"xen",
"none",
"virtio-transitional",
"virtio-non-transitional",
);
VIR_ENUM_IMPL(virDomainSmbiosMode, VIR_DOMAIN_SMBIOS_LAST,
......
......@@ -1733,6 +1733,8 @@ typedef enum {
VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO,
VIR_DOMAIN_MEMBALLOON_MODEL_XEN,
VIR_DOMAIN_MEMBALLOON_MODEL_NONE,
VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL,
VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL,
VIR_DOMAIN_MEMBALLOON_MODEL_LAST
} virDomainMemballoonModel;
......
......@@ -718,6 +718,8 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
case VIR_DOMAIN_MEMBALLOON_MODEL_XEN:
break;
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO:
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL:
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported balloon device model '%s'"),
virDomainMemballoonModelTypeToString(model));
......
......@@ -502,6 +502,11 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
has_ntmodel = device.data.fs->model == VIR_DOMAIN_FS_MODEL_VIRTIO_NON_TRANSITIONAL;
break;
case VIR_DOMAIN_DEVICE_MEMBALLOON:
has_tmodel = device.data.memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL;
has_ntmodel = device.data.memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL;
break;
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND:
......@@ -514,7 +519,6 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_SMARTCARD:
case VIR_DOMAIN_DEVICE_CHR:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_SHMEM:
case VIR_DOMAIN_DEVICE_TPM:
......
......@@ -6015,7 +6015,9 @@ qemuDomainDeviceDefValidateMemballoon(const virDomainMemballoonDef *memballoon,
return 0;
}
if (memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
if (memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL &&
memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Memory balloon device type '%s' is not supported by this version of qemu"),
virDomainMemballoonModelTypeToString(memballoon->model));
......
......@@ -877,7 +877,11 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_MEMBALLOON:
switch ((virDomainMemballoonModel) dev->data.memballoon->model) {
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL:
/* Transitional devices only work in conventional PCI slots */
return pciFlags;
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO:
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL:
return virtioFlags;
case VIR_DOMAIN_MEMBALLOON_MODEL_XEN:
......
......@@ -30,6 +30,7 @@ addr=0x1 \
-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \
-device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \
-device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \
-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.3,\
addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
......@@ -41,9 +42,11 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \
id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
-device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\
wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.4,addr=0x0 \
-device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\
bus=pci.5,addr=0x0 \
-object rng-random,id=objrng0,filename=/dev/urandom \
-device virtio-rng-pci,disable-legacy=on,disable-modern=off,rng=objrng0,\
id=rng0,bus=pci.5,addr=0x0 \
id=rng0,bus=pci.6,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
......@@ -30,6 +30,7 @@ addr=0x1 \
-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \
-device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \
-device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
......@@ -41,8 +42,9 @@ bus=pci.1,addr=0x0 \
mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
-device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.4,addr=0x0 \
-device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.5,addr=0x0 \
-object rng-random,id=objrng0,filename=/dev/urandom \
-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.5,addr=0x0 \
-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.6,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
......@@ -26,6 +26,6 @@
<target dir='fs1'/>
</filesystem>
<controller type='usb' model='none'/>
<memballoon model='none'/>
<memballoon model='virtio-non-transitional'/>
</devices>
</domain>
......@@ -38,9 +38,11 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x1 \
id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
-device vhost-scsi-pci,disable-legacy=off,disable-modern=off,\
wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.2,addr=0x4 \
-device virtio-balloon-pci,disable-legacy=off,disable-modern=off,id=balloon0,\
bus=pci.2,addr=0x5 \
-object rng-random,id=objrng0,filename=/dev/urandom \
-device virtio-rng-pci,disable-legacy=off,disable-modern=off,rng=objrng0,\
id=rng0,bus=pci.2,addr=0x5 \
id=rng0,bus=pci.2,addr=0x6 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
......@@ -38,8 +38,9 @@ bus=pci.2,addr=0x1 \
mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.2,addr=0x4 \
-device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x5 \
-object rng-random,id=objrng0,filename=/dev/urandom \
-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x5 \
-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
......@@ -26,6 +26,6 @@
<target dir='fs1'/>
</filesystem>
<controller type='usb' model='none'/>
<memballoon model='none'/>
<memballoon model='virtio-transitional'/>
</devices>
</domain>
......@@ -55,6 +55,11 @@
<target chassis='6' port='0xd'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x5'/>
</controller>
<controller type='pci' index='7' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='7' port='0xe'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x6'/>
</controller>
<filesystem type='mount' accessmode='passthrough' model='virtio-non-transitional'>
<source dir='/export/fs1'/>
<target dir='fs1'/>
......@@ -71,10 +76,12 @@
<source protocol='vhost' wwpn='naa.5123456789abcde0'/>
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</hostdev>
<memballoon model='none'/>
<memballoon model='virtio-non-transitional'>
<address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
</memballoon>
<rng model='virtio-non-transitional'>
<backend model='random'>/dev/urandom</backend>
<address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
<address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
</rng>
</devices>
</domain>
......@@ -55,10 +55,12 @@
<source protocol='vhost' wwpn='naa.5123456789abcde0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
</hostdev>
<memballoon model='none'/>
<memballoon model='virtio-transitional'>
<address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
</memballoon>
<rng model='virtio-transitional'>
<backend model='random'>/dev/urandom</backend>
<address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
</rng>
</devices>
</domain>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册