Revision 41044e04 lib/cli.py
b/lib/cli.py | ||
---|---|---|
3736 | 3736 |
if iscluster: |
3737 | 3737 |
eff_ipolicy = custom_ipolicy |
3738 | 3738 |
|
3739 |
custom_minmax = custom_ipolicy.get(constants.ISPECS_MINMAX, {}) |
|
3740 |
ret = [ |
|
3741 |
(key, |
|
3742 |
FormatParamsDictInfo(custom_minmax.get(key, {}), |
|
3743 |
eff_ipolicy[constants.ISPECS_MINMAX][key])) |
|
3744 |
for key in constants.ISPECS_MINMAX_KEYS |
|
3745 |
] |
|
3739 |
minmax_out = [] |
|
3740 |
custom_minmax = custom_ipolicy.get(constants.ISPECS_MINMAX) |
|
3741 |
if custom_minmax: |
|
3742 |
for (k, minmax) in enumerate(custom_minmax): |
|
3743 |
minmax_out.append([ |
|
3744 |
("%s/%s" % (key, k), |
|
3745 |
FormatParamsDictInfo(minmax[key], minmax[key])) |
|
3746 |
for key in constants.ISPECS_MINMAX_KEYS |
|
3747 |
]) |
|
3748 |
else: |
|
3749 |
for (k, minmax) in enumerate(eff_ipolicy[constants.ISPECS_MINMAX]): |
|
3750 |
minmax_out.append([ |
|
3751 |
("%s/%s" % (key, k), |
|
3752 |
FormatParamsDictInfo({}, minmax[key])) |
|
3753 |
for key in constants.ISPECS_MINMAX_KEYS |
|
3754 |
]) |
|
3755 |
ret = [("bounds specs", minmax_out)] |
|
3756 |
|
|
3746 | 3757 |
if iscluster: |
3747 | 3758 |
stdspecs = custom_ipolicy[constants.ISPECS_STD] |
3748 | 3759 |
ret.append( |
... | ... | |
3787 | 3798 |
_PrintSpecsParameters(buf, stdspecs) |
3788 | 3799 |
minmax = ipolicy.get("minmax") |
3789 | 3800 |
if minmax: |
3790 |
minspecs = minmax.get("min") |
|
3791 |
maxspecs = minmax.get("max") |
|
3801 |
minspecs = minmax[0].get("min")
|
|
3802 |
maxspecs = minmax[0].get("max")
|
|
3792 | 3803 |
if minspecs and maxspecs: |
3793 | 3804 |
buf.write(" %s " % IPOLICY_BOUNDS_SPECS_STR) |
3794 | 3805 |
buf.write("min:") |
... | ... | |
3892 | 3903 |
for key, val in specs.items(): # {min: .. ,max: .., std: ..} |
3893 | 3904 |
assert key in ispecs |
3894 | 3905 |
ispecs[key][name] = val |
3895 |
ipolicy[constants.ISPECS_MINMAX] = {}
|
|
3906 |
minmax_out = {}
|
|
3896 | 3907 |
for key in constants.ISPECS_MINMAX_KEYS: |
3897 | 3908 |
if fill_all: |
3898 |
ipolicy[constants.ISPECS_MINMAX][key] = \
|
|
3909 |
minmax_out[key] = \
|
|
3899 | 3910 |
objects.FillDict(constants.ISPECS_MINMAX_DEFAULTS[key], ispecs[key]) |
3900 | 3911 |
else: |
3901 |
ipolicy[constants.ISPECS_MINMAX][key] = ispecs[key] |
|
3912 |
minmax_out[key] = ispecs[key] |
|
3913 |
ipolicy[constants.ISPECS_MINMAX] = [minmax_out] |
|
3902 | 3914 |
if fill_all: |
3903 | 3915 |
ipolicy[constants.ISPECS_STD] = \ |
3904 | 3916 |
objects.FillDict(constants.IPOLICY_DEFAULTS[constants.ISPECS_STD], |
... | ... | |
3953 | 3965 |
msg = "Invalid key in bounds instance specifications: %s" % key |
3954 | 3966 |
raise errors.OpPrereqError(msg, errors.ECODE_INVAL) |
3955 | 3967 |
minmax_out[key] = _ParseISpec(spec, key, True) |
3956 |
ipolicy_out[constants.ISPECS_MINMAX] = minmax_out
|
|
3968 |
ipolicy_out[constants.ISPECS_MINMAX] = [minmax_out]
|
|
3957 | 3969 |
if std_ispecs is not None: |
3958 | 3970 |
assert not group_ipolicy # This is not an option for gnt-group |
3959 | 3971 |
ipolicy_out[constants.ISPECS_STD] = _ParseISpec(std_ispecs, "std", False) |
Also available in: Unified diff