On Thu, Jul 01, 2010 at 05:59:35PM +0100, Luca Bigliardi wrote:
> Signed-off-by: Luca Bigliardi <[email protected]>
> ---
> lib/cmdlib.py | 38 ++++++++++++++++++++++++++++++++++++++
> lib/opcodes.py | 1 +
> 2 files changed, 39 insertions(+), 0 deletions(-)
>
> diff --git a/lib/cmdlib.py b/lib/cmdlib.py
> index 1960176..dd7d5bd 100644
> --- a/lib/cmdlib.py
> +++ b/lib/cmdlib.py
> @@ -2526,6 +2526,7 @@ class LUSetClusterParams(LogicalUnit):
> ("osparams", _TOr(_TDictOf(_TNonEmptyString, _TDict), _TNone)),
> ("enabled_hypervisors",
> _TOr(_TAnd(_TListOf(_TElemOf(constants.HYPER_TYPES)), _TTrue), _TNone)),
> + ("drbd_helper", _TOr(_TString, _TNone)),
> ]
> _OP_DEFS = [
> ("candidate_pool_size", None),
> @@ -2535,6 +2536,7 @@ class LUSetClusterParams(LogicalUnit):
> ("hvparams", None),
> ("os_hvp", None),
> ("osparams", None),
> + ("drbd_helper", None),
> ]
> REQ_BGL = False
>
> @@ -2598,6 +2600,15 @@ class LUSetClusterParams(LogicalUnit):
> " lvm-based instances exist",
> errors.ECODE_INVAL)
>
> + if self.op.drbd_helper is not None and not self.op.drbd_helper:
> + instances = self.cfg.GetAllInstancesInfo().values()
> + for inst in instances:
> + for disk in inst.disks:
> + if disk.RecursiveCheckIfLogicalDiskBased(constants.LD_DRBD8):
> + raise errors.OpPrereqError("Cannot disable drbd helper while"
> + " drbd-based instances exist",
> + errors.ECODE_INVAL)
> +
This code and the code in upgrade config look very similar. Maybe it
should be abstracted in a ConfigWriter.HasAnyDiskOfType() method.
> node_list = self.acquired_locks[locking.LEVEL_NODE]
>
> # if vg_name not None, checks given volume group on all nodes
> @@ -2617,6 +2628,24 @@ class LUSetClusterParams(LogicalUnit):
> raise errors.OpPrereqError("Error on node '%s': %s" %
> (node, vgstatus), errors.ECODE_ENVIRON)
>
> + if self.op.drbd_helper:
> + # checks given drbd helper on all nodes
> + helpers = self.rpc.call_drbd_helper(node_list)
> + for node in node_list:
> + ninfo = self.cfg.GetNodeInfo(node)
> + if ninfo.offline:
> + self.LogWarning("Not checking drbd helper on offline node %s",
> node)
I don't think this is LogWarning, maybe just LogInfo. Having offline
nodes is perfectly fine (well, from the point of view of the ganeti
code, at least :).
Rest LGTM.
iustin