74 |
74 |
|
75 |
75 |
#: Migration type (live/non-live)
|
76 |
76 |
_PMigrationMode = ("mode", None,
|
77 |
|
ht.TOr(ht.TNone, ht.TElemOf(constants.HT_MIGRATION_MODES)),
|
|
77 |
ht.TMaybe(ht.TElemOf(constants.HT_MIGRATION_MODES)),
|
78 |
78 |
"Migration mode")
|
79 |
79 |
|
80 |
80 |
#: Obsolete 'live' migration mode (boolean)
|
... | ... | |
111 |
111 |
|
112 |
112 |
_PNodeGroupAllocPolicy = \
|
113 |
113 |
("alloc_policy", None,
|
114 |
|
ht.TOr(ht.TNone, ht.TElemOf(constants.VALID_ALLOC_POLICIES)),
|
|
114 |
ht.TMaybe(ht.TElemOf(constants.VALID_ALLOC_POLICIES)),
|
115 |
115 |
"Instance allocation policy")
|
116 |
116 |
|
117 |
117 |
_PGroupNodeParams = ("ndparams", None, ht.TMaybeDict,
|
... | ... | |
152 |
152 |
# Disk parameters
|
153 |
153 |
_PDiskParams = \
|
154 |
154 |
("diskparams", None,
|
155 |
|
ht.TOr(ht.TNone,
|
156 |
|
ht.TDictOf(ht.TElemOf(constants.DISK_TEMPLATES), ht.TDict)),
|
|
155 |
ht.TMaybe(ht.TDictOf(ht.TElemOf(constants.DISK_TEMPLATES), ht.TDict)),
|
157 |
156 |
"Disk templates' parameter defaults")
|
158 |
157 |
|
159 |
158 |
# Parameters for node resource model
|
... | ... | |
188 |
187 |
#: Utility function for testing NIC definitions
|
189 |
188 |
_TestNicDef = \
|
190 |
189 |
ht.Comment("NIC parameters")(ht.TDictOf(ht.TElemOf(constants.INIC_PARAMS),
|
191 |
|
ht.TOr(ht.TNone, ht.TNonEmptyString)))
|
|
190 |
ht.TMaybeString))
|
192 |
191 |
|
193 |
192 |
_TSetParamsResultItemItems = [
|
194 |
193 |
ht.Comment("name of changed parameter")(ht.TNonEmptyString),
|
... | ... | |
325 |
324 |
template_check = ht.TElemOf(constants.DISK_TEMPLATES)
|
326 |
325 |
|
327 |
326 |
if accept_none:
|
328 |
|
template_check = ht.TOr(ht.TNone, template_check)
|
|
327 |
template_check = ht.TMaybe(template_check)
|
329 |
328 |
|
330 |
329 |
return ht.TAnd(template_check, _CheckFileStorage)
|
331 |
330 |
|
... | ... | |
350 |
349 |
_CheckNetworkType = ht.TElemOf(constants.NETWORK_VALID_TYPES)
|
351 |
350 |
|
352 |
351 |
#: Network type parameter
|
353 |
|
_PNetworkType = ("network_type", None, ht.TOr(ht.TNone, _CheckNetworkType),
|
|
352 |
_PNetworkType = ("network_type", None, ht.TMaybe(_CheckNetworkType),
|
354 |
353 |
"Network type")
|
355 |
354 |
|
356 |
355 |
|
... | ... | |
599 |
598 |
WITH_LU = True
|
600 |
599 |
OP_PARAMS = [
|
601 |
600 |
("dry_run", None, ht.TMaybeBool, "Run checks only, don't execute"),
|
602 |
|
("debug_level", None, ht.TOr(ht.TNone, ht.TNonNegativeInt), "Debug level"),
|
|
601 |
("debug_level", None, ht.TMaybe(ht.TNonNegativeInt), "Debug level"),
|
603 |
602 |
("priority", constants.OP_PRIO_DEFAULT,
|
604 |
603 |
ht.TElemOf(constants.OP_PRIO_SUBMIT_VALID), "Opcode priority"),
|
605 |
604 |
(DEPEND_ATTR, None, _BuildJobDepCheck(True),
|
... | ... | |
864 |
863 |
OP_PARAMS = [
|
865 |
864 |
_PHvState,
|
866 |
865 |
_PDiskState,
|
867 |
|
("vg_name", None, ht.TOr(ht.TNone, ht.TString), "Volume group name"),
|
|
866 |
("vg_name", None, ht.TMaybe(ht.TString), "Volume group name"),
|
868 |
867 |
("enabled_hypervisors", None,
|
869 |
|
ht.TOr(ht.TNone,
|
870 |
|
ht.TAnd(ht.TListOf(ht.TElemOf(constants.HYPER_TYPES)), ht.TTrue)),
|
|
868 |
ht.TMaybe(ht.TAnd(ht.TListOf(ht.TElemOf(constants.HYPER_TYPES)),
|
|
869 |
ht.TTrue)),
|
871 |
870 |
"List of enabled hypervisors"),
|
872 |
871 |
("hvparams", None,
|
873 |
|
ht.TOr(ht.TNone, ht.TDictOf(ht.TNonEmptyString, ht.TDict)),
|
|
872 |
ht.TMaybe(ht.TDictOf(ht.TNonEmptyString, ht.TDict)),
|
874 |
873 |
"Cluster-wide hypervisor parameter defaults, hypervisor-dependent"),
|
875 |
|
("beparams", None, ht.TOr(ht.TNone, ht.TDict),
|
|
874 |
("beparams", None, ht.TMaybeDict,
|
876 |
875 |
"Cluster-wide backend parameter defaults"),
|
877 |
|
("os_hvp", None, ht.TOr(ht.TNone, ht.TDictOf(ht.TNonEmptyString, ht.TDict)),
|
|
876 |
("os_hvp", None, ht.TMaybe(ht.TDictOf(ht.TNonEmptyString, ht.TDict)),
|
878 |
877 |
"Cluster-wide per-OS hypervisor parameter defaults"),
|
879 |
878 |
("osparams", None,
|
880 |
|
ht.TOr(ht.TNone, ht.TDictOf(ht.TNonEmptyString, ht.TDict)),
|
|
879 |
ht.TMaybe(ht.TDictOf(ht.TNonEmptyString, ht.TDict)),
|
881 |
880 |
"Cluster-wide OS parameter defaults"),
|
882 |
881 |
_PDiskParams,
|
883 |
|
("candidate_pool_size", None, ht.TOr(ht.TNone, ht.TPositiveInt),
|
|
882 |
("candidate_pool_size", None, ht.TMaybe(ht.TPositiveInt),
|
884 |
883 |
"Master candidate pool size"),
|
885 |
884 |
("uid_pool", None, ht.NoType,
|
886 |
885 |
"Set UID pool, must be list of lists describing UID ranges (two items,"
|
... | ... | |
899 |
898 |
("ndparams", None, ht.TMaybeDict, "Cluster-wide node parameter defaults"),
|
900 |
899 |
("ipolicy", None, ht.TMaybeDict,
|
901 |
900 |
"Cluster-wide :ref:`instance policy <rapi-ipolicy>` specs"),
|
902 |
|
("drbd_helper", None, ht.TOr(ht.TNone, ht.TString), "DRBD helper program"),
|
903 |
|
("default_iallocator", None, ht.TOr(ht.TNone, ht.TString),
|
|
901 |
("drbd_helper", None, ht.TMaybe(ht.TString), "DRBD helper program"),
|
|
902 |
("default_iallocator", None, ht.TMaybe(ht.TString),
|
904 |
903 |
"Default iallocator for cluster"),
|
905 |
|
("master_netdev", None, ht.TOr(ht.TNone, ht.TString),
|
|
904 |
("master_netdev", None, ht.TMaybe(ht.TString),
|
906 |
905 |
"Master network device"),
|
907 |
|
("master_netmask", None, ht.TOr(ht.TNone, ht.TInt),
|
|
906 |
("master_netmask", None, ht.TMaybe(ht.TNonNegativeInt),
|
908 |
907 |
"Netmask of the master IP"),
|
909 |
908 |
("reserved_lvs", None, ht.TMaybeListOf(ht.TNonEmptyString),
|
910 |
909 |
"List of reserved LVs"),
|
... | ... | |
957 |
956 |
_PUseLocking,
|
958 |
957 |
("fields", ht.NoDefault, ht.TListOf(ht.TNonEmptyString),
|
959 |
958 |
"Requested fields"),
|
960 |
|
("qfilter", None, ht.TOr(ht.TNone, ht.TList),
|
|
959 |
("qfilter", None, ht.TMaybe(ht.TList),
|
961 |
960 |
"Query filter"),
|
962 |
961 |
]
|
963 |
962 |
OP_RESULT = \
|
... | ... | |
1246 |
1245 |
" or ".join("``%s``" % i for i in sorted(constants.DISK_ACCESS_SET)))),
|
1247 |
1246 |
("disk_template", ht.NoDefault, _BuildDiskTemplateCheck(True),
|
1248 |
1247 |
"Disk template"),
|
1249 |
|
("file_driver", None, ht.TOr(ht.TNone, ht.TElemOf(constants.FILE_DRIVER)),
|
|
1248 |
("file_driver", None, ht.TMaybe(ht.TElemOf(constants.FILE_DRIVER)),
|
1250 |
1249 |
"Driver for file-backed disks"),
|
1251 |
1250 |
("file_storage_dir", None, ht.TMaybeString,
|
1252 |
1251 |
"Directory for storing file-backed disks"),
|
... | ... | |
1273 |
1272 |
("os_type", None, ht.TMaybeString, "Operating system"),
|
1274 |
1273 |
("pnode", None, ht.TMaybeString, "Primary node"),
|
1275 |
1274 |
("snode", None, ht.TMaybeString, "Secondary node"),
|
1276 |
|
("source_handshake", None, ht.TOr(ht.TNone, ht.TList),
|
|
1275 |
("source_handshake", None, ht.TMaybe(ht.TList),
|
1277 |
1276 |
"Signed handshake from source (remote import only)"),
|
1278 |
1277 |
("source_instance_name", None, ht.TMaybeString,
|
1279 |
1278 |
"Source instance name (remote import only)"),
|
... | ... | |
1642 |
1641 |
("runtime_mem", None, ht.TMaybePositiveInt, "New runtime memory"),
|
1643 |
1642 |
("hvparams", ht.EmptyDict, ht.TDict,
|
1644 |
1643 |
"Per-instance hypervisor parameters, hypervisor-dependent"),
|
1645 |
|
("disk_template", None, ht.TOr(ht.TNone, _BuildDiskTemplateCheck(False)),
|
|
1644 |
("disk_template", None, ht.TMaybe(_BuildDiskTemplateCheck(False)),
|
1646 |
1645 |
"Disk template for instance"),
|
1647 |
1646 |
("remote_node", None, ht.TMaybeString,
|
1648 |
1647 |
"Secondary node (used when changing disk template)"),
|
... | ... | |
1808 |
1807 |
("mode", ht.NoDefault, ht.TElemOf(constants.EXPORT_MODES),
|
1809 |
1808 |
"Export mode"),
|
1810 |
1809 |
]
|
1811 |
|
OP_RESULT = ht.TOr(ht.TNone, ht.TDict)
|
|
1810 |
OP_RESULT = ht.TMaybeDict
|
1812 |
1811 |
|
1813 |
1812 |
|
1814 |
1813 |
class OpBackupExport(OpCode):
|
... | ... | |
1842 |
1841 |
"Whether to ignore failures while removing instances"),
|
1843 |
1842 |
("mode", constants.EXPORT_MODE_LOCAL, ht.TElemOf(constants.EXPORT_MODES),
|
1844 |
1843 |
"Export mode"),
|
1845 |
|
("x509_key_name", None, ht.TOr(ht.TNone, ht.TList),
|
|
1844 |
("x509_key_name", None, ht.TMaybe(ht.TList),
|
1846 |
1845 |
"Name of X509 key (remote export only)"),
|
1847 |
1846 |
("destination_x509_ca", None, ht.TMaybeString,
|
1848 |
1847 |
"Destination X509 CA (remote export only)"),
|
... | ... | |
1967 |
1966 |
ht.TMaybeListOf(ht.TDictOf(ht.TElemOf([constants.INIC_MAC,
|
1968 |
1967 |
constants.INIC_IP,
|
1969 |
1968 |
"bridge"]),
|
1970 |
|
ht.TOr(ht.TNone, ht.TNonEmptyString))),
|
|
1969 |
ht.TMaybeString)),
|
1971 |
1970 |
None),
|
1972 |
|
("disks", ht.NoDefault, ht.TOr(ht.TNone, ht.TList), None),
|
|
1971 |
("disks", ht.NoDefault, ht.TMaybe(ht.TList), None),
|
1973 |
1972 |
("hypervisor", None, ht.TMaybeString, None),
|
1974 |
1973 |
("allocator", None, ht.TMaybeString, None),
|
1975 |
1974 |
("tags", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), None),
|
1976 |
|
("memory", None, ht.TOr(ht.TNone, ht.TNonNegativeInt), None),
|
1977 |
|
("vcpus", None, ht.TOr(ht.TNone, ht.TNonNegativeInt), None),
|
|
1975 |
("memory", None, ht.TMaybe(ht.TNonNegativeInt), None),
|
|
1976 |
("vcpus", None, ht.TMaybe(ht.TNonNegativeInt), None),
|
1978 |
1977 |
("os", None, ht.TMaybeString, None),
|
1979 |
1978 |
("disk_template", None, ht.TMaybeString, None),
|
1980 |
1979 |
("instances", None, ht.TMaybeListOf(ht.TNonEmptyString), None),
|
1981 |
1980 |
("evac_mode", None,
|
1982 |
|
ht.TOr(ht.TNone, ht.TElemOf(constants.IALLOCATOR_NEVAC_MODES)), None),
|
|
1981 |
ht.TMaybe(ht.TElemOf(constants.IALLOCATOR_NEVAC_MODES)), None),
|
1983 |
1982 |
("target_groups", None, ht.TMaybeListOf(ht.TNonEmptyString), None),
|
1984 |
1983 |
("spindle_use", 1, ht.TNonNegativeInt, None),
|
1985 |
1984 |
("count", 1, ht.TNonNegativeInt, None),
|
... | ... | |
2026 |
2025 |
("mac_prefix", None, ht.TMaybeString,
|
2027 |
2026 |
"MAC address prefix that overrides cluster one"),
|
2028 |
2027 |
("add_reserved_ips", None,
|
2029 |
|
ht.TOr(ht.TNone, ht.TListOf(_CheckCIDRAddrNotation)),
|
|
2028 |
ht.TMaybe(ht.TListOf(_CheckCIDRAddrNotation)),
|
2030 |
2029 |
"Which IP addresses to reserve"),
|
2031 |
2030 |
("tags", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), "Network tags"),
|
2032 |
2031 |
]
|
... | ... | |
2058 |
2057 |
("mac_prefix", None, ht.TMaybeString,
|
2059 |
2058 |
"MAC address prefix that overrides cluster one"),
|
2060 |
2059 |
("add_reserved_ips", None,
|
2061 |
|
ht.TOr(ht.TNone, ht.TListOf(_CheckCIDRAddrNotation)),
|
|
2060 |
ht.TMaybe(ht.TListOf(_CheckCIDRAddrNotation)),
|
2062 |
2061 |
"Which external IP addresses to reserve"),
|
2063 |
2062 |
("remove_reserved_ips", None,
|
2064 |
|
ht.TOr(ht.TNone, ht.TListOf(_CheckCIDRAddrNotation)),
|
|
2063 |
ht.TMaybe(ht.TListOf(_CheckCIDRAddrNotation)),
|
2065 |
2064 |
"Which external IP addresses to release"),
|
2066 |
2065 |
]
|
2067 |
2066 |
OP_RESULT = ht.TNone
|