LGTM.

Thanks,
Jose

On Mon, Nov 18, 2013 at 10:31:48AM +0100, Thomas Thrainer wrote:
> Add handling for Open vSwitch related configuration parameters as well
> as for the "cpuid" and "soundhw" hypervisor parameters.
> 
> Signed-off-by: Thomas Thrainer <[email protected]>
> ---
>  tools/cfgupgrade | 55 +++++++++++++++++++++++++++++++++++++++++++------------
>  1 file changed, 43 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/cfgupgrade b/tools/cfgupgrade
> index 1135103..7ffd554 100755
> --- a/tools/cfgupgrade
> +++ b/tools/cfgupgrade
> @@ -394,20 +394,48 @@ def UpgradeAll(config_data):
>    UpgradeInstanceIndices(config_data)
>  
>  
> -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():
> -    DowngradeNicParamsVLAN(iobj["nics"], iname)
> +def DowngradeNDParams(ndparams):
> +  for param in ["ovs", "ovs_link", "ovs_name"]:
> +    if param in ndparams:
> +      del ndparams[param]
> +
> +
> +def DowngradeNicParams(nicparams):
> +  if "vlan" in nicparams:
> +    del nicparams["vlan"]
>  
>  
> -def DowngradeNicParamsVLAN(nics, owner):
> -  for nic in nics:
> -    vlan = nic["nicparams"].get("vlan", None)
> -    if vlan:
> -      logging.warning("Instance with name %s found. Removing VLAN 
> information"
> -                      " %s.", owner, vlan)
> -      del nic["nicparams"]["vlan"]
> +def DowngradeHVParams(hvparams):
> +  for hv in ["xen-pvm", "xen-hvm"]:
> +    if hv not in hvparams:
> +      continue
> +    for param in ["cpuid", "soundhw"]:
> +      if param in hvparams[hv]:
> +        del hvparams[hv][param]
> +
> +
> +def DowngradeCluster(config_data):
> +  cluster = config_data["cluster"]
> +  DowngradeNDParams(cluster["ndparams"])
> +  DowngradeNicParams(cluster["nicparams"][constants.PP_DEFAULT])
> +  DowngradeHVParams(cluster["hvparams"])
> +
> +
> +def DowngradeNodeGroups(config_data):
> +  for (_, ngobj) in config_data["nodegroups"].items():
> +    DowngradeNDParams(ngobj["ndparams"])
> +
> +
> +def DowngradeNodes(config_data):
> +  for (_, nobj) in config_data["nodes"].items():
> +    DowngradeNDParams(nobj["ndparams"])
> +
> +
> +def DowngradeInstances(config_data):
> +  for (_, iobj) in config_data["instances"].items():
> +    DowngradeHVParams(iobj["hvparams"])
> +    for nic in iobj["nics"]:
> +      DowngradeNicParams(nic["nicparams"])
>  
>  
>  def DowngradeAll(config_data):
> @@ -415,6 +443,9 @@ def DowngradeAll(config_data):
>    # it can be removed when updating to the next version.
>    config_data["version"] = version.BuildVersion(DOWNGRADE_MAJOR,
>                                                  DOWNGRADE_MINOR, 0)
> +  DowngradeCluster(config_data)
> +  DowngradeNodeGroups(config_data)
> +  DowngradeNodes(config_data)
>    DowngradeInstances(config_data)
>  
>  
> -- 
> 1.8.4.1
> 

-- 
Jose Antonio Lopes
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

Reply via email to