164 |
164 |
# Type aliases
|
165 |
165 |
|
166 |
166 |
# non-empty string
|
167 |
|
_TNEString = _TAnd(_TString, _TTrue)
|
|
167 |
_TNonEmptyString = _TAnd(_TString, _TTrue)
|
168 |
168 |
|
169 |
169 |
|
170 |
170 |
# positive integer
|
171 |
|
_TPInt = _TAnd(_TInt, lambda v: v >= 0)
|
|
171 |
_TPositiveInt = _TAnd(_TInt, lambda v: v >= 0)
|
172 |
172 |
|
173 |
173 |
|
174 |
174 |
def _TListOf(my_type):
|
... | ... | |
2292 |
2292 |
"""Verifies the cluster disks sizes.
|
2293 |
2293 |
|
2294 |
2294 |
"""
|
2295 |
|
_OP_REQP = [("instances", _TListOf(_TNEString))]
|
|
2295 |
_OP_REQP = [("instances", _TListOf(_TNonEmptyString))]
|
2296 |
2296 |
REQ_BGL = False
|
2297 |
2297 |
|
2298 |
2298 |
def ExpandNames(self):
|
... | ... | |
2410 |
2410 |
"""
|
2411 |
2411 |
HPATH = "cluster-rename"
|
2412 |
2412 |
HTYPE = constants.HTYPE_CLUSTER
|
2413 |
|
_OP_REQP = [("name", _TNEString)]
|
|
2413 |
_OP_REQP = [("name", _TNonEmptyString)]
|
2414 |
2414 |
|
2415 |
2415 |
def BuildHooksEnv(self):
|
2416 |
2416 |
"""Build hooks env.
|
... | ... | |
2511 |
2511 |
HPATH = "cluster-modify"
|
2512 |
2512 |
HTYPE = constants.HTYPE_CLUSTER
|
2513 |
2513 |
_OP_REQP = [
|
2514 |
|
("hvparams", _TOr(_TDictOf(_TNEString, _TDict), _TNone)),
|
2515 |
|
("os_hvp", _TOr(_TDictOf(_TNEString, _TDict), _TNone)),
|
2516 |
|
("osparams", _TOr(_TDictOf(_TNEString, _TDict), _TNone)),
|
|
2514 |
("hvparams", _TOr(_TDictOf(_TNonEmptyString, _TDict), _TNone)),
|
|
2515 |
("os_hvp", _TOr(_TDictOf(_TNonEmptyString, _TDict), _TNone)),
|
|
2516 |
("osparams", _TOr(_TDictOf(_TNonEmptyString, _TDict), _TNone)),
|
2517 |
2517 |
("enabled_hypervisors",
|
2518 |
2518 |
_TOr(_TAnd(_TListOf(_TElemOf(constants.HYPER_TYPES)), _TTrue), _TNone)),
|
2519 |
2519 |
]
|
... | ... | |
2951 |
2951 |
|
2952 |
2952 |
"""
|
2953 |
2953 |
_OP_REQP = [
|
2954 |
|
("output_fields", _TListOf(_TNEString)),
|
2955 |
|
("names", _TListOf(_TNEString)),
|
|
2954 |
("output_fields", _TListOf(_TNonEmptyString)),
|
|
2955 |
("names", _TListOf(_TNonEmptyString)),
|
2956 |
2956 |
]
|
2957 |
2957 |
REQ_BGL = False
|
2958 |
2958 |
_FIELDS_STATIC = utils.FieldSet()
|
... | ... | |
3074 |
3074 |
"""
|
3075 |
3075 |
HPATH = "node-remove"
|
3076 |
3076 |
HTYPE = constants.HTYPE_NODE
|
3077 |
|
_OP_REQP = [("node_name", _TNEString)]
|
|
3077 |
_OP_REQP = [("node_name", _TNonEmptyString)]
|
3078 |
3078 |
|
3079 |
3079 |
def BuildHooksEnv(self):
|
3080 |
3080 |
"""Build hooks env.
|
... | ... | |
3168 |
3168 |
"""
|
3169 |
3169 |
# pylint: disable-msg=W0142
|
3170 |
3170 |
_OP_REQP = [
|
3171 |
|
("output_fields", _TListOf(_TNEString)),
|
3172 |
|
("names", _TListOf(_TNEString)),
|
|
3171 |
("output_fields", _TListOf(_TNonEmptyString)),
|
|
3172 |
("names", _TListOf(_TNonEmptyString)),
|
3173 |
3173 |
("use_locking", _TBool),
|
3174 |
3174 |
]
|
3175 |
3175 |
REQ_BGL = False
|
... | ... | |
3325 |
3325 |
|
3326 |
3326 |
"""
|
3327 |
3327 |
_OP_REQP = [
|
3328 |
|
("nodes", _TListOf(_TNEString)),
|
3329 |
|
("output_fields", _TListOf(_TNEString)),
|
|
3328 |
("nodes", _TListOf(_TNonEmptyString)),
|
|
3329 |
("output_fields", _TListOf(_TNonEmptyString)),
|
3330 |
3330 |
]
|
3331 |
3331 |
REQ_BGL = False
|
3332 |
3332 |
_FIELDS_DYNAMIC = utils.FieldSet("phys", "vg", "name", "size", "instance")
|
... | ... | |
3408 |
3408 |
"""
|
3409 |
3409 |
_FIELDS_STATIC = utils.FieldSet(constants.SF_NODE)
|
3410 |
3410 |
_OP_REQP = [
|
3411 |
|
("nodes", _TListOf(_TNEString)),
|
|
3411 |
("nodes", _TListOf(_TNonEmptyString)),
|
3412 |
3412 |
("storage_type", _CheckStorageType),
|
3413 |
|
("output_fields", _TListOf(_TNEString)),
|
|
3413 |
("output_fields", _TListOf(_TNonEmptyString)),
|
3414 |
3414 |
]
|
3415 |
3415 |
_OP_DEFS = [("name", None)]
|
3416 |
3416 |
REQ_BGL = False
|
... | ... | |
3496 |
3496 |
|
3497 |
3497 |
"""
|
3498 |
3498 |
_OP_REQP = [
|
3499 |
|
("node_name", _TNEString),
|
|
3499 |
("node_name", _TNonEmptyString),
|
3500 |
3500 |
("storage_type", _CheckStorageType),
|
3501 |
|
("name", _TNEString),
|
|
3501 |
("name", _TNonEmptyString),
|
3502 |
3502 |
("changes", _TDict),
|
3503 |
3503 |
]
|
3504 |
3504 |
REQ_BGL = False
|
... | ... | |
3546 |
3546 |
HPATH = "node-add"
|
3547 |
3547 |
HTYPE = constants.HTYPE_NODE
|
3548 |
3548 |
_OP_REQP = [
|
3549 |
|
("node_name", _TNEString),
|
|
3549 |
("node_name", _TNonEmptyString),
|
3550 |
3550 |
]
|
3551 |
3551 |
_OP_DEFS = [("secondary_ip", None)]
|
3552 |
3552 |
|
... | ... | |
3778 |
3778 |
"""
|
3779 |
3779 |
HPATH = "node-modify"
|
3780 |
3780 |
HTYPE = constants.HTYPE_NODE
|
3781 |
|
_OP_REQP = [("node_name", _TNEString)]
|
|
3781 |
_OP_REQP = [("node_name", _TNonEmptyString)]
|
3782 |
3782 |
REQ_BGL = False
|
3783 |
3783 |
|
3784 |
3784 |
def CheckArguments(self):
|
... | ... | |
3940 |
3940 |
|
3941 |
3941 |
"""
|
3942 |
3942 |
_OP_REQP = [
|
3943 |
|
("node_name", _TNEString),
|
|
3943 |
("node_name", _TNonEmptyString),
|
3944 |
3944 |
("force", _TBool),
|
3945 |
3945 |
]
|
3946 |
3946 |
REQ_BGL = False
|
... | ... | |
4069 |
4069 |
"""Bring up an instance's disks.
|
4070 |
4070 |
|
4071 |
4071 |
"""
|
4072 |
|
_OP_REQP = [("instance_name", _TNEString)]
|
|
4072 |
_OP_REQP = [("instance_name", _TNonEmptyString)]
|
4073 |
4073 |
_OP_DEFS = [("ignore_size", False)]
|
4074 |
4074 |
REQ_BGL = False
|
4075 |
4075 |
|
... | ... | |
4213 |
4213 |
"""Shutdown an instance's disks.
|
4214 |
4214 |
|
4215 |
4215 |
"""
|
4216 |
|
_OP_REQP = [("instance_name", _TNEString)]
|
|
4216 |
_OP_REQP = [("instance_name", _TNonEmptyString)]
|
4217 |
4217 |
REQ_BGL = False
|
4218 |
4218 |
|
4219 |
4219 |
def ExpandNames(self):
|
... | ... | |
4377 |
4377 |
HPATH = "instance-start"
|
4378 |
4378 |
HTYPE = constants.HTYPE_INSTANCE
|
4379 |
4379 |
_OP_REQP = [
|
4380 |
|
("instance_name", _TNEString),
|
|
4380 |
("instance_name", _TNonEmptyString),
|
4381 |
4381 |
("force", _TBool),
|
4382 |
4382 |
("beparams", _TDict),
|
4383 |
4383 |
("hvparams", _TDict),
|
... | ... | |
4475 |
4475 |
HPATH = "instance-reboot"
|
4476 |
4476 |
HTYPE = constants.HTYPE_INSTANCE
|
4477 |
4477 |
_OP_REQP = [
|
4478 |
|
("instance_name", _TNEString),
|
|
4478 |
("instance_name", _TNonEmptyString),
|
4479 |
4479 |
("ignore_secondaries", _TBool),
|
4480 |
4480 |
("reboot_type", _TElemOf(constants.REBOOT_TYPES)),
|
4481 |
4481 |
]
|
... | ... | |
4555 |
4555 |
"""
|
4556 |
4556 |
HPATH = "instance-stop"
|
4557 |
4557 |
HTYPE = constants.HTYPE_INSTANCE
|
4558 |
|
_OP_REQP = [("instance_name", _TNEString)]
|
|
4558 |
_OP_REQP = [("instance_name", _TNonEmptyString)]
|
4559 |
4559 |
_OP_DEFS = [("timeout", constants.DEFAULT_SHUTDOWN_TIMEOUT)]
|
4560 |
4560 |
REQ_BGL = False
|
4561 |
4561 |
|
... | ... | |
4606 |
4606 |
"""
|
4607 |
4607 |
HPATH = "instance-reinstall"
|
4608 |
4608 |
HTYPE = constants.HTYPE_INSTANCE
|
4609 |
|
_OP_REQP = [("instance_name", _TNEString)]
|
|
4609 |
_OP_REQP = [("instance_name", _TNonEmptyString)]
|
4610 |
4610 |
_OP_DEFS = [
|
4611 |
4611 |
("os_type", None),
|
4612 |
4612 |
("force_variant", False),
|
... | ... | |
4680 |
4680 |
HPATH = "instance-recreate-disks"
|
4681 |
4681 |
HTYPE = constants.HTYPE_INSTANCE
|
4682 |
4682 |
_OP_REQP = [
|
4683 |
|
("instance_name", _TNEString),
|
4684 |
|
("disks", _TListOf(_TPInt)),
|
|
4683 |
("instance_name", _TNonEmptyString),
|
|
4684 |
("disks", _TListOf(_TPositiveInt)),
|
4685 |
4685 |
]
|
4686 |
4686 |
REQ_BGL = False
|
4687 |
4687 |
|
... | ... | |
4744 |
4744 |
HPATH = "instance-rename"
|
4745 |
4745 |
HTYPE = constants.HTYPE_INSTANCE
|
4746 |
4746 |
_OP_REQP = [
|
4747 |
|
("instance_name", _TNEString),
|
4748 |
|
("new_name", _TNEString),
|
|
4747 |
("instance_name", _TNonEmptyString),
|
|
4748 |
("new_name", _TNonEmptyString),
|
4749 |
4749 |
]
|
4750 |
4750 |
_OP_DEFS = [("ignore_ip", False)]
|
4751 |
4751 |
|
... | ... | |
4838 |
4838 |
HPATH = "instance-remove"
|
4839 |
4839 |
HTYPE = constants.HTYPE_INSTANCE
|
4840 |
4840 |
_OP_REQP = [
|
4841 |
|
("instance_name", _TNEString),
|
|
4841 |
("instance_name", _TNonEmptyString),
|
4842 |
4842 |
("ignore_failures", _TBool),
|
4843 |
4843 |
]
|
4844 |
4844 |
_OP_DEFS = [("shutdown_timeout", constants.DEFAULT_SHUTDOWN_TIMEOUT)]
|
... | ... | |
4925 |
4925 |
"""
|
4926 |
4926 |
# pylint: disable-msg=W0142
|
4927 |
4927 |
_OP_REQP = [
|
4928 |
|
("output_fields", _TListOf(_TNEString)),
|
4929 |
|
("names", _TListOf(_TNEString)),
|
|
4928 |
("output_fields", _TListOf(_TNonEmptyString)),
|
|
4929 |
("names", _TListOf(_TNonEmptyString)),
|
4930 |
4930 |
("use_locking", _TBool),
|
4931 |
4931 |
]
|
4932 |
4932 |
REQ_BGL = False
|
... | ... | |
5207 |
5207 |
HPATH = "instance-failover"
|
5208 |
5208 |
HTYPE = constants.HTYPE_INSTANCE
|
5209 |
5209 |
_OP_REQP = [
|
5210 |
|
("instance_name", _TNEString),
|
|
5210 |
("instance_name", _TNonEmptyString),
|
5211 |
5211 |
("ignore_consistency", _TBool),
|
5212 |
5212 |
]
|
5213 |
5213 |
_OP_DEFS = [("shutdown_timeout", constants.DEFAULT_SHUTDOWN_TIMEOUT)]
|
... | ... | |
5361 |
5361 |
HPATH = "instance-migrate"
|
5362 |
5362 |
HTYPE = constants.HTYPE_INSTANCE
|
5363 |
5363 |
_OP_REQP = [
|
5364 |
|
("instance_name", _TNEString),
|
|
5364 |
("instance_name", _TNonEmptyString),
|
5365 |
5365 |
("live", _TBool),
|
5366 |
5366 |
("cleanup", _TBool),
|
5367 |
5367 |
]
|
... | ... | |
5413 |
5413 |
HPATH = "instance-move"
|
5414 |
5414 |
HTYPE = constants.HTYPE_INSTANCE
|
5415 |
5415 |
_OP_REQP = [
|
5416 |
|
("instance_name", _TNEString),
|
5417 |
|
("target_node", _TNEString),
|
|
5416 |
("instance_name", _TNonEmptyString),
|
|
5417 |
("target_node", _TNonEmptyString),
|
5418 |
5418 |
]
|
5419 |
5419 |
_OP_DEFS = [("shutdown_timeout", constants.DEFAULT_SHUTDOWN_TIMEOUT)]
|
5420 |
5420 |
REQ_BGL = False
|
... | ... | |
5592 |
5592 |
HPATH = "node-migrate"
|
5593 |
5593 |
HTYPE = constants.HTYPE_NODE
|
5594 |
5594 |
_OP_REQP = [
|
5595 |
|
("node_name", _TNEString),
|
|
5595 |
("node_name", _TNonEmptyString),
|
5596 |
5596 |
("live", _TBool),
|
5597 |
5597 |
]
|
5598 |
5598 |
REQ_BGL = False
|
... | ... | |
6329 |
6329 |
HPATH = "instance-add"
|
6330 |
6330 |
HTYPE = constants.HTYPE_INSTANCE
|
6331 |
6331 |
_OP_REQP = [
|
6332 |
|
("instance_name", _TNEString),
|
|
6332 |
("instance_name", _TNonEmptyString),
|
6333 |
6333 |
("mode", _TElemOf(constants.INSTANCE_CREATE_MODES)),
|
6334 |
6334 |
("start", _TBool),
|
6335 |
6335 |
("wait_for_sync", _TBool),
|
... | ... | |
7236 |
7236 |
console.
|
7237 |
7237 |
|
7238 |
7238 |
"""
|
7239 |
|
_OP_REQP = [("instance_name", _TNEString)]
|
|
7239 |
_OP_REQP = [("instance_name", _TNonEmptyString)]
|
7240 |
7240 |
REQ_BGL = False
|
7241 |
7241 |
|
7242 |
7242 |
def ExpandNames(self):
|
... | ... | |
7288 |
7288 |
HPATH = "mirrors-replace"
|
7289 |
7289 |
HTYPE = constants.HTYPE_INSTANCE
|
7290 |
7290 |
_OP_REQP = [
|
7291 |
|
("instance_name", _TNEString),
|
|
7291 |
("instance_name", _TNonEmptyString),
|
7292 |
7292 |
("mode", _TElemOf(constants.REPLACE_MODES)),
|
7293 |
|
("disks", _TListOf(_TPInt)),
|
|
7293 |
("disks", _TListOf(_TPositiveInt)),
|
7294 |
7294 |
]
|
7295 |
7295 |
_OP_DEFS = [
|
7296 |
7296 |
("remote_node", None),
|
... | ... | |
8032 |
8032 |
"""Repairs the volume group on a node.
|
8033 |
8033 |
|
8034 |
8034 |
"""
|
8035 |
|
_OP_REQP = [("node_name", _TNEString)]
|
|
8035 |
_OP_REQP = [("node_name", _TNonEmptyString)]
|
8036 |
8036 |
REQ_BGL = False
|
8037 |
8037 |
|
8038 |
8038 |
def CheckArguments(self):
|
... | ... | |
8097 |
8097 |
"""Computes the node evacuation strategy.
|
8098 |
8098 |
|
8099 |
8099 |
"""
|
8100 |
|
_OP_REQP = [("nodes", _TListOf(_TNEString))]
|
|
8100 |
_OP_REQP = [("nodes", _TListOf(_TNonEmptyString))]
|
8101 |
8101 |
_OP_DEFS = [
|
8102 |
8102 |
("remote_node", None),
|
8103 |
8103 |
("iallocator", None),
|
... | ... | |
8151 |
8151 |
HPATH = "disk-grow"
|
8152 |
8152 |
HTYPE = constants.HTYPE_INSTANCE
|
8153 |
8153 |
_OP_REQP = [
|
8154 |
|
("instance_name", _TNEString),
|
|
8154 |
("instance_name", _TNonEmptyString),
|
8155 |
8155 |
("disk", _TInt),
|
8156 |
8156 |
("amount", _TInt),
|
8157 |
8157 |
("wait_for_sync", _TBool),
|
... | ... | |
8250 |
8250 |
|
8251 |
8251 |
"""
|
8252 |
8252 |
_OP_REQP = [
|
8253 |
|
("instances", _TListOf(_TNEString)),
|
|
8253 |
("instances", _TListOf(_TNonEmptyString)),
|
8254 |
8254 |
("static", _TBool),
|
8255 |
8255 |
]
|
8256 |
8256 |
REQ_BGL = False
|
... | ... | |
8409 |
8409 |
"""
|
8410 |
8410 |
HPATH = "instance-modify"
|
8411 |
8411 |
HTYPE = constants.HTYPE_INSTANCE
|
8412 |
|
_OP_REQP = [("instance_name", _TNEString)]
|
|
8412 |
_OP_REQP = [("instance_name", _TNonEmptyString)]
|
8413 |
8413 |
_OP_DEFS = [
|
8414 |
8414 |
("nics", _EmptyList),
|
8415 |
8415 |
("disks", _EmptyList),
|
... | ... | |
9071 |
9071 |
"""Query the exports list
|
9072 |
9072 |
|
9073 |
9073 |
"""
|
9074 |
|
_OP_REQP = [("nodes", _TListOf(_TNEString))]
|
|
9074 |
_OP_REQP = [("nodes", _TListOf(_TNonEmptyString))]
|
9075 |
9075 |
REQ_BGL = False
|
9076 |
9076 |
|
9077 |
9077 |
def ExpandNames(self):
|
... | ... | |
9109 |
9109 |
|
9110 |
9110 |
"""
|
9111 |
9111 |
_OP_REQP = [
|
9112 |
|
("instance_name", _TNEString),
|
|
9112 |
("instance_name", _TNonEmptyString),
|
9113 |
9113 |
("mode", _TElemOf(constants.EXPORT_MODES)),
|
9114 |
9114 |
]
|
9115 |
9115 |
REQ_BGL = False
|
... | ... | |
9166 |
9166 |
HPATH = "instance-export"
|
9167 |
9167 |
HTYPE = constants.HTYPE_INSTANCE
|
9168 |
9168 |
_OP_REQP = [
|
9169 |
|
("instance_name", _TNEString),
|
9170 |
|
("target_node", _TNEString),
|
|
9169 |
("instance_name", _TNonEmptyString),
|
|
9170 |
("target_node", _TNonEmptyString),
|
9171 |
9171 |
("shutdown", _TBool),
|
9172 |
9172 |
("mode", _TElemOf(constants.EXPORT_MODES)),
|
9173 |
9173 |
]
|
... | ... | |
9454 |
9454 |
"""Remove exports related to the named instance.
|
9455 |
9455 |
|
9456 |
9456 |
"""
|
9457 |
|
_OP_REQP = [("instance_name", _TNEString)]
|
|
9457 |
_OP_REQP = [("instance_name", _TNonEmptyString)]
|
9458 |
9458 |
REQ_BGL = False
|
9459 |
9459 |
|
9460 |
9460 |
def ExpandNames(self):
|
... | ... | |
9535 |
9535 |
"""
|
9536 |
9536 |
_OP_REQP = [
|
9537 |
9537 |
("kind", _TElemOf(constants.VALID_TAG_TYPES)),
|
9538 |
|
("name", _TNEString),
|
|
9538 |
("name", _TNonEmptyString),
|
9539 |
9539 |
]
|
9540 |
9540 |
REQ_BGL = False
|
9541 |
9541 |
|
... | ... | |
9550 |
9550 |
"""Searches the tags for a given pattern.
|
9551 |
9551 |
|
9552 |
9552 |
"""
|
9553 |
|
_OP_REQP = [("pattern", _TNEString)]
|
|
9553 |
_OP_REQP = [("pattern", _TNonEmptyString)]
|
9554 |
9554 |
REQ_BGL = False
|
9555 |
9555 |
|
9556 |
9556 |
def ExpandNames(self):
|
... | ... | |
9592 |
9592 |
"""
|
9593 |
9593 |
_OP_REQP = [
|
9594 |
9594 |
("kind", _TElemOf(constants.VALID_TAG_TYPES)),
|
9595 |
|
("name", _TNEString),
|
|
9595 |
("name", _TNonEmptyString),
|
9596 |
9596 |
("tags", _TListOf(objects.TaggableObject.ValidateTag)),
|
9597 |
9597 |
]
|
9598 |
9598 |
REQ_BGL = False
|
... | ... | |
9625 |
9625 |
"""
|
9626 |
9626 |
_OP_REQP = [
|
9627 |
9627 |
("kind", _TElemOf(constants.VALID_TAG_TYPES)),
|
9628 |
|
("name", _TNEString),
|
|
9628 |
("name", _TNonEmptyString),
|
9629 |
9629 |
("tags", _TListOf(objects.TaggableObject.ValidateTag)),
|
9630 |
9630 |
]
|
9631 |
9631 |
REQ_BGL = False
|
... | ... | |
9667 |
9667 |
_OP_REQP = [
|
9668 |
9668 |
("duration", _TFloat),
|
9669 |
9669 |
("on_master", _TBool),
|
9670 |
|
("on_nodes", _TListOf(_TNEString)),
|
|
9670 |
("on_nodes", _TListOf(_TNonEmptyString)),
|
9671 |
9671 |
]
|
9672 |
9672 |
REQ_BGL = False
|
9673 |
9673 |
|
... | ... | |
10051 |
10051 |
_OP_REQP = [
|
10052 |
10052 |
("direction", _TElemOf(constants.VALID_IALLOCATOR_DIRECTIONS)),
|
10053 |
10053 |
("mode", _TElemOf(constants.VALID_IALLOCATOR_MODES)),
|
10054 |
|
("name", _TNEString),
|
|
10054 |
("name", _TNonEmptyString),
|
10055 |
10055 |
("nics", _TOr(_TNone, _TListOf(
|
10056 |
|
_TDictOf(_TElemOf(["mac", "ip", "bridge"]), _TNEString)))),
|
|
10056 |
_TDictOf(_TElemOf(["mac", "ip", "bridge"]), _TNonEmptyString)))),
|
10057 |
10057 |
("disks", _TOr(_TNone, _TList)),
|
10058 |
10058 |
]
|
10059 |
10059 |
_OP_DEFS = [
|