Update python agent with virtual ip subnet mask
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d9a0b45c Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d9a0b45c Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d9a0b45c Branch: refs/heads/master Commit: d9a0b45c70337f3a786f2095375d970ed0b6e823 Parents: 0b2aed0 Author: Gayan Gunarathne <[email protected]> Authored: Wed May 27 15:16:22 2015 +0530 Committer: Gayan Gunarathne <[email protected]> Committed: Mon Jul 27 14:52:05 2015 +0530 ---------------------------------------------------------------------- .../extensions/bash/CreateLVSDummyInterface.sh | 4 ++-- .../cartridge.agent/modules/event/eventhandler.py | 8 ++++++-- .../simple/single-group-app/artifacts/application.json | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/d9a0b45c/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/CreateLVSDummyInterface.sh ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/CreateLVSDummyInterface.sh b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/CreateLVSDummyInterface.sh index 39c7f96..3fb7d3b 100755 --- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/CreateLVSDummyInterface.sh +++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/bash/CreateLVSDummyInterface.sh @@ -26,6 +26,6 @@ modprobe dummy numdummies=1 -ifconfig dummy0 ${STRATOS_LVS_VIRTUAL_IP} netmask 255.255.255.0 +ifconfig dummy0 ${STRATOS_LVS_DUMMY_VIRTUAL_IP} netmask ${STRATOS_LVS_SUBNET_MASK} -echo "update the dummy interface with ${STRATOS_LVS_VIRTUAL_IP}" \ No newline at end of file +echo "update the dummy interface with ${STRATOS_LVS_DUMMY_VIRTUAL_IP} and ${STRATOS_LVS_SUBNET_MASK}" \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/d9a0b45c/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py index 9705dc6..2cc9fba 100644 --- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py +++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/event/eventhandler.py @@ -61,8 +61,11 @@ class EventHandler: def create_dummy_interface(self): self.__log.debug("Processing lvs dummy interface creation...") + lvs_vip = self.__config.lvs_virtual_ip.split("|") + self.__log.debug("LVS dummy interface creation values %s %s " %(lvs_vip[0], lvs_vip[1]) ) self.execute_event_extendables(constants.CREATE_LVS_DUMMY_INTERFACE, - {"LVS_VIRTUAL_IP": self.__config.lvs_virtual_ip}) + {"EVENT": constants.CREATE_LVS_DUMMY_INTERFACE, "LVS_DUMMY_VIRTUAL_IP": lvs_vip[0], + "LVS_SUBNET_MASK": lvs_vip[1]}) def on_instance_activated_event(self): self.__log.debug("Processing instance activated event...") @@ -637,7 +640,8 @@ class EventHandler: lb_private_ip, lb_public_ip = EventHandler.get_lb_member_ip(lb_cluster_id_in_payload) plugin_values["LB_IP"] = lb_private_ip if lb_private_ip is not None else self.__config.lb_private_ip plugin_values["LB_PUBLIC_IP"] = lb_public_ip if lb_public_ip is not None else self.__config.lb_public_ip - plugin_values["LVS_VIRTUAL_IP"] =self.__config.lvs_virtual_ip + + topology = TopologyContext.get_topology() if topology.initialized: http://git-wip-us.apache.org/repos/asf/stratos/blob/d9a0b45c/samples/applications/simple/single-group-app/artifacts/application.json ---------------------------------------------------------------------- diff --git a/samples/applications/simple/single-group-app/artifacts/application.json b/samples/applications/simple/single-group-app/artifacts/application.json index b51bad9..7b64aa0 100644 --- a/samples/applications/simple/single-group-app/artifacts/application.json +++ b/samples/applications/simple/single-group-app/artifacts/application.json @@ -29,7 +29,7 @@ "type": "php", "cartridgeMin": 2, "cartridgeMax": 4, - "lvsVirtualIP": "192.168.56.60", + "lvsVirtualIP": "192.168.56.50|255.255.255.0", "subscribableInfo": { "alias": "my-php", "autoscalingPolicy": "autoscaling-policy-1", @@ -49,7 +49,7 @@ "type": "tomcat", "cartridgeMin": 2, "cartridgeMax": 4, - "lvsVirtualIP": "192.168.56.50", + "lvsVirtualIP": "192.168.56.50|255.255.255.0", "subscribableInfo": { "alias": "my-tomcat", "autoscalingPolicy": "autoscaling-policy-1",
