Revision 8646adce
b/lib/cmdlib.py | ||
---|---|---|
4845 | 4845 |
This is an abstract class which is the parent of all the other tags LUs. |
4846 | 4846 |
|
4847 | 4847 |
""" |
4848 |
def CheckPrereq(self): |
|
4849 |
"""Check prerequisites. |
|
4850 | 4848 |
|
4851 |
""" |
|
4852 |
if self.op.kind == constants.TAG_CLUSTER: |
|
4853 |
self.target = self.cfg.GetClusterInfo() |
|
4854 |
elif self.op.kind == constants.TAG_NODE: |
|
4849 |
def ExpandNames(self): |
|
4850 |
self.needed_locks = {} |
|
4851 |
if self.op.kind == constants.TAG_NODE: |
|
4855 | 4852 |
name = self.cfg.ExpandNodeName(self.op.name) |
4856 | 4853 |
if name is None: |
4857 | 4854 |
raise errors.OpPrereqError("Invalid node name (%s)" % |
4858 | 4855 |
(self.op.name,)) |
4859 | 4856 |
self.op.name = name |
4860 |
self.target = self.cfg.GetNodeInfo(name)
|
|
4857 |
self.needed_locks[locking.LEVEL_NODE] = name
|
|
4861 | 4858 |
elif self.op.kind == constants.TAG_INSTANCE: |
4862 | 4859 |
name = self.cfg.ExpandInstanceName(self.op.name) |
4863 | 4860 |
if name is None: |
4864 | 4861 |
raise errors.OpPrereqError("Invalid instance name (%s)" % |
4865 | 4862 |
(self.op.name,)) |
4866 | 4863 |
self.op.name = name |
4867 |
self.target = self.cfg.GetInstanceInfo(name) |
|
4864 |
self.needed_locks[locking.LEVEL_INSTANCE] = name |
|
4865 |
|
|
4866 |
def CheckPrereq(self): |
|
4867 |
"""Check prerequisites. |
|
4868 |
|
|
4869 |
""" |
|
4870 |
if self.op.kind == constants.TAG_CLUSTER: |
|
4871 |
self.target = self.cfg.GetClusterInfo() |
|
4872 |
elif self.op.kind == constants.TAG_NODE: |
|
4873 |
self.target = self.cfg.GetNodeInfo(self.op.name) |
|
4874 |
elif self.op.kind == constants.TAG_INSTANCE: |
|
4875 |
self.target = self.cfg.GetInstanceInfo(self.op.name) |
|
4868 | 4876 |
else: |
4869 | 4877 |
raise errors.OpPrereqError("Wrong tag type requested (%s)" % |
4870 | 4878 |
str(self.op.kind)) |
... | ... | |
4875 | 4883 |
|
4876 | 4884 |
""" |
4877 | 4885 |
_OP_REQP = ["kind", "name"] |
4886 |
REQ_BGL = False |
|
4878 | 4887 |
|
4879 | 4888 |
def Exec(self, feedback_fn): |
4880 | 4889 |
"""Returns the tag list. |
... | ... | |
4888 | 4897 |
|
4889 | 4898 |
""" |
4890 | 4899 |
_OP_REQP = ["pattern"] |
4900 |
REQ_BGL = False |
|
4901 |
|
|
4902 |
def ExpandNames(self): |
|
4903 |
self.needed_locks = {} |
|
4891 | 4904 |
|
4892 | 4905 |
def CheckPrereq(self): |
4893 | 4906 |
"""Check prerequisites. |
... | ... | |
4907 | 4920 |
""" |
4908 | 4921 |
cfg = self.cfg |
4909 | 4922 |
tgts = [("/cluster", cfg.GetClusterInfo())] |
4910 |
ilist = [cfg.GetInstanceInfo(name) for name in cfg.GetInstanceList()]
|
|
4923 |
ilist = cfg.GetAllInstancesInfo().values()
|
|
4911 | 4924 |
tgts.extend([("/instances/%s" % i.name, i) for i in ilist]) |
4912 |
nlist = [cfg.GetNodeInfo(name) for name in cfg.GetNodeList()]
|
|
4925 |
nlist = cfg.GetAllNodesInfo().values()
|
|
4913 | 4926 |
tgts.extend([("/nodes/%s" % n.name, n) for n in nlist]) |
4914 | 4927 |
results = [] |
4915 | 4928 |
for path, target in tgts: |
... | ... | |
4924 | 4937 |
|
4925 | 4938 |
""" |
4926 | 4939 |
_OP_REQP = ["kind", "name", "tags"] |
4940 |
REQ_BGL = False |
|
4927 | 4941 |
|
4928 | 4942 |
def CheckPrereq(self): |
4929 | 4943 |
"""Check prerequisites. |
... | ... | |
4957 | 4971 |
|
4958 | 4972 |
""" |
4959 | 4973 |
_OP_REQP = ["kind", "name", "tags"] |
4974 |
REQ_BGL = False |
|
4960 | 4975 |
|
4961 | 4976 |
def CheckPrereq(self): |
4962 | 4977 |
"""Check prerequisites. |
Also available in: Unified diff