[libvirt] [PATCH 03/14] Record hotplugged USB device in LXC live guest config

Daniel P. Berrange berrange at redhat.com
Fri Feb 7 15:33:01 UTC 2014


After hotplugging a USB device, the LXC driver forgot
to add the device def to the virDomainDefPtr.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 src/lxc/lxc_driver.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index cd48be8..1c7abb9 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3943,6 +3943,9 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
 
     mode = 0700 | S_IFCHR;
 
+    if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1) < 0)
+        goto cleanup;
+
     if (virFileMakePath(dstdir) < 0) {
         virReportSystemError(errno,
                              _("Unable to create %s"), dstdir);
@@ -3971,6 +3974,8 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
                                 priv->cgroup) < 0)
         goto cleanup;
 
+    vm->def->hostdevs[vm->def->nhostdevs++] = def;
+
     ret = 0;
 
 cleanup:
-- 
1.8.5.3




More information about the libvir-list mailing list