[jira] [Commented] (LIBCLOUD-879) GCE Load balancer suppose that all VM have public ip

2018-01-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LIBCLOUD-879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16339140#comment-16339140
 ] 

ASF GitHub Bot commented on LIBCLOUD-879:
-

Github user charly37 closed the pull request at:

https://github.com/apache/libcloud/pull/952


> GCE Load balancer suppose that all VM have public ip
> 
>
> Key: LIBCLOUD-879
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-879
> Project: Libcloud
>  Issue Type: Bug
>  Components: LoadBalancer
> Environment: GCE MASTER
>Reporter: charles walker
>Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When calling "list_members()" on a GCe load balancer libcloud object I end up 
> with the following stack :
> {noformat}
> Retrieve 2 Lbs. Here is the list : [ name=europe-lb-forwarding-rule, state=None, ip=10.77, 
> port=30012-30012>,  name=load-balancer-prd-comp-forwarding-rule-2, state=None, ip=1093, 
> port=30001-30001>]
> --Printing the node obj for DBG :  uuid=9001a5d9d425dc0e5dd1db5352296b08920bde21, name=tec--infra-2ktm, 
> state=RUNNING, public_ips=[], private_ips=['10.'], provider=Google 
> Compute Engine ...>
> Traceback (most recent call last):
>   File "LbTestPy.py", line 43, in 
> print ("Members: " +str(aLbs[0].list_members()))
>   File 
> "/home/cloud-user/LbTest/src/apache-libcloud/libcloud/loadbalancer/base.py", 
> line 110, in list_members
> return self.driver.balancer_list_members(balancer=self)
>   File 
> "/home/cloud-user/LbTest/src/apache-libcloud/libcloud/loadbalancer/drivers/gce.py",
>  line 274, in balancer_list_members
> balancer.extra['targetpool'].nodes]
>   File 
> "/home/cloud-user/LbTest/src/apache-libcloud/libcloud/loadbalancer/drivers/gce.py",
>  line 342, in _node_to_member
> member_ip = node.public_ips[0]
> IndexError: list index out of range
> {noformat}
> After some investigations it appears to comes from the method "def 
> _node_to_member(self, node, balancer):" in loadbalancer/drivers/gce.py. Mode 
> precisely this piece of the code :
> {code:title=code1.py|borderStyle=solid}
> if hasattr(node, 'name'):
>   member_id = node.name
>   member_ip = node.public_ips[0]
> else:
>   member_id = node
>   member_ip = None
> {code}
> which imply that all VM in the load balancer will have public IP. This is not 
> necessarly the case and thus when it happen the process crash (as you can see 
> in the previous stack where i added some debug log in my libcloud version to 
> print the node where the error occurs).
> I would had suggest to use private ip instead of public but I do not want to 
> impact the existing user of libcloud so I was thinking of a simple fix :
> {code:title=code1.py|borderStyle=solid}
> if hasattr(node, 'name'):
> member_id = node.name
> else:
> member_id = node
> if (len(node.public_ips) > 0):
> member_ip = node.public_ips[0]
> else:
> member_ip = None
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LIBCLOUD-879) GCE Load balancer suppose that all VM have public ip

2016-12-23 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/LIBCLOUD-879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15773003#comment-15773003
 ] 

ASF subversion and git services commented on LIBCLOUD-879:
--

Commit 1666a8da34068db0557cc9b186736f571e73df58 in libcloud's branch 
refs/heads/trunk from [~charly37]
[ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=1666a8d ]

[LIBCLOUD-879] Add support of node without public IP in LB

closes #879

Signed-off-by: Allard Hoeve 


> GCE Load balancer suppose that all VM have public ip
> 
>
> Key: LIBCLOUD-879
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-879
> Project: Libcloud
>  Issue Type: Bug
>  Components: LoadBalancer
> Environment: GCE MASTER
>Reporter: charles walker
>Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When calling "list_members()" on a GCe load balancer libcloud object I end up 
> with the following stack :
> {noformat}
> Retrieve 2 Lbs. Here is the list : [ name=europe-lb-forwarding-rule, state=None, ip=10.77, 
> port=30012-30012>,  name=load-balancer-prd-comp-forwarding-rule-2, state=None, ip=1093, 
> port=30001-30001>]
> --Printing the node obj for DBG :  uuid=9001a5d9d425dc0e5dd1db5352296b08920bde21, name=tec--infra-2ktm, 
> state=RUNNING, public_ips=[], private_ips=['10.'], provider=Google 
> Compute Engine ...>
> Traceback (most recent call last):
>   File "LbTestPy.py", line 43, in 
> print ("Members: " +str(aLbs[0].list_members()))
>   File 
> "/home/cloud-user/LbTest/src/apache-libcloud/libcloud/loadbalancer/base.py", 
> line 110, in list_members
> return self.driver.balancer_list_members(balancer=self)
>   File 
> "/home/cloud-user/LbTest/src/apache-libcloud/libcloud/loadbalancer/drivers/gce.py",
>  line 274, in balancer_list_members
> balancer.extra['targetpool'].nodes]
>   File 
> "/home/cloud-user/LbTest/src/apache-libcloud/libcloud/loadbalancer/drivers/gce.py",
>  line 342, in _node_to_member
> member_ip = node.public_ips[0]
> IndexError: list index out of range
> {noformat}
> After some investigations it appears to comes from the method "def 
> _node_to_member(self, node, balancer):" in loadbalancer/drivers/gce.py. Mode 
> precisely this piece of the code :
> {code:title=code1.py|borderStyle=solid}
> if hasattr(node, 'name'):
>   member_id = node.name
>   member_ip = node.public_ips[0]
> else:
>   member_id = node
>   member_ip = None
> {code}
> which imply that all VM in the load balancer will have public IP. This is not 
> necessarly the case and thus when it happen the process crash (as you can see 
> in the previous stack where i added some debug log in my libcloud version to 
> print the node where the error occurs).
> I would had suggest to use private ip instead of public but I do not want to 
> impact the existing user of libcloud so I was thinking of a simple fix :
> {code:title=code1.py|borderStyle=solid}
> if hasattr(node, 'name'):
> member_id = node.name
> else:
> member_id = node
> if (len(node.public_ips) > 0):
> member_ip = node.public_ips[0]
> else:
> member_ip = None
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (LIBCLOUD-879) GCE Load balancer suppose that all VM have public ip

2016-11-22 Thread charles walker (JIRA)

[ 
https://issues.apache.org/jira/browse/LIBCLOUD-879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15688536#comment-15688536
 ] 

charles walker commented on LIBCLOUD-879:
-

I give it a try tonight and it break the test case because the node object can 
be a string. This works better :
@@ -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



> GCE Load balancer suppose that all VM have public ip
> 
>
> Key: LIBCLOUD-879
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-879
> Project: Libcloud
>  Issue Type: Bug
>  Components: LoadBalancer
> Environment: GCE MASTER
>Reporter: charles walker
>Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When calling "list_members()" on a GCe load balancer libcloud object I end up 
> with the following stack :
> {noformat}
> Retrieve 2 Lbs. Here is the list : [ name=europe-lb-forwarding-rule, state=None, ip=10.77, 
> port=30012-30012>,  name=load-balancer-prd-comp-forwarding-rule-2, state=None, ip=1093, 
> port=30001-30001>]
> --Printing the node obj for DBG :  uuid=9001a5d9d425dc0e5dd1db5352296b08920bde21, name=tec--infra-2ktm, 
> state=RUNNING, public_ips=[], private_ips=['10.'], provider=Google 
> Compute Engine ...>
> Traceback (most recent call last):
>   File "LbTestPy.py", line 43, in 
> print ("Members: " +str(aLbs[0].list_members()))
>   File 
> "/home/cloud-user/LbTest/src/apache-libcloud/libcloud/loadbalancer/base.py", 
> line 110, in list_members
> return self.driver.balancer_list_members(balancer=self)
>   File 
> "/home/cloud-user/LbTest/src/apache-libcloud/libcloud/loadbalancer/drivers/gce.py",
>  line 274, in balancer_list_members
> balancer.extra['targetpool'].nodes]
>   File 
> "/home/cloud-user/LbTest/src/apache-libcloud/libcloud/loadbalancer/drivers/gce.py",
>  line 342, in _node_to_member
> member_ip = node.public_ips[0]
> IndexError: list index out of range
> {noformat}
> After some investigations it appears to comes from the method "def 
> _node_to_member(self, node, balancer):" in loadbalancer/drivers/gce.py. Mode 
> precisely this piece of the code :
> {code:title=code1.py|borderStyle=solid}
> if hasattr(node, 'name'):
>   member_id = node.name
>   member_ip = node.public_ips[0]
> else:
>   member_id = node
>   member_ip = None
> {code}
> which imply that all VM in the load balancer will have public IP. This is not 
> necessarly the case and thus when it happen the process crash (as you can see 
> in the previous stack where i added some debug log in my libcloud version to 
> print the node where the error occurs).
> I would had suggest to use private ip instead of public but I do not want to 
> impact the existing user of libcloud so I was thinking of a simple fix :
> {code:title=code1.py|borderStyle=solid}
> if hasattr(node, 'name'):
> member_id = node.name
> else:
> member_id = node
> if (len(node.public_ips) > 0):
> member_ip = node.public_ips[0]
> else:
> member_ip = None
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)