Revision d67e0a94
b/lib/cli.py | ||
---|---|---|
810 | 810 |
|
811 | 811 |
SPECS_MEM_SIZE_OPT = cli_option("--specs-mem-size", dest="ispecs_mem_size", |
812 | 812 |
type="keyval", default={}, |
813 |
help="Memory count specs: min, max, std" |
|
814 |
" (in MB)") |
|
813 |
help="Memory size specs: list of key=value," |
|
814 |
" where key is one of min, max, std" |
|
815 |
" (in MB or using a unit)") |
|
815 | 816 |
|
816 | 817 |
SPECS_CPU_COUNT_OPT = cli_option("--specs-cpu-count", dest="ispecs_cpu_count", |
817 | 818 |
type="keyval", default={}, |
818 |
help="CPU count specs: min, max, std") |
|
819 |
help="CPU count specs: list of key=value," |
|
820 |
" where key is one of min, max, std") |
|
819 | 821 |
|
820 | 822 |
SPECS_DISK_COUNT_OPT = cli_option("--specs-disk-count", |
821 | 823 |
dest="ispecs_disk_count", |
822 | 824 |
type="keyval", default={}, |
823 |
help="Disk count specs: min, max, std") |
|
825 |
help="Disk count specs: list of key=value," |
|
826 |
" where key is one of min, max, std") |
|
824 | 827 |
|
825 | 828 |
SPECS_DISK_SIZE_OPT = cli_option("--specs-disk-size", dest="ispecs_disk_size", |
826 | 829 |
type="keyval", default={}, |
827 |
help="Disk size specs: min, max, std (in MB)") |
|
830 |
help="Disk size specs: list of key=value," |
|
831 |
" where key is one of min, max, std" |
|
832 |
" (in MB or using a unit)") |
|
828 | 833 |
|
829 | 834 |
SPECS_NIC_COUNT_OPT = cli_option("--specs-nic-count", dest="ispecs_nic_count", |
830 | 835 |
type="keyval", default={}, |
831 |
help="NIC count specs: min, max, std") |
|
836 |
help="NIC count specs: list of key=value," |
|
837 |
" where key is one of min, max, std") |
|
832 | 838 |
|
833 | 839 |
IPOLICY_DISK_TEMPLATES = cli_option("--ipolicy-disk-templates", |
834 | 840 |
dest="ipolicy_disk_templates", |
... | ... | |
3427 | 3433 |
|
3428 | 3434 |
|
3429 | 3435 |
""" |
3436 |
try: |
|
3437 |
if ispecs_mem_size: |
|
3438 |
for k in ispecs_mem_size: |
|
3439 |
ispecs_mem_size[k] = utils.ParseUnit(ispecs_mem_size[k]) |
|
3440 |
if ispecs_disk_size: |
|
3441 |
for k in ispecs_disk_size: |
|
3442 |
ispecs_disk_size[k] = utils.ParseUnit(ispecs_disk_size[k]) |
|
3443 |
except (TypeError, ValueError, errors.UnitParseError), err: |
|
3444 |
raise errors.OpPrereqError("Invalid disk (%s) or memory (%s) size" |
|
3445 |
" in policy: %s" % |
|
3446 |
(ispecs_disk_size, ispecs_mem_size, err), |
|
3447 |
errors.ECODE_INVAL) |
|
3448 |
|
|
3430 | 3449 |
# prepare ipolicy dict |
3431 | 3450 |
ipolicy_transposed = { |
3432 | 3451 |
constants.ISPEC_MEM_SIZE: ispecs_mem_size, |
Also available in: Unified diff