On Thu, Jul 1, 2010 at 5:59 PM, Luca Bigliardi <[email protected]> wrote:
> Signed-off-by: Luca Bigliardi <[email protected]>
> ---
>  lib/config.py    |   11 +++++++++++
>  lib/constants.py |    1 +
>  2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/lib/config.py b/lib/config.py
> index c81f201..f34eac0 100644
> --- a/lib/config.py
> +++ b/lib/config.py
> @@ -1249,6 +1249,17 @@ class ConfigWriter:
>       if item.uuid is None:
>         item.uuid = self._GenerateUniqueID(_UPGRADE_CONFIG_JID)
>         modified = True
> +    cluster_conf = self._config_data.cluster
> +    if cluster_conf.drbd_usermode_helper is None:
> +      # To decide if we set an helper let's check if at least one instance is
> +      # has a DRBD disk. This doesn't cover all the possible scenarios but it
> +      # gives a good approximation.
> +      for instance in self._config_data.instances.values():
> +        for disk in instance.disks:
> +          if disk.RecursiveCheckIfLogicalDiskBased(constants.LD_DRBD8):
> +            cluster_conf.drbd_usermode_helper = constants.DEFAULT_DRBD_HELPER
> +            break
> +      modified = True

This might be a bit problematic.
If we set the drbd helper to None then we'll trigger the upgrade code
from then on every time we start ganeti.
And if a drbd instance has been created in the meantime, this will
reset the parameter to constants.DEFAULT_DRBD_HELPER.
Not sure if this is buggy, just not nice, or ok.

Possible solutions:
  - another explicit "drbd enabled or not" parameter
  - if this parameter is set to none disallow creating drbd instances.
this will trigger the code but at least no flip the parameter under
the user's nose.
  - any more ideas?

Guido

Reply via email to