提交 9ec64b59 编写于 作者: J Jidong Xia 提交者: Cole Robinson

qemu: cold-plug of sound

With this patch users can cold plug some sound devices.
use "virsh attach-device vm sound.xml --config" command.
Consider the following sound.xml for a domain:
    <sound model='ich6'>
         <address type='pci' domain='0x0000' bus='0x00' slot='xxx' function='0'/>
    </sound>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
Signed-off-by: NJidong Xia <xiajidong@cmss.chinamobile.com>
上级 35e15478
...@@ -8103,6 +8103,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, ...@@ -8103,6 +8103,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
{ {
virDomainDiskDefPtr disk; virDomainDiskDefPtr disk;
virDomainNetDefPtr net; virDomainNetDefPtr net;
virDomainSoundDefPtr sound;
virDomainHostdevDefPtr hostdev; virDomainHostdevDefPtr hostdev;
virDomainLeaseDefPtr lease; virDomainLeaseDefPtr lease;
virDomainControllerDefPtr controller; virDomainControllerDefPtr controller;
...@@ -8137,6 +8138,13 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, ...@@ -8137,6 +8138,13 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
dev->data.net = NULL; dev->data.net = NULL;
break; break;
case VIR_DOMAIN_DEVICE_SOUND:
sound = dev->data.sound;
if (VIR_APPEND_ELEMENT(vmdef->sounds, vmdef->nsounds, sound) < 0)
return -1;
dev->data.sound = NULL;
break;
case VIR_DOMAIN_DEVICE_HOSTDEV: case VIR_DOMAIN_DEVICE_HOSTDEV:
hostdev = dev->data.hostdev; hostdev = dev->data.hostdev;
if (virDomainHostdevFind(vmdef, hostdev, NULL) >= 0) { if (virDomainHostdevFind(vmdef, hostdev, NULL) >= 0) {
...@@ -8271,7 +8279,6 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, ...@@ -8271,7 +8279,6 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
vmdef->vsock = g_steal_pointer(&dev->data.vsock); vmdef->vsock = g_steal_pointer(&dev->data.vsock);
break; break;
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_VIDEO:
case VIR_DOMAIN_DEVICE_GRAPHICS: case VIR_DOMAIN_DEVICE_GRAPHICS:
case VIR_DOMAIN_DEVICE_HUB: case VIR_DOMAIN_DEVICE_HUB:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册