Allow cluster mac prefix modification
authorDimitris Bliablias <bl.dimitris@gmail.com>
Thu, 27 Feb 2014 15:38:54 +0000 (17:38 +0200)
committerJose A. Lopes <jabolopes@google.com>
Fri, 28 Feb 2014 12:08:39 +0000 (13:08 +0100)
Extend LUClusterSetParams to allow the modification of the cluster
mac-prefix setting in 'gnt-cluster modify' command.

This fixes part of issue 239.

Signed-off-by: Dimitris Bliablias <bl.dimitris@gmail.com>
Reviewed-by: Jose A. Lopes <jabolopes@google.com>

lib/client/gnt_cluster.py
lib/cmdlib/cluster.py
src/Ganeti/OpCodes.hs
test/hs/Test/Ganeti/OpCodes.hs

index 212ed6e..081e1c9 100644 (file)
@@ -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,
index 56fc13a..d34cef7 100644 (file)
@@ -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()
index fd46e41..43c3e25 100644 (file)
@@ -228,6 +228,7 @@ $(genOpCode "OpCode"
      , pDrbdHelper
      , pDefaultIAllocator
      , pDefaultIAllocatorParams
+     , pNetworkMacPrefix
      , pMasterNetdev
      , pMasterNetmask
      , pReservedLvs
index e3b14e1..6c54294 100644 (file)
@@ -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