Re: [PATCHv8 2/2] domain: conf: Fix secret type checking for network volumes

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

 



On 03/03/2014 05:43 PM, Adam Walters wrote:
> This patch fixes the secret type checking done in the
> virDomainDiskDefParseXML function. Previously, it would not allow any
> volumes that utilized a secret. This patch is a simple bypass of the
> checking code for volumes.
> 
> Signed-off-by: Adam Walters <adam@xxxxxxxxxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 1d5cc14..be6742a 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -5494,7 +5494,11 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
>          cur = cur->next;
>      }
>  
> -    if (auth_secret_usage != -1 && auth_secret_usage != expected_secret_usage) {
> +    /* Bypass this check for volumes. On libvirtd start, pool definitions are not
> +     * yet parsed, and thus we can't expect to have a valid expected_secret_usage.
> +     */

The storage driver is initialized before QEMU driver.

When a domain definition with disk type='volume' is parsed, we don't check if
the pool or the volume exists, so we shouldn't check the secret either.


> +    if (auth_secret_usage != -1 && auth_secret_usage != expected_secret_usage &&
> +        def->type != VIR_DOMAIN_DISK_TYPE_VOLUME) {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("invalid secret type '%s'"),
>                         virSecretUsageTypeTypeToString(auth_secret_usage));

If there is a secret in the pool definition, the secret specified here will
get overwritten in qemuTranslateDiskSourcePoolAuth. (which is where the secret
type check should be IMO)

> @@ -18442,7 +18446,8 @@ virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
>      if (!disk->src || disk->type == VIR_DOMAIN_DISK_TYPE_NETWORK ||
>          (disk->type == VIR_DOMAIN_DISK_TYPE_VOLUME &&
>           disk->srcpool &&
> -         disk->srcpool->mode == VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT))
> +         (disk->srcpool->mode == VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT ||
> +         disk->srcpool->actualtype == VIR_DOMAIN_DISK_TYPE_NETWORK)))

This changes the behavior for ISCSI volumees with MODE_HOST or MODE_DEFAULT.
I think you need to check pooltype, since the default for iscsi (HOST) is
different for rbd (DIRECT)

>          return 0;
>  
>      if (iter(disk, disk->src, 0, opaque) < 0)
> 

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

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