On Thu, Aug 22, 2013 at 10:16 AM, Helga Velroyen <[email protected]> wrote:

> This change makes sure that 'gnt-cluster verify' only
> checks for the DRBD usermode helper, if DRBD is actually
> enabled.
>
> Signed-off-by: Helga Velroyen <[email protected]>
> ---
>  lib/cmdlib/cluster.py | 37 ++++++++++++++++++++++---------------
>  1 file changed, 22 insertions(+), 15 deletions(-)
>
> diff --git a/lib/cmdlib/cluster.py b/lib/cmdlib/cluster.py
> index 858ccff..b563409 100644
> --- a/lib/cmdlib/cluster.py
> +++ b/lib/cmdlib/cluster.py
> @@ -2282,17 +2282,8 @@ class LUClusterVerifyGroup(LogicalUnit,
> _VerifyErrors):
>                      "File %s found with %s different checksums (%s)",
>                      filename, len(checksums), "; ".join(variants))
>
> -  def _VerifyNodeDrbd(self, ninfo, nresult, instanceinfo, drbd_helper,
> -                      drbd_map):
> -    """Verifies and the node DRBD status.
> -
> -    @type ninfo: L{objects.Node}
> -    @param ninfo: the node to check
> -    @param nresult: the remote results for the node
> -    @param instanceinfo: the dict of instances
> -    @param drbd_helper: the configured DRBD usermode helper
> -    @param drbd_map: the DRBD map as returned by
> -        L{ganeti.config.ConfigWriter.ComputeDRBDMap}
> +  def _VerifyNodeDrbdHelper(self, drbd_helper, nresult, ninfo):
>

NIT: Most methods take `ninfo` as first parameter, then `nresult`, then the
rest as far as I can see...


> +    """Verify the drbd helper.
>
>      """
>      if drbd_helper:
> @@ -2309,6 +2300,21 @@ class LUClusterVerifyGroup(LogicalUnit,
> _VerifyErrors):
>          self._ErrorIf(test, constants.CV_ENODEDRBDHELPER, ninfo.name,
>                        "wrong drbd usermode helper: %s", payload)
>
> +  def _VerifyNodeDrbd(self, ninfo, nresult, instanceinfo, drbd_helper,
> +                      drbd_map):
> +    """Verifies and the node DRBD status.
> +
> +    @type ninfo: L{objects.Node}
> +    @param ninfo: the node to check
> +    @param nresult: the remote results for the node
> +    @param instanceinfo: the dict of instances
> +    @param drbd_helper: the configured DRBD usermode helper
> +    @param drbd_map: the DRBD map as returned by
> +        L{ganeti.config.ConfigWriter.ComputeDRBDMap}
> +
> +    """
> +    self._VerifyNodeDrbdHelper(drbd_helper, nresult, ninfo)
> +
>      # compute the DRBD minors
>      node_drbd = {}
>      for minor, inst_uuid in drbd_map[ninfo.uuid].items():
> @@ -2848,10 +2854,11 @@ class LUClusterVerifyGroup(LogicalUnit,
> _VerifyErrors):
>        node_verify_param[constants.NV_LVLIST] = vg_name
>        node_verify_param[constants.NV_PVLIST] = [vg_name]
>
> -    if drbd_helper:
> -      node_verify_param[constants.NV_DRBDVERSION] = None
> -      node_verify_param[constants.NV_DRBDLIST] = None
> -      node_verify_param[constants.NV_DRBDHELPER] = drbd_helper
> +    if cluster.IsDiskTemplateEnabled(constants.DT_DRBD8):
> +      if drbd_helper:
> +        node_verify_param[constants.NV_DRBDVERSION] = None
> +        node_verify_param[constants.NV_DRBDLIST] = None
> +        node_verify_param[constants.NV_DRBDHELPER] = drbd_helper
>
>      if cluster.IsFileStorageEnabled() or \
>          cluster.IsSharedFileStorageEnabled():
> --
> 1.8.3
>
>
Rest LGTM, thanks.


-- 
Thomas Thrainer | Software Engineer | [email protected] |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to