Commit 7f08b221 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Klaus Aehlig
Browse files

Fix LUNetwork* hooks to comply with docs



Upon LUNetworkDisconnect() export GROUP_NETWORK_MODE and
GROUP_NETWORK_LINK along with GROUP_NAME.

Export GROUP_NETWORK_VLAN too.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 148c7ee0
......@@ -245,7 +245,7 @@ Connects a network to a nodegroup.
:directory: network-connect
:env. vars: GROUP_NAME, NETWORK_NAME,
GROUP_NETWORK_MODE, GROUP_NETWORK_LINK,
GROUP_NETWORK_MODE, GROUP_NETWORK_LINK, GROUP_NETWORK_VLAN,
NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6,
NETWORK_GATEWAY6, NETWORK_MAC_PREFIX, NETWORK_TAGS
:pre-execution: nodegroup nodes
......@@ -259,7 +259,7 @@ Disconnects a network from a nodegroup.
:directory: network-disconnect
:env. vars: GROUP_NAME, NETWORK_NAME,
GROUP_NETWORK_MODE, GROUP_NETWORK_LINK,
GROUP_NETWORK_MODE, GROUP_NETWORK_LINK, GROUP_NETWORK_VLAN,
NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6,
NETWORK_GATEWAY6, NETWORK_MAC_PREFIX, NETWORK_TAGS
:pre-execution: nodegroup nodes
......
......@@ -602,6 +602,7 @@ class LUNetworkConnect(LogicalUnit):
"GROUP_NAME": self.group_name,
"GROUP_NETWORK_MODE": self.network_mode,
"GROUP_NETWORK_LINK": self.network_link,
"GROUP_NETWORK_VLAN": self.network_vlan,
}
return ret
......@@ -687,6 +688,13 @@ class LUNetworkDisconnect(LogicalUnit):
ret = {
"GROUP_NAME": self.group_name,
}
if self.connected:
ret.update({
"GROUP_NETWORK_MODE": self.netparams[constants.NIC_MODE],
"GROUP_NETWORK_LINK": self.netparams[constants.NIC_LINK],
"GROUP_NETWORK_VLAN": self.netparams[constants.NIC_VLAN],
})
return ret
def BuildHooksNodes(self):
......@@ -715,6 +723,7 @@ class LUNetworkDisconnect(LogicalUnit):
self, lambda nic: nic.network == self.network_uuid, "disconnect from",
[instance_info for (_, instance_info) in
self.cfg.GetMultiInstanceInfoByName(owned_instances)])
self.netparams = self.group.networks.get(self.network_uuid)
def Exec(self, feedback_fn):
# Disconnect the network and update the group only if network is connected
......
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