LGTM, Thanks.

On Mon, May 20, 2013 at 5:11 PM, Bernardo Dal Seno <[email protected]>wrote:

> Spindles didn't exist in 2.8 and should be removed to downgrade.
>
> Signed-off-by: Bernardo Dal Seno <[email protected]>
> ---
>  tools/cfgupgrade | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/tools/cfgupgrade b/tools/cfgupgrade
> index cb65cdf..a2bdc26 100755
> --- a/tools/cfgupgrade
> +++ b/tools/cfgupgrade
> @@ -260,11 +260,29 @@ def UpgradeAll(config_data):
>    UpgradeInstances(config_data)
>
>
> +def DowngradeDisks(disks, owner):
> +  for disk in disks:
> +    # Remove spindles to downgrade to 2.8
> +    if "spindles" in disk:
> +      logging.warning("Removing spindles (value=%s) from disk %s (%s) of"
> +                      " instance %s",
> +                      disk["spindles"], disk["iv_name"], disk["uuid"],
> owner)
> +      del disk["spindles"]
> +
> +
> +def DowngradeInstances(config_data):
> +  if "instances" not in config_data:
> +    raise Error("Cannot find the 'instances' key in the configuration!")
> +  for (iname, iobj) in config_data["instances"].items():
> +    if "disks" not in iobj:
> +      raise Error("Cannot find 'disks' key for instance %s" % iname)
> +    DowngradeDisks(iobj["disks"], iname)
> +
> +
>  def DowngradeAll(config_data):
> -  # Unused arguments, pylint: disable=W0613
>    # Any code specific to a particular version should be labeled that way,
> so
>    # it can be removed when updating to the next version.
> -  pass
> +  DowngradeInstances(config_data)
>
>
>  def main():
> --
> 1.8.2.1
>
>


-- 
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, Katherine Stephens

Reply via email to