Re: [PATCH] qemu_conf: check for duplicate security drivers

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

 



On 19.01.2015 12:51, Ján Tomko wrote:
> Using the same driver multiple times is pointless and
> it can result in confusing errors:
> 
> $ virsh start test
> error: Failed to start domain test
> error: internal error: security label already defined for VM
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1153891
> ---
>  src/qemu/qemu_conf.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 9539231..a24c5c5 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -460,7 +460,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
>  
>      p = virConfGetValue(conf, "security_driver");
>      if (p && p->type == VIR_CONF_LIST) {
> -        size_t len;
> +        size_t len, j;
>          virConfValuePtr pp;
>  
>          /* Calc length and check items */
> @@ -476,6 +476,13 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
>              goto cleanup;
>  
>          for (i = 0, pp = p->list; pp; i++, pp = pp->next) {
> +            for (j = 0; j < i; j++) {
> +                if (STREQ(pp->str, cfg->securityDriverNames[j])) {
> +                    virReportError(VIR_ERR_CONF_SYNTAX,

Well, technically it's not a syntax error, but whatever. I guess we
don't have more appropriate error code.

> +                                   _("Duplicate security driver %s"), pp->str);
> +                    goto cleanup;
> +                }
> +            }
>              if (VIR_STRDUP(cfg->securityDriverNames[i], pp->str) < 0)
>                  goto cleanup;
>          }
> 


ACK

Michal

--
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]