]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Record hotplugged USB device in LXC live guest config
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 4 Feb 2014 16:46:28 +0000 (16:46 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 18 Feb 2014 18:24:01 +0000 (18:24 +0000)
After hotplugging a USB device, the LXC driver forgot
to add the device def to the virDomainDefPtr.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit a537827d15516f2b59afb23ce2d50b8a88d7f090)

Backport fixed for OOM error reporting

src/lxc/lxc_driver.c

index 8c7612e056e99859fa1d9d014a71ae1e988fda2d..d2a1befc9698657760373ac7cd3e01cf5f6aa728 100644 (file)
@@ -3446,6 +3446,11 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
 
     mode = 0700 | S_IFCHR;
 
+    if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0) {
+        virReportOOMError();
+        goto cleanup;
+    }
+
     if (virFileMakePath(dstdir) < 0) {
         virReportSystemError(errno,
                              _("Unable to create %s"), dstdir);
@@ -3471,6 +3476,8 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
                                 priv->cgroup) < 0)
         goto cleanup;
 
+    vm->def->hostdevs[vm->def->nhostdevs++] = def;
+
     ret = 0;
 
 cleanup: