On 16 May 2013 11:36, Thomas Thrainer <[email protected]> wrote:
> The cfgupgrade tool now adds the disks_active flag during upgrades and
> removes it during downgrades.
>
> Signed-off-by: Thomas Thrainer <[email protected]>
> ---
>  tools/cfgupgrade | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/tools/cfgupgrade b/tools/cfgupgrade
> index 0526b1a..dcb9fc7 100755
> --- a/tools/cfgupgrade
> +++ b/tools/cfgupgrade
> @@ -183,6 +183,9 @@ def UpgradeInstances(config_data):
>                          instance, idx, current, expected)
>          dobj["iv_name"] = expected
>
> +    if "disks_active" not in iobj:
> +      iobj["disks_active"] = iobj["admin_state"] == constants.ADMINST_UP
> +

This breaks things if someone activated the disks of a down instance.
We should at least document it.


>
>  def UpgradeRapiUsers():
>    if (os.path.isfile(options.RAPI_USERS_FILE_PRE24) and
> @@ -309,11 +312,21 @@ def DowngradeCluster(config_data):
>      DowngradeIPolicy(ipolicy, "cluster")
>
>
> +def DowngradeInstances(config_data):
> +  if "instances" not in config_data:
> +    raise Error("Can't find the 'instances' key in the configuration!")
> +
> +  for _, iobj in config_data["instances"].items():
> +    if "disks_active" in iobj:
> +      del iobj["disks_active"]
> +
> +
>  def DowngradeAll(config_data):
>    # Any code specific to a particular version should be labeled that way, so
>    # it can be removed when updating to the next version.
>    DowngradeCluster(config_data)
>    DowngradeGroups(config_data)
> +  DowngradeInstances(config_data)

That's good, but first we have to fix the target version for the
downgrade, or there will be no way to downgrade to 2.8. Which means,
LGTM later.

Thanks,
Bernardo

Reply via email to