You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by al...@apache.org on 2016/12/23 14:25:22 UTC
[1/2] libcloud git commit: [LIBCLOUD-879] Add support of node without
public IP in LB
Repository: libcloud
Updated Branches:
refs/heads/trunk 64e52938b -> 4c67398d3
[LIBCLOUD-879] Add support of node without public IP in LB
closes #879
Signed-off-by: Allard Hoeve <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1666a8da
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1666a8da
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1666a8da
Branch: refs/heads/trunk
Commit: 1666a8da34068db0557cc9b186736f571e73df58
Parents: 64e5293
Author: Charles Walker <ch...@gmail.com>
Authored: Wed Nov 23 01:34:05 2016 +0000
Committer: Allard Hoeve <al...@gmail.com>
Committed: Fri Dec 23 15:14:48 2016 +0100
----------------------------------------------------------------------
libcloud/loadbalancer/drivers/gce.py | 5 +-
...al1-b_instances_libcloud-lb-nopubip-001.json | 49 ++++++++++++++++++++
libcloud/test/compute/test_gce.py | 6 +++
libcloud/test/loadbalancer/test_gce.py | 7 +++
4 files changed, 66 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1666a8da/libcloud/loadbalancer/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/gce.py b/libcloud/loadbalancer/drivers/gce.py
index c754221..df95b1a 100644
--- a/libcloud/loadbalancer/drivers/gce.py
+++ b/libcloud/loadbalancer/drivers/gce.py
@@ -338,9 +338,12 @@ class GCELBDriver(Driver):
# would be found if it was there.
if hasattr(node, 'name'):
member_id = node.name
- member_ip = node.public_ips[0]
else:
member_id = node
+
+ if hasattr(node, 'public_ips') and len(node.public_ips) > 0:
+ member_ip = node.public_ips[0]
+ else:
member_ip = None
extra = {'node': node}
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1666a8da/libcloud/test/compute/fixtures/gce/zones_us-central1-b_instances_libcloud-lb-nopubip-001.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/gce/zones_us-central1-b_instances_libcloud-lb-nopubip-001.json b/libcloud/test/compute/fixtures/gce/zones_us-central1-b_instances_libcloud-lb-nopubip-001.json
new file mode 100644
index 0000000..0ec1709
--- /dev/null
+++ b/libcloud/test/compute/fixtures/gce/zones_us-central1-b_instances_libcloud-lb-nopubip-001.json
@@ -0,0 +1,49 @@
+{
+ "canIpForward": false,
+ "creationTimestamp": "2013-12-13T10:51:25.165-08:00",
+ "disks": [
+ {
+ "boot": true,
+ "deviceName": "libcloud-lb-demo-www-001",
+ "index": 0,
+ "kind": "compute#attachedDisk",
+ "mode": "READ_WRITE",
+ "source": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-b/disks/libcloud-lb-demo-www-001",
+ "type": "PERSISTENT"
+ }
+ ],
+ "id": "11523404878663997348",
+ "kind": "compute#instance",
+ "machineType": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-b/machineTypes/n1-standard-1",
+ "metadata": {
+ "fingerprint": "09vSzO6KXcw=",
+ "items": [
+ {
+ "key": "startup-script",
+ "value": "apt-get -y update && apt-get -y install apache2 && hostname > /var/www/index.html"
+ }
+ ],
+ "kind": "compute#metadata"
+ },
+ "name": "libcloud-lb-nopubip-001",
+ "networkInterfaces": [
+ {
+ "name": "nic0",
+ "network": "https://www.googleapis.com/compute/v1/projects/project_name/global/networks/default",
+ "networkIP": "10.240.94.66"
+ }
+ ],
+ "scheduling": {
+ "automaticRestart": true,
+ "onHostMaintenance": "MIGRATE"
+ },
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-b/instances/libcloud-lb-nopubip-001",
+ "status": "RUNNING",
+ "tags": {
+ "fingerprint": "XI0he92M8l8=",
+ "items": [
+ "libcloud-lb-demo-www"
+ ]
+ },
+ "zone": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-b"
+}
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1666a8da/libcloud/test/compute/test_gce.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_gce.py b/libcloud/test/compute/test_gce.py
index 9ec97e0..630ecd1 100644
--- a/libcloud/test/compute/test_gce.py
+++ b/libcloud/test/compute/test_gce.py
@@ -3160,6 +3160,12 @@ class GCEMockHttp(MockHttpTestCase):
'zones_us-central1-a_instances_lcnode-001.json')
return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
+ def _zones_us_central1_b_instances_libcloud_lb_nopubip_001(
+ self, method, url, body, headers):
+ body = self.fixtures.load(
+ 'zones_us-central1-b_instances_libcloud-lb-nopubip-001.json')
+ return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
+
def _zones_us_central1_b_instances_libcloud_lb_demo_www_000(
self, method, url, body, headers):
body = self.fixtures.load(
http://git-wip-us.apache.org/repos/asf/libcloud/blob/1666a8da/libcloud/test/loadbalancer/test_gce.py
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/test_gce.py b/libcloud/test/loadbalancer/test_gce.py
index 41d0594..bd5d5ea 100644
--- a/libcloud/test/loadbalancer/test_gce.py
+++ b/libcloud/test/loadbalancer/test_gce.py
@@ -189,6 +189,13 @@ class GCELoadBalancerTest(GoogleTestCase):
self.assertEqual(member.id, node.name)
self.assertEqual(member.port, balancer.port)
+ def test_node_to_member_no_pub_ip(self):
+ node = self.driver.gce.ex_get_node('libcloud-lb-nopubip-001',
+ 'us-central1-b')
+ balancer = self.driver.get_balancer('lcforwardingrule')
+ member = self.driver._node_to_member(node, balancer)
+ self.assertIsNone(member.ip)
+
def test_forwarding_rule_to_loadbalancer(self):
fwr = self.driver.gce.ex_get_forwarding_rule('lcforwardingrule')
balancer = self.driver._forwarding_rule_to_loadbalancer(fwr)
[2/2] libcloud git commit: Update changelog for libcloud-879
Posted by al...@apache.org.
Update changelog for libcloud-879
Signed-off-by: Allard Hoeve <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4c67398d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4c67398d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4c67398d
Branch: refs/heads/trunk
Commit: 4c67398d3768478cece3cbf2a11041bfcaf11249
Parents: 1666a8d
Author: Allard Hoeve <al...@gmail.com>
Authored: Fri Dec 23 15:17:04 2016 +0100
Committer: Allard Hoeve <al...@gmail.com>
Committed: Fri Dec 23 15:17:09 2016 +0100
----------------------------------------------------------------------
CHANGES.rst | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/4c67398d/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 1ad7da0..d0b82e3 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -111,6 +111,10 @@ Load Balancing
(LIBCLOUD-869, GITHUB-936)
[Anton Kozyrev]
+- Fix bug where GCE Load balancer supposes that all VMs have public ips
+ (LIBCLOUD-879, GITHUB-952)
+ [Chris Walker]
+
Storage
~~~~~~~