From: Daniel P. Berrange Date: Tue, 4 Feb 2014 16:46:28 +0000 (+0000) Subject: Record hotplugged USB device in LXC live guest config X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=681aff3fb5f7be9771e3034dc0a008b7ed0f2c64;p=thirdparty%2Flibvirt.git Record hotplugged USB device in LXC live guest config After hotplugging a USB device, the LXC driver forgot to add the device def to the virDomainDefPtr. Signed-off-by: Daniel P. Berrange (cherry picked from commit a537827d15516f2b59afb23ce2d50b8a88d7f090) Backport fixed for OOM error reporting --- diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 8c7612e056..d2a1befc96 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -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: