
On 2012/12/01 04:26, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Wire up the attach/detach device drivers in LXC to support the hotplug/unplug of USB host devices.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/lxc/lxc_driver.c | 332 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 332 insertions(+)
[...]
static int +lxcDomainDetachDeviceHostdevUSBLive(virLXCDriverPtr driver, + virDomainObjPtr vm, + virDomainDeviceDefPtr dev) +{ + virLXCDomainObjPrivatePtr priv = vm->privateData; + virDomainHostdevDefPtr def = NULL; + virCgroupPtr group = NULL; + int idx, ret = -1; + char *dst = NULL; + char *vroot = NULL; + usbDevice *usb = NULL; + + if (!priv->initpid) {
No need,already checked in lxcDomainDetachDeviceHostdevLive
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Cannot attach hostdev until init PID is known")); + goto cleanup; + } +
[...]
+static int +lxcDomainDetachDeviceHostdevLive(virLXCDriverPtr driver, + virDomainObjPtr vm, + virDomainDeviceDefPtr dev) +{ + virLXCDomainObjPrivatePtr priv = vm->privateData; + + if (!priv->initpid) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Cannot attach hostdev until init PID is known")); + return -1; + } +
ACK