Revision a604f165 lib/cli.py
b/lib/cli.py | ||
---|---|---|
49 | 49 |
"ListTags", "AddTags", "RemoveTags", "TAG_SRC_OPT", |
50 | 50 |
"FormatError", "SplitNodeOption", "SubmitOrSend", |
51 | 51 |
"JobSubmittedException", "FormatTimestamp", "ParseTimespec", |
52 |
"ValidateBeParams", |
|
52 | 53 |
] |
53 | 54 |
|
54 | 55 |
|
... | ... | |
401 | 402 |
return (value, None) |
402 | 403 |
|
403 | 404 |
|
405 |
def ValidateBeParams(bep): |
|
406 |
"""Parse and check the given beparams. |
|
407 |
|
|
408 |
The function will update in-place the given dictionary. |
|
409 |
|
|
410 |
@type bep: dict |
|
411 |
@param bep: input beparams |
|
412 |
@raise errors.ParameterError: if the input values are not OK |
|
413 |
@raise errors.UnitParseError: if the input values are not OK |
|
414 |
|
|
415 |
""" |
|
416 |
if constants.BE_MEMORY in bep: |
|
417 |
bep[constants.BE_MEMORY] = utils.ParseUnit(bep[constants.BE_MEMORY]) |
|
418 |
|
|
419 |
if constants.BE_VCPUS in bep: |
|
420 |
try: |
|
421 |
bep[constants.BE_VCPUS] = int(bep[constants.BE_VCPUS]) |
|
422 |
except ValueError: |
|
423 |
raise errors.ParameterError("Invalid number of VCPUs") |
|
424 |
|
|
425 |
|
|
404 | 426 |
def AskUser(text, choices=None): |
405 | 427 |
"""Ask the user a question. |
406 | 428 |
|
Also available in: Unified diff