On Mon, Nov 11, 2013 at 4:37 PM, Petr Pudlak <[email protected]> wrote:
> If there are configured SSH ports other than 22, fail the config
> downgrade, as
>
Maybe: "If SSH ports other than 22 are configured, abort the ...
>
>
+
> +def DowngradeCluster(config_data):
> + DowngradeNdparams(config_data["cluster"])
> +
> +
> +def DowngradeGroups(config_data):
> + for group in config_data["nodegroups"].values():
> + DowngradeNdparams(group)
> +
> +
> +def DowngradeNdparams(group_or_cluster):
> + ssh_port = group_or_cluster["ndparams"].pop("ssh_port", None)
> + if (ssh_port is not None) and (ssh_port != 22):
> + raise Error(("The cluster or some node group has configured SSH port
> %d."
> + " Refusing to downgrade as it will most certainly fail."
> + ) % (ssh_port, ))
> +
> +
> 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.
> config_data["version"] = version.BuildVersion(DOWNGRADE_MAJOR,
> DOWNGRADE_MINOR, 0)
> + DowngradeCluster(config_data)
> + DowngradeGroups(config_data)
>
>
> def main():
> --
> 1.8.4.1
>
>
In DowngradeAll, you already have information about the version you are
downgrading to.
Maybe it would be best to future-proof this code now and perform this
downgrade only if we are downgrading to 2.10 or lower?
And perhaps rename the functions as they are doing only that.
Hrvoje Ribicic
Ganeti Engineering
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
Steuernummer: 48/725/00206
Umsatzsteueridentifikationsnummer: DE813741370