456 Commits

Author SHA1 Message Date
Will Stevens
309a60ea71 Merge pull request #1483 from remibergsma/pr1413-wilder-47
CLOUDSTACK-9287 - Fix unique mac address per rVPC routerThis is work by @wilderrodrigues, see PR #1413 It contains important fixes and I think it needs to be included so I send the PR again.

* pr/1483:
  CLOUDSTACK-9287 - Improve test by checking if pvt gw is removed and fix typos
  CLOUDSTACK-9287 - Fix RVR public interface
  CLOUDSTACK-9287 - Add integration test to cover the private gateway related changes
  CLOUDSTACK-9287 - Refactor the interface state configuration
  CLOUDSTACK-9287 - Check if the nic profile has already been removed from a certain router
  CLOUDSTACK-9287 - Bring up the private gw interface on state change to master
  CLOUDSTACK-9287 - Make sure private gw interface is not used for default gw
  CLOUDSTACK-9287 - Add integration test to cover the private gw interface/mac address issues
  CLOUDSTACK-9287 - Put private gateway interface down on backup router
  CLOUDSTACK-9287 - Generate new mac address if router is redundant and nic profile exists

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-12 11:00:40 -04:00
Will Stevens
a7fef86bb3 Merge pull request #1402 from remibergsma/forceencap_check
Check the existence of 'forceencap' parameter before useCheck the existence of 'forceencap' parameter before use.

Error seen:

```
Traceback (most recent call last):
  File "/opt/cloud/bin/update_config.py", line 140, in <module>
    process_file()
  File "/opt/cloud/bin/update_config.py", line 54, in process_file
    finish_config()
  File "/opt/cloud/bin/update_config.py", line 44, in finish_config
    returncode = configure.main(sys.argv)
  File "/opt/cloud/bin/configure.py", line 1003, in main
    vpns.process()
  File "/opt/cloud/bin/configure.py", line 488, in process
    self.configure_ipsec(self.dbag[vpn])
  File "/opt/cloud/bin/configure.py", line 544, in configure_ipsec
    file.addeq(" forceencaps=%s" % CsHelper.bool_to_yn(obj['encap']))
KeyError: 'encap'
```

* pr/1402:
  Check the existence of 'forceencap' parameter before use

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-04-21 16:30:16 -04:00
Remi Bergsma
53de78f642 Check the existence of 'forceencap' parameter before use 2016-04-19 11:11:19 +02:00
kollyma
0a01e82c23 speedup iptables by prefetching the variables 2016-04-11 20:58:03 +02:00
Wilder Rodrigues
78bbd498e7 CLOUDSTACK-9287 - Fix RVR public interface 2016-04-09 21:14:41 +02:00
Wilder Rodrigues
c41edc1fe6 CLOUDSTACK-9287 - Refactor the interface state configuration
- This also refactors the CsAddress in order to offer better readability in a couple of methods.
2016-04-09 21:14:25 +02:00
Remi Bergsma
6a767732f9 CLOUDSTACK-9287 - Bring up the private gw interface on state change to master 2016-04-09 21:14:10 +02:00
Remi Bergsma
057b54aa3e CLOUDSTACK-9287 - Make sure private gw interface is not used for default gw 2016-04-09 21:13:47 +02:00
Wilder Rodrigues
d93b008deb CLOUDSTACK-9287 - Put private gateway interface down on backup router 2016-04-09 21:13:35 +02:00
Remi Bergsma
a243339faa Merge pull request #1386 from remibergsma/fix-del-private-gw-route
CLOUDSTACK-9266: Make deleting static routes in private gw workThe to-be-deleted static routes were removed from the json file, instead of putting them there with revoke=true. The script that parses the json now doesn't find it and thus does not delete it.

Example after adding/removing some:
```
root@r-3-VM:/var/cache/cloud# cat /etc/cloudstack/staticroutes.json
{
    "1.2.3.0/24": {
        "gateway": "172.16.0.1",
        "ip_address": "172.16.0.2",
        "network": "1.2.3.0/24",
        "revoke": true
    },
    "1.2.3.4/32": {
        "gateway": "172.16.0.1",
        "ip_address": "172.16.0.2",
        "network": "1.2.3.4/32",
        "revoke": true
    },
    "1.2.33.3/32": {
        "gateway": "172.16.0.1",
        "ip_address": "172.16.0.2",
        "network": "1.2.33.3/32",
        "revoke": true
    },
    "1.22.2.2/32": {
        "gateway": "172.16.0.1",
        "ip_address": "172.16.0.2",
        "network": "1.22.2.2/32",
        "revoke": true
    },
    "10.1.2.1/32": {
        "gateway": "172.16.0.1",
        "ip_address": "172.16.0.2",
        "network": "10.1.2.1/32",
        "revoke": true
    },
    "10.1.200.0/25": {
        "gateway": "172.16.0.1",
        "ip_address": "172.16.0.2",
        "network": "10.1.200.0/25",
        "revoke": true
    },
    "10.11.12.13/32": {
        "gateway": "172.16.0.1",
        "ip_address": "172.16.0.2",
        "network": "10.11.12.13/32",
        "revoke": true
    },
    "172.16.1.3/32": {
        "gateway": "172.16.0.1",
        "ip_address": "172.16.0.2",
        "network": "172.16.1.3/32",
        "revoke": true
    },
    "172.16.15.14/32": {
        "gateway": "172.16.0.1",
        "ip_address": "172.16.0.2",
        "network": "172.16.15.14/32",
        "revoke": false
    },
    "172.16.17.0/25": {
        "gateway": "172.16.0.1",
        "ip_address": "172.16.0.2",
        "network": "172.16.17.0/25",
        "revoke": false
    },
    "id": "staticroutes"
}
```

This results in:
```
root@r-3-VM:/var/cache/cloud# ip route show
default via 192.168.23.1 dev eth1
169.254.0.0/16 dev eth0  proto kernel  scope link  src 169.254.1.67
172.16.0.0/24 dev eth2  proto kernel  scope link  src 172.16.0.2
172.16.15.14 via 172.16.0.1 dev eth2
172.16.17.0/25 via 172.16.0.1 dev eth2
192.168.23.0/24 dev eth1  proto kernel  scope link  src 192.168.23.4
```

Two static routes left, the rest deleted:
```
172.16.15.14 via 172.16.0.1 dev eth2
172.16.17.0/25 via 172.16.0.1 dev eth2
```

That also matches the UI:

<img width="1327" alt="screen shot 2016-01-30 at 06 34 06" src="https://cloud.githubusercontent.com/assets/1630096/12693933/83e67d80-c71b-11e5-9241-9f478522b7a4.png">

* pr/1386:
  CLOUDSTACK-9266: Make deleting static routes in private gw work

Signed-off-by: Remi Bergsma <github@remi.nl>
2016-02-04 09:13:00 +01:00
Remi Bergsma
a40415604a CLOUDSTACK-9266: Make deleting static routes in private gw work 2016-01-30 06:25:00 +01:00
Remi Bergsma
78c43669e5 CLOUDSTACK-9264: Make /32 static routes for private gw work 2016-01-29 19:25:29 +01:00
Remi Bergsma
62fc6fef97 CLOUDSTACK-9256 add unique key for static routes in json 2016-01-25 17:17:55 +01:00
Remi Bergsma
3d2bb285f0 Merge pull request #1356 from borisroman/4.7-vr-performance-wip
More VR performance!Ping @remibergsma

Integration tests runnning now!

* pr/1356:
  More VR performance!

Signed-off-by: Remi Bergsma <github@remi.nl>
2016-01-23 19:16:48 +01:00
Boris Schrijver
3eceb60f5c More VR performance! 2016-01-21 11:51:03 +01:00
Remi Bergsma
ed23ac627a Merge pull request #1346 from borisroman/4.7-vr-performance
Enhance VR performanceWill post integration test results soon!

Ping @wilderrodrigues @remibergsma

* pr/1346:
  Enhance VR performance by selectively executing tasks instead of brute-forcing

Signed-off-by: Remi Bergsma <github@remi.nl>
2016-01-20 14:17:37 +01:00
Daan Hoogland
91f7fc05b6 Refactor public ip retrieval into method 2016-01-19 23:02:26 +01:00
Remi Bergsma
d601570053 CLOUDSTACK-9244 Fix setting up RFC1918 routes 2016-01-19 18:29:31 +01:00
Boris Schrijver
73c0242df3 Enhance VR performance by selectively executing tasks instead of brute-forcing 2016-01-18 11:40:59 +01:00
Remi Bergsma
ff89587fd1 Merge pull request #1277 from ekholabs/fix/4.7-rvpc-net-gc-CLOUDSTACK-9154
[4.7] Critical VPCVR issues fixed: CLOUDSTACK-9154; CLOUDSTACK-9187; and CLOUDSTACK-9188This PR applies the same fixes as in the PR #1259, but against branch 4.7.

Please refer to PR #1259 for the tests results and all the comments already made there.

Issues fixed are:

* CLOUDSTACK-9154: rVPC doesn't recover from cleaning up of network garbage collector
* CLOUDSTACK-9187: rVPC routers in Master/Master due to concurrency problem when writing the keepalivd.conf
* CLOUDSTACK-9188: NetworkGarbageCollector is not using gc.interval and gc.wait from settings

Those changes have been covered by 2 new tests added to ```smoke/test_vpc_redundant.py```:

* test_04_rvpc_network_garbage_collector_nics
* test_05_rvpc_multi_tiers

The test ```test_04_rvpc_network_garbage_collector_nics``` depends on the global settings for the network.gc.interval and gc.wait. If one wants the test to run quicker, please change the settings (default is 600 seconds for each) and restart the Management Server before running the tests. I would suggest to set it to 60 seconds.

In addition, the NetworkGarbageCollector was redefining the settings above mentioned and not reading their values through ConfigDao. Due to that, the settings were not being applied properly and the test was waiting to long to check the VPC routers.

* pr/1277:
  CLOUDSTACK-9154 - Sets the pub interface down when all guest nets are gone
  CLOUDSTACK-9187 - Makes code ready for more something like ethXXXX, if we ever get that far
  CLOUDSTACK-9188 -  Reads network GC interval and wait from configDao
  CLOUDSTACK-9187 - Fixes interface allocation to VRRP instances
  CLOUDSTACK-9187 - Adds test to cover multiple nics and nic removal
  CLOUDSTACK-9154 - Adds test to cover nics state after GC
  CLOUDSTACK-9154 - Returns the guest iterface that is marked as added

Signed-off-by: Remi Bergsma <github@remi.nl>
2016-01-17 19:12:43 +01:00
Remi Bergsma
c13c5540b0 Merge pull request #1329 from remibergsma/delay_compress_fix
CLOUDSTACK-9222 Prevent cloud.log.1 filling up the diskDelay Compress results in more space usage than needed. Since we have copy truncate we don't need it.

* pr/1329:
  CLOUDSTACK-9222 Prevent cloud.log.1 filling up the disk

Signed-off-by: Remi Bergsma <github@remi.nl>
2016-01-16 20:13:49 +01:00
Remi Bergsma
5fdc77e16c Merge pull request #1276 from michaelandersen/fix/site2sitevpn
[4.7] FIX Site2SiteVPN on redundant VPCThis PR:
- fixes the inability to setup more than one Site2Site VPN connection from a VPC
- fixes starting of Site2Site VPN on redundant VPC
- fixes Site2Site VPN state checking on redundant VPC
- improves the vpc_vpn test to allow multple hypervisors
- adds an integration test for Site2Site VPN on redundant VPC

Tested it on 4.7 single Xen server zone:

command:
```
nosetests --with-marvin --marvin-config=/data/shared/marvin/mct-zone1-xen1.cfg -a tags=advanced,required_hardware=true /tmp/test_vpc_vpn.py
```

results:
```
Test Site 2 Site VPN Across redundant VPCs ... === TestName: test_01_redundant_vpc_site2site_vpn | Status : SUCCESS ===
ok
Test Remote Access VPN in VPC ... === TestName: test_01_vpc_remote_access_vpn | Status : SUCCESS ===
ok
Test Site 2 Site VPN Across VPCs ... === TestName: test_01_vpc_site2site_vpn | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 3 tests in 1490.076s

OK
```

also performed numerous manual inspections of state of VPN connections and connectivity between VPC's

* pr/1276:
  Fix unable to setup more than one Site2Site VPN Connection
  FIX S2S VPN rVPC: Check only redundant routers in state MASTER
  PEP8 of integration/smoke/test_vpc_vpn
  Add S2S VPN test for Redundant VPC
  Make integration/smoke/test_vpc_vpn Hypervisor independant
  FIX VPN: non-working ipsec commands

Signed-off-by: Remi Bergsma <github@remi.nl>
2016-01-16 19:51:46 +01:00
Remi Bergsma
66a933afab Merge pull request #1296 from remibergsma/fix-checkrouter-script47
CLOUDSTACK-9181 Prevent syntax error in checkrouter.shAdded quotes to prevent syntax errors in weird situations.

Error seen in mgt server:
```
2015-12-15 14:30:32,371 DEBUG [c.c.a.m.AgentManagerImpl] (RedundantRouterStatusMonitor-7:ctx-0dd8ef3e) Details from executing class com.cloud.agent.api.CheckRouterCommand: Status: UNKNOWN
/opt/cloud/bin/checkrouter.sh: line 28: [: =: unary operator expected
/opt/cloud/bin/checkrouter.sh: line 31: [: =: unary operator expected
```
Cause:
```
root@r-1191-VM:/opt/cloud/bin# ./checkrouter.sh
./checkrouter.sh: line 28: [: =: unary operator expected
./checkrouter.sh: line 31: [: =: unary operator expected
Status: UNKNOWN
```

Somehow a nic was missing.

After fix the script can handle this:

```
root@r-1191-VM:/opt/cloud/bin# ./checkrouter.sh
Status: UNKNOWN
```

The other states are also reported fine:
```
root@r-1191-VM:/opt/cloud/bin# ./checkrouter.sh
Status: MASTER
```

```
root@r-1192-VM:/opt/cloud/bin# ./checkrouter.sh
Status: BACKUP
```

While at it, I also removed the INTERFACES variable/constant as it was only used once and hardcoded the second time. Now both are hardcoded and easier to read.

* pr/1296:
  make both check lines consistent
  CLOUDSTACK-9181 Prevent syntax error in checkrouter.sh

Signed-off-by: Remi Bergsma <github@remi.nl>
2016-01-16 19:46:06 +01:00
Remi Bergsma
b4ebfb640e Merge pull request #1298 from remibergsma/staticroute_delete_47
CLOUDSTACK-9204 Do not error when staticroute is already goneWhen deleting a static route fails because it isn't there any more (KeyError), it should succeed instead.

Error seen:
```
[INFO] Processing JSON file static_routes.json.1451560145
Traceback (most recent call last):
File "/opt/cloud/bin/update_config.py", line 140, in <module>
process_file()
File "/opt/cloud/bin/update_config.py", line 52, in process_file
qf.load(None)
File "/opt/cloud/bin/merge.py", line 258, in load
proc = updateDataBag(self)
File "/opt/cloud/bin/merge.py", line 91, in _init_
self.process()
File "/opt/cloud/bin/merge.py", line 131, in process
dbag = self.process_staticroutes(self.db.getDataBag())
File "/opt/cloud/bin/merge.py", line 179, in process_staticroutes
return cs_staticroutes.merge(dbag, self.qFile.data)
File "/opt/cloud/bin/cs_staticroutes.py", line 26, in merge
del dbag[key]
KeyError: u'192.168.0.3'
```

* pr/1298:
  CLOUDSTACK-9204 Do not error when staticroute is already gone

Signed-off-by: Remi Bergsma <github@remi.nl>
2016-01-16 19:43:24 +01:00
Michael Andersen
435a98cd3f Fix unable to setup more than one Site2Site VPN Connection 2016-01-12 11:24:35 +01:00
Michael Andersen
dfa924bdee FIX VPN: non-working ipsec commands 2016-01-12 11:24:34 +01:00
Remi Bergsma
867be4145d CLOUDSTACK-9222 Prevent cloud.log.1 filling up the disk
Delay Compress results in more space usage than needed. Since we have copy truncate we don't need it.
2016-01-11 21:09:08 +01:00
Michael Andersen
21acc95d57 [ROUTER] Add forceencaps field to python router ipsec config method 2016-01-07 19:27:42 +01:00
Remi Bergsma
779f4b36e0 CLOUDSTACK-9204 Do not error when staticroute is already gone
When deleting fails because it isn't there any morei (KeyError), it should succeed instead.
2015-12-31 14:11:06 +01:00
Remi Bergsma
8fb677027d make both check lines consistent
No need to make a variable, use it on one place and hardcode it on another.
2015-12-28 17:06:58 +01:00
Remi Bergsma
525949e027 CLOUDSTACK-9181 Prevent syntax error in checkrouter.sh 2015-12-28 17:06:43 +01:00
Wilder Rodrigues
5ef3144fdf CLOUDSTACK-9154 - Sets the pub interface down when all guest nets are gone
- Refactors the set_backup, set_master and set_fault methods to have better names for the variable
   - Increase the sleep on the test in order to wait for the routers to be ready. It's now 3 times the GC settings
2015-12-22 14:52:08 +01:00
Wilder Rodrigues
f5a6dee8dd CLOUDSTACK-9187 - Makes code ready for more something like ethXXXX, if we ever get that far
- Adds log info to NetworkOrchestrator in order to make the work of the Net-Scavenger more visible.
2015-12-22 14:52:07 +01:00
Wilder Rodrigues
c99d6f18c9 CLOUDSTACK-9187 - Fixes interface allocation to VRRP instances 2015-12-22 14:52:06 +01:00
Wilder Rodrigues
7988f51ac0 CLOUDSTACK-9154 - Returns the guest iterface that is marked as added
- Force a restart of keepalived if conntrackd is not running or configuration has changed
2015-12-22 14:52:05 +01:00
Remi Bergsma
08a1b11c11 Merge release branch 4.6 to master
* 4.6:
  CLOUDSTACK-9155 make sure logrotate is effective
2015-12-13 14:31:24 +01:00
Remi Bergsma
d7b7171870 Merge pull request #1235 from remibergsma/fix-passwd-server-logging
CLOUDSTACK-9155 make sure logrotate is effective for cloud.logMany processes on the VRs log to cloud.log. When log rotate kicks in, the file is rotated but the scripts still write to the old inode (cloud.log.1 after rotate). Tis quickly fills up the tiny log partition.

Using 'copytruncate' is a small tradeoff, there is a slight change of missing a log entry, but in the old situation nothing ended up in cloud.log after rotate (except for stuff that was (re)started) so I think this is the best solution until we properly rewrite the script to either use their own script or syslog.

More details: https://issues.apache.org/jira/browse/CLOUDSTACK-9155

* pr/1235:
  CLOUDSTACK-9155 make sure logrotate is effective

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-12-13 14:30:07 +01:00
Remi Bergsma
636efa2da3 CLOUDSTACK-9155 make sure logrotate is effective
Many processes on the VRs log to cloud.log. When logrotate
kicks in, the file is rotated but the scripts still write
to the old inode (cloud.log.1 after rotate). Tis quickly
fills up the tiny log partition.

Using 'copytruncate' is a tradeoff, there is a slight
change of missing a log entry, but in the old situation
we were missing all of them after logrotate.
2015-12-13 12:07:20 +01:00
Remi Bergsma
90cea824e7 Merge release branch 4.6 to master
* 4.6:
  CLOUDSTACK-9151 - Removes the replacement of the VRID in the CsRedundant file
2015-12-13 00:14:21 +01:00
Wilder Rodrigues
2bebb7f8a3 CLOUDSTACK-9151 - Removes the replacement of the VRID in the CsRedundant file
- Just like with RVRs, use the VRID 51 instead of making it dependent on the VPCID
   - Reason: arbitary unique number 0..255 used to differentiate multiple instances of vrrpd running on the same NIC (and hence same socket). virtual_router_id 51
2015-12-12 16:26:00 +01:00
Remi Bergsma
67b4a7bd78 Setup routes for RFC 1918 ip space
Setup general route for RFC 1918 space, as otherwise it will be sent to
the public gateway and not work. More specific routes that may be set
have preference over this generic routes.

When public network is RFC1918, we do not setup the routes to avoid
problems with internal-only deployments.
2015-12-11 11:58:06 +01:00
Remi Bergsma
738b78886e Merge release branch 4.6 to master
* 4.6:
  CLOUDSTACK-9118 - Adds integration test to cover routers state.
  CLOUDSTACK-9118 - Improves the existing checkrouter.sh script
2015-12-08 20:12:09 +01:00
Wilder Rodrigues
f81a29351d CLOUDSTACK-9118 - Improves the existing checkrouter.sh script 2015-12-08 11:06:35 +01:00
Remi Bergsma
e08294a95f Merge release branch 4.6 to master
* 4.6:
  CLOUDSTACK-9106 - Makes Enum name compliant with Java code conventions.
  CLOUDSTACK-9106 - Adds a test to cover the changes in the applyVpnUsers() method
  CLOUDSTACK-9106 - Makes the router commands call more consistent.
  CLOUDSTACK-9106 - Enables private gateway tests on Redundant VPCs
  CLOUDSTACK-9106 - Refactor the createPrivateNicProfileForGateway() method
  CLOUDSTACK-9106 - Reduces the amount of iterations through the routers of a VPC
  Add support for not (re)starting server after cloud-setup-management.

Closed PRs that will not be considered for merge:
This closes #1158
This closes #1097
2015-12-07 21:36:36 +01:00
Wilder Rodrigues
24dafc2cc2 CLOUDSTACK-9106 - Refactor the createPrivateNicProfileForGateway() method
- Use the router to retrieve the instance ID
    - Check if the VPC is redundant in order to reuse the private gateway address.
    - Brings the private gateways interfaces up.
2015-12-07 10:30:18 +01:00
Remi Bergsma
58ba44a1c0 Merge release branch 4.6 to master
* 4.6:
  CLOUDSTACK-9097 Make public ip work immediately
  debian: allow rules to pick ACS_BUILD_OPTS from env
2015-12-04 11:05:23 +01:00
Remi Bergsma
4f6ff6ca08 Merge pull request #1163 from remibergsma/arping-to-gw
Send arping to the gateway instead of our own addressWe need to send an Unsolicited ARP to the gateway, instead of our own address. We now encounter problems when people deploy/destroy/deploy and get the same public ip.

Packets arrive, but with incorrect / cached mac and are ignored by the routervm kernel.
Run arping manually to update the arp-cache on the gateway and things start to work.

Then we discovered the `arping` is actually done, but sent to its own address. Therefore the gateway doesn't pick it up. We only saw this happening when rapid deploy tools are used, like Terraform that do deploy/destroy/deploy and might get the same ip but on a new router having a new mac.

```
2015-12-03 18:07:25,589  CsHelper.py execute:160 Executing: arping -c 1 -I eth1 -A -U -s 192.168.23.8 192.168.23.1
```

The integration tests seem happy, although the full run is still ongoing:

```
=== TestName: test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL | Status : SUCCESS ===
```

Thanks @sspans for helping trouble shoot this. Ping @wilderrodrigues can you review please?

* pr/1163:
  CLOUDSTACK-9097 Make public ip work immediately

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-12-04 10:44:48 +01:00
Remi Bergsma
7e902cd505 Merge release branch 4.6 to master
* 4.6:
  CLOUDSTACK-9075 - Uses the same vlan since it should have been already released
  CLOUDSTACK-9075 - Adds VPC static routes test
  CLOUDSTACK-9075 - Covers Private GW ACL with Redundant VPCs
  CLOUDSTACK-9075 - Add method to get list of Physical Networks per zone
  CLOUDSTACK-6276 Removing unused parameter in integration test for projects
  CLOUDSTACK-6276 Removing unused parameter in integration test
  CLOUDSTACK-6276 Fixing affinity groups for projects
2015-12-03 20:42:41 +01:00
Remi Bergsma
90e01c95a2 CLOUDSTACK-9097 Make public ip work immediately
We need to send an Unsolicited ARP to the gateway, instead of our own address. We now encounter problems when people deploy/destroy/deploy and get the same public ip.
2015-12-03 19:30:06 +01:00
Wilder Rodrigues
6d9a3d82f9 CLOUDSTACK-9075 - Uses the same vlan since it should have been already released
- After the first test is done, the clean up will delete the whole VPC, also releasing the VLAN that was in use.
2015-12-02 10:36:53 +01:00