[libvirt] [PATCH 20/23] Add support for hotplug/unplug of host storage devices in LXC
Gao feng
gaofeng at cn.fujitsu.com
Fri Dec 14 11:52:33 UTC 2012
On 2012/12/01 04:26, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> Wire up the attach/detach device drivers in LXC to support the
> hotplug/unplug of host storage devices.
>
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
> src/lxc/lxc_driver.c | 237 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 237 insertions(+)
>
[...]
> static int
> +lxcDomainAttachDeviceHostdevStorageLive(virLXCDriverPtr driver,
> + virDomainObjPtr vm,
> + virDomainDeviceDefPtr dev)
> +{
[...]
> +
> + if (virCgroupAllowDevicePath(group, def->source.caps.u.storage.block,
> + VIR_CGROUP_DEVICE_RW |
> + VIR_CGROUP_DEVICE_MKNOD) != 0) {
VIR_CGROUP_DEVICE_RWM, prev patch has the same problem.
> + virReportError(VIR_ERR_INTERNAL_ERROR,
> + _("cannot allow device %s for domain %s"),
> + def->source.caps.u.storage.block, vm->def->name);
> + goto cleanup;
> + }
> +
> + vm->def->hostdevs[vm->def->nhostdevs++] = def;
> +
> + ret = 0;
> +
> +cleanup:
> + virDomainAuditHostdev(vm, def, "attach", ret == 0);
> + if (group)
> + virCgroupFree(&group);
> + if (dst && created && ret < 0)
> + unlink(dst);
dst and vroot need be freed.
ACK
More information about the libvir-list
mailing list