LGTM.
Thanks,
Jose
On Feb 27 17:38, Dimitris Bliablias wrote:
> Extend LUClusterSetParams to allow the modification of the cluster
> mac-prefix setting in 'gnt-cluster modify' command.
>
> This fixes part of issue 239.
> ---
> lib/client/gnt_cluster.py | 4 +++-
> lib/cmdlib/cluster.py | 7 +++++++
> src/Ganeti/OpCodes.hs | 1 +
> test/hs/Test/Ganeti/OpCodes.hs | 1 +
> 4 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
> index 212ed6e..081e1c9 100644
> --- a/lib/client/gnt_cluster.py
> +++ b/lib/client/gnt_cluster.py
> @@ -1103,6 +1103,7 @@ def SetClusterParams(opts, args):
> opts.default_iallocator is not None or
> opts.default_iallocator_params or
> opts.reserved_lvs is not None or
> + opts.mac_prefix is not None or
> opts.master_netdev is not None or
> opts.master_netmask is not None or
> opts.use_external_mip_script is not None or
> @@ -1219,6 +1220,7 @@ def SetClusterParams(opts, args):
> default_iallocator=opts.default_iallocator,
> default_iallocator_params=opts.default_iallocator_params,
> prealloc_wipe_disks=opts.prealloc_wipe_disks,
> + mac_prefix=opts.mac_prefix,
> master_netdev=opts.master_netdev,
> master_netmask=opts.master_netmask,
> reserved_lvs=opts.reserved_lvs,
> @@ -2169,7 +2171,7 @@ commands = {
> SetClusterParams, ARGS_NONE,
> [FORCE_OPT,
> BACKEND_OPT, CP_SIZE_OPT, RQL_OPT, INSTANCE_COMMUNICATION_NETWORK_OPT,
> - ENABLED_HV_OPT, HVLIST_OPT, MASTER_NETDEV_OPT,
> + ENABLED_HV_OPT, HVLIST_OPT, MAC_PREFIX_OPT, MASTER_NETDEV_OPT,
> MASTER_NETMASK_OPT, NIC_PARAMS_OPT, VG_NAME_OPT,
> MAINTAIN_NODE_HEALTH_OPT,
> UIDPOOL_OPT, ADD_UIDS_OPT, REMOVE_UIDS_OPT, DRBD_HELPER_OPT,
> DEFAULT_IALLOCATOR_OPT, DEFAULT_IALLOCATOR_PARAMS_OPT, RESERVED_LVS_OPT,
> diff --git a/lib/cmdlib/cluster.py b/lib/cmdlib/cluster.py
> index 56fc13a..d34cef7 100644
> --- a/lib/cmdlib/cluster.py
> +++ b/lib/cmdlib/cluster.py
> @@ -803,6 +803,10 @@ class LUClusterSetParams(LogicalUnit):
> if self.op.remove_uids:
> uidpool.CheckUidPool(self.op.remove_uids)
>
> + if self.op.mac_prefix:
> + self.op.mac_prefix = \
> + utils.NormalizeAndValidateThreeOctetMacPrefix(self.op.mac_prefix)
> +
> if self.op.master_netmask is not None:
> _ValidateNetmask(self.cfg, self.op.master_netmask)
>
> @@ -1589,6 +1593,9 @@ class LUClusterSetParams(LogicalUnit):
> if self.op.blacklisted_os:
> helper_os("blacklisted_os", self.op.blacklisted_os, "blacklisted")
>
> + if self.op.mac_prefix:
> + self.cluster.mac_prefix = self.op.mac_prefix
> +
> if self.op.master_netdev:
> master_params = self.cfg.GetMasterNetworkParameters()
> ems = self.cfg.GetUseExternalMipScript()
> diff --git a/src/Ganeti/OpCodes.hs b/src/Ganeti/OpCodes.hs
> index fd46e41..43c3e25 100644
> --- a/src/Ganeti/OpCodes.hs
> +++ b/src/Ganeti/OpCodes.hs
> @@ -228,6 +228,7 @@ $(genOpCode "OpCode"
> , pDrbdHelper
> , pDefaultIAllocator
> , pDefaultIAllocatorParams
> + , pNetworkMacPrefix
> , pMasterNetdev
> , pMasterNetmask
> , pReservedLvs
> diff --git a/test/hs/Test/Ganeti/OpCodes.hs b/test/hs/Test/Ganeti/OpCodes.hs
> index e3b14e1..6c54294 100644
> --- a/test/hs/Test/Ganeti/OpCodes.hs
> +++ b/test/hs/Test/Ganeti/OpCodes.hs
> @@ -196,6 +196,7 @@ instance Arbitrary OpCodes.OpCode where
> <*> arbitrary -- drbd_helper
> <*> arbitrary -- default_iallocator
> <*> emptyMUD -- default_iallocator_params
> + <*> genMaybe genMacPrefix -- mac_prefix
> <*> arbitrary -- master_netdev
> <*> arbitrary -- master_netmask
> <*> arbitrary -- reserved_lvs
> --
> 1.7.10.4
>
--
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