Re: [PATCH 1/2] conf: only accept capabilities mode hostdev in LXC.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 19, 2014 at 05:45:12PM +0800, 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.
> 
> The related bug is:
> https://bugzilla.redhat.com/show_bug.cgi?id=1111044
> 
> Signed-off-by: Jincheng Miao <jmiao@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 4114289..5ae6614 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -9574,6 +9574,12 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
>              goto error;
>          break;
>      case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
> +        if (vmdef->virtType != VIR_DOMAIN_VIRT_LXC) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                           _("Unsupported capabilities mode hostdev in %s"),
> +                           virDomainVirtTypeToString(vmdef->virtType));
> +            goto error;
> +        }

No, the parser code is not supposed to do semantic validation like
this. This kind of check should be done exclusively in the driver
code which forms the command line args for the hypervisors which
don't support it.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]