Commit 8baa9ca7 authored by Sebastian Gebhard's avatar Sebastian Gebhard Committed by Klaus Aehlig
Browse files

Add OpenvSwitch functionality to LUNodeAdd



This patch adds functionality to LUNodeAdd to
  - check the arguments given. It will warn if no physical link is given
    and fail if OpenvSwitch is not enabled, but parameters are given
  - call the RPC to configure OpenvSwitch on the node
Signed-off-by: default avatarSebastian Gebhard <sege@fs.ei.tum.de>
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 4daa5eb9
......@@ -112,6 +112,20 @@ class LUNodeAdd(LogicalUnit):
raise errors.OpPrereqError("Cannot pass a node group when a node is"
" being readded", errors.ECODE_INVAL)
# OpenvSwitch: Warn user if link is missing
if (self.op.ndparams[constants.ND_OVS] and not
self.op.ndparams[constants.ND_OVS_LINK]):
self.LogInfo("No physical interface for OpenvSwitch was given."
" OpenvSwitch will not have an outside connection. This"
" might not be what you want.")
# OpenvSwitch: Fail if parameters are given, but OVS is not enabled.
if (not self.op.ndparams[constants.ND_OVS] and
(self.op.ndparams[constants.ND_OVS_NAME] or
self.op.ndparams[constants.ND_OVS_LINK])):
raise errors.OpPrereqError("OpenvSwitch name or link were given, but"
" OpenvSwitch is not enabled. Please enable"
" OpenvSwitch with --ovs", errors.ECODE_INVAL)
def BuildHooksEnv(self):
"""Build hooks env.
......@@ -375,6 +389,13 @@ class LUNodeAdd(LogicalUnit):
(verifier, nl_payload[failed]))
raise errors.OpExecError("ssh/hostname verification failed")
# OpenvSwitch initialization on the node
if self.new_node.ndparams[constants.ND_OVS]:
result = self.rpc.call_node_configure_ovs(
self.new_node.name,
self.new_node.ndparams[constants.ND_OVS_NAME],
self.new_node.ndparams[constants.ND_OVS_LINK])
if self.op.readd:
self.context.ReaddNode(self.new_node)
RedistributeAncillaryFiles(self)
......
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