Commit 87b2cd45 authored by Iustin Pop's avatar Iustin Pop
Browse files

Rename the _oss cluster vars to _os



Per the mailing list discussion, rename _oss to _os, both in cluster parameters
and in the rest of the code.

This is just an s/_oss/_os, with the exception of a small bit of cleanup
around the helper_os function in cmdlib.py.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 052ee117
......@@ -2625,12 +2625,12 @@ class LUSetClusterParams(LogicalUnit):
("drbd_helper", None, _TOr(_TString, _TNone)),
("default_iallocator", None, _TMaybeString),
("reserved_lvs", None, _TOr(_TListOf(_TNonEmptyString), _TNone)),
("hidden_oss", None, _TOr(_TListOf(\
("hidden_os", None, _TOr(_TListOf(\
_TAnd(_TList,
_TIsLength(2),
_TMap(lambda v: v[0], _TElemOf(constants.DDMS_VALUES)))),
_TNone)),
("blacklisted_oss", None, _TOr(_TListOf(\
("blacklisted_os", None, _TOr(_TListOf(\
_TAnd(_TList,
_TIsLength(2),
_TMap(lambda v: v[0], _TElemOf(constants.DDMS_VALUES)))),
......@@ -2908,7 +2908,8 @@ class LUSetClusterParams(LogicalUnit):
if self.op.reserved_lvs is not None:
self.cluster.reserved_lvs = self.op.reserved_lvs
def helper_oss(aname, mods, desc):
def helper_os(aname, mods, desc):
desc += " OS list"
lst = getattr(self.cluster, aname)
for key, val in mods:
if key == constants.DDM_ADD:
......@@ -2924,13 +2925,11 @@ class LUSetClusterParams(LogicalUnit):
else:
raise errors.ProgrammerError("Invalid modification '%s'" % key)
if self.op.hidden_oss:
helper_oss("hidden_oss", self.op.hidden_oss,
"hidden OS list")
if self.op.hidden_os:
helper_os("hidden_os", self.op.hidden_os, "hidden")
if self.op.blacklisted_oss:
helper_oss("blacklisted_oss", self.op.blacklisted_oss,
"blacklisted OS list")
if self.op.blacklisted_os:
helper_os("blacklisted_os", self.op.blacklisted_os, "blacklisted")
self.cfg.Update(self.cluster, feedback_fn)
......@@ -3214,8 +3213,8 @@ class LUDiagnoseOS(NoHooksLU):
params.intersection_update(node_params)
api_versions.intersection_update(node_api)
is_hid = os_name in cluster.hidden_oss
is_blk = os_name in cluster.blacklisted_oss
is_hid = os_name in cluster.hidden_os
is_blk = os_name in cluster.blacklisted_os
if ((self._HID not in self.op.output_fields and is_hid) or
(self._BLK not in self.op.output_fields and is_blk) or
(self._VLD not in self.op.output_fields and not valid)):
......@@ -6700,7 +6699,7 @@ class LUCreateInstance(LogicalUnit):
if self.op.os_type is None:
raise errors.OpPrereqError("No guest OS specified",
errors.ECODE_INVAL)
if self.op.os_type in self.cfg.GetClusterInfo().blacklisted_oss:
if self.op.os_type in self.cfg.GetClusterInfo().blacklisted_os:
raise errors.OpPrereqError("Guest OS '%s' is not allowed for"
" installation" % self.op.os_type,
errors.ECODE_STATE)
......
......@@ -957,8 +957,8 @@ class Cluster(TaggableObject):
"maintain_node_health",
"uid_pool",
"default_iallocator",
"hidden_oss",
"blacklisted_oss",
"hidden_os",
"blacklisted_os",
] + _TIMESTAMPS + _UUID
def UpgradeConfig(self):
......@@ -1025,11 +1025,11 @@ class Cluster(TaggableObject):
self.reserved_lvs = []
# hidden and blacklisted operating systems added before 2.2.1
if self.hidden_oss is None:
self.hidden_oss = []
if self.hidden_os is None:
self.hidden_os = []
if self.blacklisted_oss is None:
self.blacklisted_oss = []
if self.blacklisted_os is None:
self.blacklisted_os = []
def ToDict(self):
"""Custom function for cluster.
......
......@@ -315,8 +315,8 @@ class OpSetClusterParams(OpCode):
"remove_uids",
"default_iallocator",
"reserved_lvs",
"hidden_oss",
"blacklisted_oss",
"hidden_os",
"blacklisted_os",
]
......
......@@ -273,8 +273,8 @@ def ModifyOS(opts, args):
op = opcodes.OpSetClusterParams(os_hvp=os_hvp,
osparams=osp,
hidden_oss=ohid,
blacklisted_oss=oblk)
hidden_os=ohid,
blacklisted_os=oblk)
SubmitOpCode(op, opts=opts)
return 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment