Revision 0d8ce33e
b/lib/cmdlib/node.py | ||
---|---|---|
112 | 112 |
raise errors.OpPrereqError("Cannot pass a node group when a node is" |
113 | 113 |
" being readded", errors.ECODE_INVAL) |
114 | 114 |
|
115 |
# OpenvSwitch: Warn user if link is missing |
|
116 |
if (self.op.ndparams[constants.ND_OVS] and not |
|
117 |
self.op.ndparams[constants.ND_OVS_LINK]): |
|
118 |
self.LogInfo("No physical interface for OpenvSwitch was given." |
|
119 |
" OpenvSwitch will not have an outside connection. This" |
|
120 |
" might not be what you want.") |
|
121 |
# OpenvSwitch: Fail if parameters are given, but OVS is not enabled. |
|
122 |
if (not self.op.ndparams[constants.ND_OVS] and |
|
123 |
(self.op.ndparams[constants.ND_OVS_NAME] or |
|
124 |
self.op.ndparams[constants.ND_OVS_LINK])): |
|
125 |
raise errors.OpPrereqError("OpenvSwitch name or link were given, but" |
|
126 |
" OpenvSwitch is not enabled. Please enable" |
|
127 |
" OpenvSwitch with --ovs", errors.ECODE_INVAL) |
|
115 |
if self.op.ndparams: |
|
116 |
ovs = self.op.ndparams.get(constants.ND_OVS, None) |
|
117 |
ovs_name = self.op.ndparams.get(constants.ND_OVS_NAME, None) |
|
118 |
ovs_link = self.op.ndparams.get(constants.ND_OVS_LINK, None) |
|
119 |
|
|
120 |
# OpenvSwitch: Warn user if link is missing |
|
121 |
if ovs and not ovs_link: |
|
122 |
self.LogInfo("No physical interface for OpenvSwitch was given." |
|
123 |
" OpenvSwitch will not have an outside connection. This" |
|
124 |
" might not be what you want.") |
|
125 |
# OpenvSwitch: Fail if parameters are given, but OVS is not enabled. |
|
126 |
if not ovs and (ovs_name or ovs_link): |
|
127 |
raise errors.OpPrereqError("OpenvSwitch name or link were given, but" |
|
128 |
" OpenvSwitch is not enabled. Please enable" |
|
129 |
" OpenvSwitch with --ovs", errors.ECODE_INVAL) |
|
128 | 130 |
|
129 | 131 |
def BuildHooksEnv(self): |
130 | 132 |
"""Build hooks env. |
... | ... | |
390 | 392 |
raise errors.OpExecError("ssh/hostname verification failed") |
391 | 393 |
|
392 | 394 |
# OpenvSwitch initialization on the node |
393 |
if self.new_node.ndparams[constants.ND_OVS]: |
|
395 |
ovs = self.new_node.ndparams.get(constants.ND_OVS, None) |
|
396 |
ovs_name = self.new_node.ndparams.get(constants.ND_OVS_NAME, None) |
|
397 |
ovs_link = self.new_node.ndparams.get(constants.ND_OVS_LINK, None) |
|
398 |
|
|
399 |
if ovs: |
|
394 | 400 |
result = self.rpc.call_node_configure_ovs( |
395 |
self.new_node.name, |
|
396 |
self.new_node.ndparams[constants.ND_OVS_NAME], |
|
397 |
self.new_node.ndparams[constants.ND_OVS_LINK]) |
|
401 |
self.new_node.name, ovs_name, ovs_link) |
|
398 | 402 |
|
399 | 403 |
if self.op.readd: |
400 | 404 |
self.context.ReaddNode(self.new_node) |
Also available in: Unified diff