[PATCH 1/2] qemu: cold-plug of sound

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>

Signed-off-by: Jidong Xia <xiajidong@xxxxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bc0ede2..8e7156c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8266,6 +8266,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
 {
     virDomainDiskDefPtr disk;
     virDomainNetDefPtr net;
+    virDomainSoundDefPtr sound;
     virDomainHostdevDefPtr hostdev;
     virDomainLeaseDefPtr lease;
     virDomainControllerDefPtr controller;
@@ -8300,6 +8301,13 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
         dev->data.net = NULL;
         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:
         hostdev = dev->data.hostdev;
         if (virDomainHostdevFind(vmdef, hostdev, NULL) >= 0) {
@@ -8434,7 +8442,6 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
         VIR_STEAL_PTR(vmdef->vsock, dev->data.vsock);
         break;

-    case VIR_DOMAIN_DEVICE_SOUND:
     case VIR_DOMAIN_DEVICE_VIDEO:
     case VIR_DOMAIN_DEVICE_GRAPHICS:
     case VIR_DOMAIN_DEVICE_HUB:
--
1.8.3.1



--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux