On Wed, Sep 26, 2012 at 05:38:19PM +0300, Constantinos Venetsanopoulos wrote:
> Add support for passing parameters to the ext template (ext-params).
> Take advantage of disk-params, that don't seem to make much sense in
> this template (ExtStorage Providers are not predefined and we don't
> know their needs) and use them to pass the ext-params dynamically to
> the template.
>
> ext-params are correlated with gnt-os-interface's os-params.
> All ext-params are exported to the ExtStorage Provider through it's
> environment, with variables prefixed with 'EXTP_' (similarly to the
> OS interface's 'OSP_' params).
>
> ext-params are passed through the --disk option. If the disk template
> is of type `ext' during instance add, then any additional options that
> are not in IDISK_PARAMS given to --disk are considered ext-params
> e.g.:
>
> gnt-instance add -t ext --disk=0:size=2G,param1=value1,param2=value2
>
> Finally, we introduce a new IDISK_PARAM called IDISK_PROVIDER, that is
> mandatory for template `ext' and is used to select the desired
> ExtStorage Provider. This parameter is not valid for other template
> types.
>
> The IDISK_PROVIDER parameter becomes the first element of the
> disk's unique_id tuple e.g.:
>
> unique_id = ('sample_provider1', 'UUID.ext.diskX')
>
> Example selecting different ExtStorage Providers for each disk and
> passing different ext-params to them:
>
> -t ext --disk=0:size=2G,provider=sample_provider1,param1=value1
> --disk=1:size=3G,provider=sample_provider2,param2=value2
I know understand better patch 4/7.
While we might end up with the interface you currently propose based on
practicality of CLI input, I would like to raise some concerns on it.
The problem is that we're mixing here two things which we shouldn't.
Basically the structure is:
{ size: Int,
mode: ReadWrite,
extp: { }
}
But at cli level (and, I believe, at opcode level too) we're flattening
this structure. This leads to the complications in 4/7 w.r.t. the
validation of disk options, and to the impossibility, for example, that
we have an extp with the name 'size' (ignoring case for the moment).
So I'm wondering if we couldn't separate, both at CLI and opcode level,
these two. Maybe having --disk=0:size=2G,params=<some other format> or
--disk 0:size=2G --dparams 0:p1=v1,p2=v2 or anything else that clearly
separates them.
Just thinking out loud…
iustin