[virt-tools-list] [virt-manager PATCH] seclabel: add a validation for security type static

Cole Robinson crobinso at redhat.com
Fri May 13 17:28:34 UTC 2016


On 05/13/2016 01:19 PM, Pavel Hrdina wrote:
> Commit 510d28e3 refactored the seclabel code and one check was lost.
> Add the check back into the code.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1298031
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  virtinst/seclabel.py | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/virtinst/seclabel.py b/virtinst/seclabel.py
> index 10bf4e8..02221f0 100644
> --- a/virtinst/seclabel.py
> +++ b/virtinst/seclabel.py
> @@ -87,6 +87,11 @@ class Seclabel(XMLBuilder):
>                         default_cb=_get_default_type,
>                         default_name=TYPE_DEFAULT)
>  
> +    def validate(self):
> +        if self.type == self.TYPE_STATIC and not self.label:
> +            raise RuntimeError(_("A label must be specified for 'static' "
> +                                 "security type."))
> +
>      label = XMLProperty("./label")
>      imagelabel = XMLProperty("./imagelabel")
>      baselabel = XMLProperty("./baselabel")
> 

Hmm I think the bug is WONTFIX, since this just duplicates an explicit error
that libvirt will already throw for us. Yes it's slightly more annoying for
the user since virt-install will fully set up the VM before reporting the
error, but that's the case with hundreds of other validation checks.

The only time bits like this are really important IMO is if a) it's via the
virt-manager UI and we want to use the validation check to block an action
early, or b) it's a really common misconfiguration. Neither cover this case

Thanks,
Cole




More information about the virt-tools-list mailing list