[libvirt] [PATCH V3] enhance capabilities mode hostdev process

Pavel Hrdina phrdina at redhat.com
Tue Jun 24 09:58:27 UTC 2014


On 19.6.2014 19:59, Jincheng Miao wrote:
> hostdev has mode "capabilities" for LXC, from formatdomain.html:
> "
> Block / character devices from the host can be passed through to
> the guest using the hostdev element.
> This is only possible with container based virtualization.
> since after 1.0.1 for LXC
> "
> So forbid capabilities mode hostdev if domain is not LXC.

Don't quote the documentation, just write it with your own words.

> 
> The affected files are:
>   * src/libxl/libxl_domain.c
>   * src/openvz/openvz_driver.c
>   * src/qemu/qemu_domain.c
>   * src/uml/uml_driver.c
>   * src/xen/xen_driver.c
>   * src/xenapi/xenapi_driver.c
> There are some drivers lack function devicesPostParseCallback(),
> like: vbox, bhyve, and so on.
> 
> V3: move the hostdev checking to devicesPostParseCallback(),
>     this is more reasonable to check it in define phase, and
>     implement in each driver.
> V2: move the hostdev checking to qemuBuildCommandLine().
> 

Affected files shouldn't be in commit message also with the version
changes. [1]

> Signed-off-by: Jincheng Miao <jmiao at redhat.com>
> ---

[1] The version changes belongs here.

>  src/libxl/libxl_domain.c   | 8 ++++++++
>  src/openvz/openvz_driver.c | 9 +++++++++
>  src/qemu/qemu_domain.c     | 9 +++++++++
>  src/uml/uml_driver.c       | 9 +++++++++
>  src/xen/xen_driver.c       | 9 +++++++++
>  src/xenapi/xenapi_driver.c | 9 +++++++++
>  6 files changed, 53 insertions(+)
> 
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 73242ac..96f3b88 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -485,6 +485,14 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
>      if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
>          virDomainHostdevDefPtr hostdev = dev->data.hostdev;
>  
> +        /* forbid capabilities mode hostdev in this kind of hypervisor */
> +        if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                           _("Unsupported capabilities mode hostdev in %s"),
> +                           virDomainVirtTypeToString(def->virtType));

I would probably change the error message to "hostdev mode
'capabilities' is not supported in '%s'".

Pavel

[..]




More information about the libvir-list mailing list