Revision 37dc17e3 lib/cmdlib/common.py
b/lib/cmdlib/common.py | ||
---|---|---|
23 | 23 |
|
24 | 24 |
from ganeti import errors |
25 | 25 |
from ganeti import locking |
26 |
from ganeti import utils |
|
26 | 27 |
|
27 | 28 |
|
28 | 29 |
def _ExpandItemName(fn, name, kind): |
... | ... | |
57 | 58 |
|
58 | 59 |
""" |
59 | 60 |
return dict.fromkeys(locking.LEVELS, 1) |
61 |
|
|
62 |
|
|
63 |
def _CheckNodeGroupInstances(cfg, group_uuid, owned_instances): |
|
64 |
"""Checks if the instances in a node group are still correct. |
|
65 |
|
|
66 |
@type cfg: L{config.ConfigWriter} |
|
67 |
@param cfg: The cluster configuration |
|
68 |
@type group_uuid: string |
|
69 |
@param group_uuid: Node group UUID |
|
70 |
@type owned_instances: set or frozenset |
|
71 |
@param owned_instances: List of currently owned instances |
|
72 |
|
|
73 |
""" |
|
74 |
wanted_instances = cfg.GetNodeGroupInstances(group_uuid) |
|
75 |
if owned_instances != wanted_instances: |
|
76 |
raise errors.OpPrereqError("Instances in node group '%s' changed since" |
|
77 |
" locks were acquired, wanted '%s', have '%s';" |
|
78 |
" retry the operation" % |
|
79 |
(group_uuid, |
|
80 |
utils.CommaJoin(wanted_instances), |
|
81 |
utils.CommaJoin(owned_instances)), |
|
82 |
errors.ECODE_STATE) |
|
83 |
|
|
84 |
return wanted_instances |
Also available in: Unified diff