You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sw...@apache.org on 2016/05/12 15:03:25 UTC
[1/3] git commit: updated refs/heads/4.7 to 3fab757
Repository: cloudstack
Updated Branches:
refs/heads/4.7 919660d09 -> 3fab75772
Add private gateway IP to router initialization config
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/65cb2221
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/65cb2221
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/65cb2221
Branch: refs/heads/4.7
Commit: 65cb22216aa1d5d6257f99d4ad84f80c319cdea9
Parents: ef115ab
Author: Miguel Ferreira <mi...@me.com>
Authored: Wed Feb 24 21:15:26 2016 +0100
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Thu Apr 7 21:13:00 2016 +0200
----------------------------------------------------------------------
.../router/VpcVirtualNetworkApplianceManagerImpl.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/65cb2221/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 712c747..e5dd4e0 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -68,6 +68,7 @@ import com.cloud.network.vpc.StaticRoute;
import com.cloud.network.vpc.StaticRouteProfile;
import com.cloud.network.vpc.Vpc;
import com.cloud.network.vpc.VpcGateway;
+import com.cloud.network.vpc.VpcGatewayVO;
import com.cloud.network.vpc.VpcManager;
import com.cloud.network.vpc.VpcVO;
import com.cloud.network.vpc.dao.PrivateIpDao;
@@ -260,6 +261,15 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
if (defaultDns2 != null) {
buf.append(" dns2=").append(defaultDns2);
}
+
+ VpcGatewayVO privateGatewayForVpc = _vpcGatewayDao.getPrivateGatewayForVpc(domainRouterVO.getVpcId());
+ if (privateGatewayForVpc != null) {
+ String ip4Address = privateGatewayForVpc.getIp4Address();
+ buf.append(" privategateway=").append(ip4Address);
+ s_logger.debug("Set privategateway field in cmd_line.json to " + ip4Address);
+ } else {
+ buf.append(" privategateway=None");
+ }
}
}
[3/3] git commit: updated refs/heads/4.7 to 3fab757
Posted by sw...@apache.org.
Merge pull request #1474 from remibergsma/47_private_gw_initial_config
Handle private gateways more reliablyWhen initialising a VPC router we need to know which IP/device corresponds to a private gateway. This is to solve a problem when stop/starting a VPC router (which gets the private gateway config as a guest network and as a result breaks the functionality). You read it right, the private gateway is sent as type=guest after reboot and type=public initially.
Before this change, you could add a private gw to a running router but you couldn't restart it (it would mix up the tiers). Now the private gateway is detected properly and it works just fine.
Booting without private gateway:
```
root@r-167-VM:~# cat /etc/cloudstack/cmdline.json
{
"config": {
"baremetalnotificationapikey": "V2l1u3wKJVan01h8kq63-5Y5Ia3VLEW1v_Z6i-31QIRJXlt5vkqaqf6DVcdK0jP3u79SW6X9pqJSLSwQP2c2Rw",
"baremetalnotificationsecuritykey": "OXI16srCrxFBi-xOtEwcYqwLlMfSFTlTg66YHtXBBqR7HNN1us3HP5zWOKxfVmz4a3C1kUNLPrUH13gNmZlu4w",
"disable_rp_filter": "true",
"dns1": "8.8.8.8",
"domain": "cs2cloud",
"eth0ip": "169.254.0.42",
"eth0mask": "255.255.0.0",
"host": "192.168.22.61",
"name": "r-167-VM",
"port": "8080",
"privategateway": "None",
"redundant_router": "false",
"template": "domP",
"type": "vpcrouter",
"vpccidr": "10.0.0.0/24"
},
"id": "cmdline"
```
Booting with private gateway:
```
root@r-167-VM:~# cat /etc/cloudstack/cmdline.json
{
"config": {
"baremetalnotificationapikey": "V2l1u3wKJVan01h8kq63-5Y5Ia3VLEW1v_Z6i-31QIRJXlt5vkqaqf6DVcdK0jP3u79SW6X9pqJSLSwQP2c2Rw",
"baremetalnotificationsecuritykey": "OXI16srCrxFBi-xOtEwcYqwLlMfSFTlTg66YHtXBBqR7HNN1us3HP5zWOKxfVmz4a3C1kUNLPrUH13gNmZlu4w",
"disable_rp_filter": "true",
"dns1": "8.8.8.8",
"domain": "cs2cloud",
"eth0ip": "169.254.2.227",
"eth0mask": "255.255.0.0",
"host": "192.168.22.61",
"name": "r-167-VM",
"port": "8080",
"privategateway": "10.201.10.1",
"redundant_router": "false",
"template": "domP",
"type": "vpcrouter",
"vpccidr": "10.0.0.0/24"
},
"id": "cmdline"
```
And:
```
cat cmdline
vpccidr=10.0.0.0/24 domain=cs2cloud dns1=8.8.8.8 privategateway=10.201.10.1 template=domP name=r-167-VM eth0ip=169.254.2.227 eth0mask=255.255.0.0 type=vpcrouter disable_rp_filter=true baremetalnotificationsecuritykey=OXI16srCrxFBi-xOtEwcYqwLlMfSFTlTg66YHtXBBqR7HNN1us3HP5zWOKxfVmz4a3C1kUNLPrUH13gNmZlu4w baremetalnotificationapikey=V2l1u3wKJVan01h8kq63-5Y5Ia3VLEW1v_Z6i-31QIRJXlt5vkqaqf6DVcdK0jP3u79SW6X9pqJSLSwQP2c2Rw host=192.168.22.61 port=8080
```
Logs:
```
2016-02-24 20:08:45,723 DEBUG [c.c.n.r.VpcVirtualNetworkApplianceManagerImpl] (Work-Job-Executor-4:ctx-458d4c52 job-1402/job-1403 ctx-d5355fca) (logid:5772906c) Set privategateway field in cmd_line.json to 10.201.10.1
```
* pr/1474:
Handle private gateways more reliably
Add private gateway IP to router initialization config
Signed-off-by: Will Stevens <wi...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3fab7577
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3fab7577
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3fab7577
Branch: refs/heads/4.7
Commit: 3fab75772f02a3b79849c59a7723aa2370814cc9
Parents: 919660d f4f9b3a
Author: Will Stevens <wi...@gmail.com>
Authored: Thu May 12 11:02:55 2016 -0400
Committer: Will Stevens <wi...@gmail.com>
Committed: Thu May 12 11:02:55 2016 -0400
----------------------------------------------------------------------
.../VpcVirtualNetworkApplianceManagerImpl.java | 10 +++++
.../debian/config/opt/cloud/bin/cs/CsHelper.py | 2 +-
.../debian/config/opt/cloud/bin/merge.py | 46 ++++++++++++++++++++
3 files changed, 57 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3fab7577/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3fab7577/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
----------------------------------------------------------------------
[2/3] git commit: updated refs/heads/4.7 to 3fab757
Posted by sw...@apache.org.
Handle private gateways more reliably
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f4f9b3ab
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f4f9b3ab
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f4f9b3ab
Branch: refs/heads/4.7
Commit: f4f9b3ab4ef2ef34e4d8a04c6ebfbf0784497227
Parents: 65cb222
Author: Remi Bergsma <gi...@remi.nl>
Authored: Thu Feb 25 14:07:21 2016 +0100
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Sun Apr 10 20:06:44 2016 +0200
----------------------------------------------------------------------
.../debian/config/opt/cloud/bin/cs/CsHelper.py | 2 +-
.../debian/config/opt/cloud/bin/merge.py | 46 ++++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4f9b3ab/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
index 9095558..835c189 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
@@ -224,4 +224,4 @@ def copy(src, dest):
except IOError:
logging.Error("Could not copy %s to %s" % (src, dest))
else:
- logging.info("Copied %s to %s" % (src, dest))
\ No newline at end of file
+ logging.info("Copied %s to %s" % (src, dest))
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4f9b3ab/systemvm/patches/debian/config/opt/cloud/bin/merge.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/merge.py b/systemvm/patches/debian/config/opt/cloud/bin/merge.py
index 374cf2c..aa67682 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/merge.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/merge.py
@@ -145,10 +145,13 @@ class updateDataBag:
dp['gateway'] = d['router_guest_gateway']
dp['nic_dev_id'] = d['device'][3]
dp['nw_type'] = 'guest'
+ dp = PrivateGatewayHack.update_network_type_for_privategateway(dbag, dp)
qf = QueueFile()
qf.load({'ip_address': [dp], 'type': 'ips'})
if 'domain_name' not in d.keys() or d['domain_name'] == '':
d['domain_name'] = "cloudnine.internal"
+
+ d = PrivateGatewayHack.update_network_type_for_privategateway(dbag, d)
return cs_guestnetwork.merge(dbag, d)
def process_dhcp_entry(self, dbag):
@@ -274,3 +277,46 @@ class QueueFile:
os.makedirs(path)
timestamp = str(int(round(time.time())))
os.rename(origPath, path + "/" + self.fileName + "." + timestamp)
+
+
+class PrivateGatewayHack:
+
+
+ @classmethod
+ def update_network_type_for_privategateway(cls, dbag, data):
+ ip = data['router_guest_ip'] if 'router_guest_ip' in data.keys() else data['public_ip']
+
+ initial_data = cls.load_inital_data()
+ has_private_gw_ip = cls.if_config_has_privategateway(initial_data)
+ private_gw_matches = 'privategateway' in initial_data['config'] and cls.ip_matches_private_gateway_ip(ip, initial_data['config']['privategateway'])
+
+ if has_private_gw_ip and private_gw_matches:
+ data['nw_type'] = "public"
+ logging.debug("Updating nw_type for ip %s" % ip)
+ else:
+ logging.debug("Not updating nw_type for ip %s because has_private_gw_ip = %s and private_gw_matches = %s " % (ip, has_private_gw_ip, private_gw_matches))
+ return data
+
+
+ @classmethod
+ def if_config_has_privategateway(cls, dbag):
+ return 'privategateway' in dbag['config'].keys() and dbag['config']['privategateway'] != "None"
+
+
+ @classmethod
+ def ip_matches_private_gateway_ip(cls, ip, private_gateway_ip):
+ new_ip_matches_private_gateway_ip = False
+ if ip == private_gateway_ip:
+ new_ip_matches_private_gateway_ip = True
+ return new_ip_matches_private_gateway_ip
+
+
+ @classmethod
+ def load_inital_data(cls):
+ initial_data_bag = DataBag()
+ initial_data_bag.setKey('cmdline')
+ initial_data_bag.load()
+ initial_data = initial_data_bag.getDataBag()
+ logging.debug("Initial data = %s" % initial_data)
+
+ return initial_data