Commit 8fd6c773 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Add a new node parameter cpu_speed



This parameter will describe the speed of the CPU relative
to the speed of a "normal" node in this node group.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent 94c42103
...@@ -2056,6 +2056,9 @@ ndOvsName = "ovs_name" ...@@ -2056,6 +2056,9 @@ ndOvsName = "ovs_name"
ndSshPort :: String ndSshPort :: String
ndSshPort = "ssh_port" ndSshPort = "ssh_port"
ndCpuSpeed :: String
ndCpuSpeed = "cpu_speed"
ndsParameterTypes :: Map String VType ndsParameterTypes :: Map String VType
ndsParameterTypes = ndsParameterTypes =
Map.fromList Map.fromList
...@@ -2065,7 +2068,8 @@ ndsParameterTypes = ...@@ -2065,7 +2068,8 @@ ndsParameterTypes =
(ndOvsLink, VTypeMaybeString), (ndOvsLink, VTypeMaybeString),
(ndOvsName, VTypeMaybeString), (ndOvsName, VTypeMaybeString),
(ndSpindleCount, VTypeInt), (ndSpindleCount, VTypeInt),
(ndSshPort, VTypeInt)] (ndSshPort, VTypeInt),
(ndCpuSpeed, VTypeFloat)]
ndsParameters :: FrozenSet String ndsParameters :: FrozenSet String
ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes) ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
...@@ -3822,6 +3826,7 @@ ndcDefaults = ...@@ -3822,6 +3826,7 @@ ndcDefaults =
, (ndOvsName, PyValueEx defaultOvs) , (ndOvsName, PyValueEx defaultOvs)
, (ndOvsLink, PyValueEx "") , (ndOvsLink, PyValueEx "")
, (ndSshPort, PyValueEx (22 :: Int)) , (ndSshPort, PyValueEx (22 :: Int))
, (ndCpuSpeed, PyValueEx (1 :: Double))
] ]
ndcGlobals :: FrozenSet String ndcGlobals :: FrozenSet String
......
...@@ -566,6 +566,7 @@ $(buildParam "ND" "ndp" ...@@ -566,6 +566,7 @@ $(buildParam "ND" "ndp"
, simpleField "ovs_name" [t| String |] , simpleField "ovs_name" [t| String |]
, simpleField "ovs_link" [t| String |] , simpleField "ovs_link" [t| String |]
, simpleField "ssh_port" [t| Int |] , simpleField "ssh_port" [t| Int |]
, simpleField "cpu_speed" [t| Double |]
]) ])
$(buildObject "Node" "node" $ $(buildObject "Node" "node" $
......
...@@ -249,6 +249,7 @@ class TestConfigRunner(unittest.TestCase): ...@@ -249,6 +249,7 @@ class TestConfigRunner(unittest.TestCase):
constants.ND_OVS_NAME: "openvswitch", constants.ND_OVS_NAME: "openvswitch",
constants.ND_OVS_LINK: "eth1", constants.ND_OVS_LINK: "eth1",
constants.ND_SSH_PORT: 22, constants.ND_SSH_PORT: 22,
constants.ND_CPU_SPEED: 1.0,
} }
cfg = self._get_object() cfg = self._get_object()
...@@ -277,6 +278,7 @@ class TestConfigRunner(unittest.TestCase): ...@@ -277,6 +278,7 @@ class TestConfigRunner(unittest.TestCase):
constants.ND_OVS_NAME: "openvswitch", constants.ND_OVS_NAME: "openvswitch",
constants.ND_OVS_LINK: "eth3", constants.ND_OVS_LINK: "eth3",
constants.ND_SSH_PORT: 222, constants.ND_SSH_PORT: 222,
constants.ND_CPU_SPEED: 1.0,
} }
cfg = self._get_object() cfg = self._get_object()
node = cfg.GetNodeInfo(cfg.GetNodeList()[0]) node = cfg.GetNodeInfo(cfg.GetNodeList()[0])
......
...@@ -180,6 +180,7 @@ class TestClusterObject(unittest.TestCase): ...@@ -180,6 +180,7 @@ class TestClusterObject(unittest.TestCase):
constants.ND_OVS_LINK: "eth2", constants.ND_OVS_LINK: "eth2",
constants.ND_OVS_NAME: "openvswitch", constants.ND_OVS_NAME: "openvswitch",
constants.ND_SSH_PORT: 122, constants.ND_SSH_PORT: 122,
constants.ND_CPU_SPEED: 1.1,
} }
fake_group = objects.NodeGroup(name="testgroup", fake_group = objects.NodeGroup(name="testgroup",
ndparams=group_ndparams) ndparams=group_ndparams)
...@@ -195,6 +196,7 @@ class TestClusterObject(unittest.TestCase): ...@@ -195,6 +196,7 @@ class TestClusterObject(unittest.TestCase):
constants.ND_OVS_LINK: "eth2", constants.ND_OVS_LINK: "eth2",
constants.ND_OVS_NAME: "openvswitch", constants.ND_OVS_NAME: "openvswitch",
constants.ND_SSH_PORT: 222, constants.ND_SSH_PORT: 222,
constants.ND_CPU_SPEED: 1.1,
} }
fake_node = objects.Node(name="test", fake_node = objects.Node(name="test",
ndparams=node_ndparams, ndparams=node_ndparams,
...@@ -213,6 +215,7 @@ class TestClusterObject(unittest.TestCase): ...@@ -213,6 +215,7 @@ class TestClusterObject(unittest.TestCase):
constants.ND_OVS_LINK: "eth2", constants.ND_OVS_LINK: "eth2",
constants.ND_OVS_NAME: "openvswitch", constants.ND_OVS_NAME: "openvswitch",
constants.ND_SSH_PORT: 322, constants.ND_SSH_PORT: 322,
constants.ND_CPU_SPEED: 1.1,
} }
fake_node = objects.Node(name="test", fake_node = objects.Node(name="test",
ndparams=node_ndparams, ndparams=node_ndparams,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment