[virt-tools-list] [virt-manager PATCH] numatune: fix validate_cpuset regexp

Cole Robinson crobinso at redhat.com
Tue Jun 5 18:28:47 UTC 2018


On 05/22/2018 01:07 PM, Pavel Hrdina wrote:
> Character '-' needs to be escaped in a set of characters.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1566818
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
> 
> Pushed under trivial rule.
> 
>  virtinst/domain/numatune.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/virtinst/domain/numatune.py b/virtinst/domain/numatune.py
> index 6d65ee7a..0e34a48d 100644
> --- a/virtinst/domain/numatune.py
> +++ b/virtinst/domain/numatune.py
> @@ -31,7 +31,7 @@ class DomainNumatune(XMLBuilder):
>  
>          if not isinstance(val, str) or len(val) == 0:
>              raise ValueError(_("cpuset must be string"))
> -        if re.match("^[0-9,-^]*$", val) is None:
> +        if re.match("^[0-9,\-^]*$", val) is None:
>              raise ValueError(_("cpuset can only contain numeric, ',', '^', or "
>                                 "'-' characters"))
>  
> 

Actually this reminded me that I wanted to remove this code :) Since
cpuset options are more power user type options I don't think we need
code in virtinst to try and protect users, plus for this format
validation libvirt is/should be doing it anyways. So I've dropped this
chunk and the surrounding code in git now

Thanks,
Cole




More information about the virt-tools-list mailing list