[libvirt] [PATCH 3/4] vz: refactoring of prlsdkCreateCt

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Mon Jul 11 09:07:34 UTC 2016



On 06.07.2016 17:02, Olga Krishtal wrote:
> We do not need to check domainf fs type there,
> because it is done in prlsdkCheckUnsupportedParams.
> 
> Signed-off-by: Olga Krishtal <okrishtal at virtuozzo.com>
> ---
>  src/vz/vz_sdk.c | 21 ++-------------------
>  1 file changed, 2 insertions(+), 19 deletions(-)
> 
> diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
> index b13b84d..dd7eb6e 100644
> --- a/src/vz/vz_sdk.c
> +++ b/src/vz/vz_sdk.c
> @@ -3859,26 +3859,9 @@ prlsdkCreateCt(vzDriverPtr driver, virDomainDefPtr def)
>      PRL_UINT32 flags;
>      int ret = -1;
>      int useTemplate = 0;
> -    size_t i;
>  
> -    if (def->nfss > 1) {
> -        /* Check all filesystems */
> -        for (i = 0; i < def->nfss; i++) {
> -            if (def->fss[i]->type != VIR_DOMAIN_FS_TYPE_FILE) {
> -                virReportError(VIR_ERR_INVALID_ARG, "%s",
> -                               _("Unsupported filesystem type."));
> -                return -1;
> -            }
> -        }
> -    } else if (def->nfss == 1) {
> -        if (def->fss[0]->type == VIR_DOMAIN_FS_TYPE_TEMPLATE) {
> -            useTemplate = 1;
> -        } else if (def->fss[0]->type != VIR_DOMAIN_FS_TYPE_FILE) {
> -            virReportError(VIR_ERR_INVALID_ARG, "%s",
> -                           _("Unsupported filesystem type."));
> -            return -1;

only this branch can be dropped

> -        }
> -    }
> +    if (def->nfss == 1 && def->fss[0]->type == VIR_DOMAIN_FS_TYPE_TEMPLATE)
> +        useTemplate = 1;
>  
>      confParam.nVmType = PVT_CT;
>      confParam.sConfigSample = "vswap.1024MB";
> 

Eventually we can not drop this checks this way as checks in prlsdkAddFS (via prlsdkCheckFSUnsupportedParams)
check only individual filesystems and we need to be sure that if we have template filesystem than 
total number of filesystems is one. Sorry if I misguided you earlier.

Nikolay




More information about the libvir-list mailing list