Commit 37dc17e3 authored by Thomas Thrainer's avatar Thomas Thrainer

Extract network related logical units from cmdlib

LUNetwork* and associated helper functions are extracted to network.py.
Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
Reviewed-by: default avatarBernardo Dal Seno <bdalseno@google.com>
parent fb3891d0
......@@ -311,7 +311,8 @@ cmdlib_PYTHON = \
lib/cmdlib/__init__.py \
lib/cmdlib/common.py \
lib/cmdlib/base.py \
lib/cmdlib/tags.py
lib/cmdlib/tags.py \
lib/cmdlib/network.py
hypervisor_PYTHON = \
lib/hypervisor/__init__.py \
......
This diff is collapsed.
......@@ -23,6 +23,7 @@
from ganeti import errors
from ganeti import locking
from ganeti import utils
def _ExpandItemName(fn, name, kind):
......@@ -57,3 +58,27 @@ def _ShareAll():
"""
return dict.fromkeys(locking.LEVELS, 1)
def _CheckNodeGroupInstances(cfg, group_uuid, owned_instances):
"""Checks if the instances in a node group are still correct.
@type cfg: L{config.ConfigWriter}
@param cfg: The cluster configuration
@type group_uuid: string
@param group_uuid: Node group UUID
@type owned_instances: set or frozenset
@param owned_instances: List of currently owned instances
"""
wanted_instances = cfg.GetNodeGroupInstances(group_uuid)
if owned_instances != wanted_instances:
raise errors.OpPrereqError("Instances in node group '%s' changed since"
" locks were acquired, wanted '%s', have '%s';"
" retry the operation" %
(group_uuid,
utils.CommaJoin(wanted_instances),
utils.CommaJoin(owned_instances)),
errors.ECODE_STATE)
return wanted_instances
This diff is collapsed.
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