On Fri, Jul 26, 2013 at 2:20 PM, <[email protected]> wrote:
> From: Izhar <[email protected]>
>
> This patch removes the hypervisor parameter mem_path from the
> instance level.
>
> Signed-off-by: Izhar <[email protected]>
This needs also updates for query.py (apparently we don't allow
hv/<param> if the param is global, so we shouldn't also if it's
nodegroup global. Same for instance export. A "git grep HVC_GLOBALS"
should show which files you also need to change and/or add relevant
ORs too.
Also please explain in the commit why you're adding a new global
constant instead of using the existing one, as later you'll be moving
the hv parameters to the nodegroup level and then these parameters
will be settable at that level but now below.
Thanks,
Guido
> ---
> lib/cmdlib/instance.py | 4 ++++
> lib/constants.py | 4 ++++
> lib/objects.py | 5 +++++
> 3 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/lib/cmdlib/instance.py b/lib/cmdlib/instance.py
> index 22812ea..37e90d6 100644
> --- a/lib/cmdlib/instance.py
> +++ b/lib/cmdlib/instance.py
> @@ -915,6 +915,8 @@ class LUInstanceCreate(LogicalUnit):
> # check that we don't specify global parameters on an instance
> CheckParamsNotGlobal(self.op.hvparams, constants.HVC_GLOBALS,
> "hypervisor",
> "instance", "cluster")
> + CheckParamsNotGlobal(self.op.hvparams, constants.HVC_NODEGROUP,
> "hypervisor",
> + "instance", "cluster or group")
>
> # fill and remember the beparams dict
> self.be_full = _ComputeFullBeParams(self.op, cluster)
> @@ -2385,6 +2387,8 @@ class LUInstanceSetParams(LogicalUnit):
> if self.op.hvparams:
> CheckParamsNotGlobal(self.op.hvparams, constants.HVC_GLOBALS,
> "hypervisor", "instance", "cluster")
> + CheckParamsNotGlobal(self.op.hvparams, constants.HVC_NODEGROUP,
> "hypervisor",
> + "instance", "cluster or group")
>
> self.op.disks = self._UpgradeDiskNicMods(
> "disk", self.op.disks,
> opcodes.OpInstanceSetParams.TestDiskModifications)
> diff --git a/lib/constants.py b/lib/constants.py
> index 5522e5a..204320f 100644
> --- a/lib/constants.py
> +++ b/lib/constants.py
> @@ -2185,6 +2185,10 @@ HVC_GLOBALS = compat.UniqueFrozenset([
> HV_XEN_CMD,
> ])
>
> +HVC_NODEGROUP = compat.UniqueFrozenset([
> + HV_MEM_PATH,
> + ])
> +
> BEC_DEFAULTS = {
> BE_MINMEM: 128,
> BE_MAXMEM: 128,
> diff --git a/lib/objects.py b/lib/objects.py
> index 6105595..2da4ca6 100644
> --- a/lib/objects.py
> +++ b/lib/objects.py
> @@ -1230,6 +1230,11 @@ class Instance(TaggableObject):
> del self.hvparams[key]
> except KeyError:
> pass
> + for key in constants.HVC_NODEGROUP:
> + try:
> + del self.hvparams[key]
> + except KeyError:
> + pass
> if self.osparams is None:
> self.osparams = {}
> UpgradeBeParams(self.beparams)
> --
> 1.7.2.5
>
--
Guido Trotter
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