Merge lp:~hazmat/pyjuju/ostack-diablo-hp-compat into lp:pyjuju
Proposed by
Kapil Thangavelu
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 606 | ||||
Proposed branch: | lp:~hazmat/pyjuju/ostack-diablo-hp-compat | ||||
Merge into: | lp:pyjuju | ||||
Diff against target: |
184 lines (+67/-19) 3 files modified
juju/providers/openstack/client.py (+11/-5) juju/providers/openstack/ports.py (+27/-10) juju/providers/openstack/tests/test_ports.py (+29/-4) |
||||
To merge this branch: | bzr merge lp:~hazmat/pyjuju/ostack-diablo-hp-compat | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jim Baker (community) | Approve | ||
Review via email: mp+140815@code.launchpad.net |
Description of the change
Openstack security group api compat with hpcloud
It looks like the issue is the server security group details don't have rule
information in the diablo/hpcloud api fallback which caused problems for juju
when trying to determine what ports where open in the group (couldn't close
ports, and attempted to open ports multiple times). The simple workaround is a
specific path for hpcloud that fetches the group detail info separately if
server group details don't have rule info.
Verified against folsom/canonistack and hpcloud/diablo.
To post a comment you must log in.
Reviewers: mp+140815_ code.launchpad. net,
Message:
Please take a look.
Description:
Openstack security group api compat with hpcloud
It looks like the issue is the server security group details don't have
rule
information in the diablo/hpcloud api fallback which caused problems for
juju
when trying to determine what ports where open in the group (couldn't
close
ports, and attempted to open ports multiple times). The simple
workaround is a
specific path for hpcloud that fetches the group detail info separately
if
server group details don't have rule info.
https:/ /bugs.launchpad .net/juju/ +bug/1092343
https:/ /code.launchpad .net/~hazmat/ juju/ostack- diablo- hp-compat/ +merge/ 140815
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6966047/
Affected files: openstack/ client. py openstack/ ports.py
A [revision details]
M juju/providers/
M juju/providers/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: juju/providers/ openstack/ client. py /openstack/ client. py' openstack/ client. py 2012-10-26 14:52:35 +0000 openstack/ client. py 2012-12-20 03:54:46 +0000
["servers" , server_id, "os-security- groups" ],
root="security_ groups" ) server( server_ id).addCallback ( itemgetter( "security_ groups" ))) fallback( f): server( server_ id).addCallback ( itemgetter( "security_ groups" )) _get_group_ fallback)
=== modified file 'juju/providers
--- juju/providers/
+++ juju/providers/
@@ -411,12 +411,18 @@
d = self.get(
- # 2012-07-12: Workaround lack of this api in HP cloud
- d.addErrback(
- lambda f: self.get_
- operator.
+
+ # 2012-07-12: kt Workaround lack of this api in HP cloud
+ def _get_group_
+ log.debug("Falling back to older/diablo sec groups api")
+ return self.get_
+ operator.
+ d.addErrback(
return d
+ def get_security_ group_details( self, group_id): ["os-security- groups" , group_id], "security_group") groups( self): ["os-security- groups" ], "security_groups")
+ return self.get(
+
def list_security_
return self.get(
Index: juju/providers/ openstack/ ports.py /openstack/ ports.py' openstack/ ports.py 2012-09-19 05:34:00 +0000 openstack/ ports.py 2012-12-20 03:54:46 +0000
group_ name = self._machine_ group_name( machine_ id) get_server_ security_ groups( server_ id) get_security_ group_details( group[' id'])
=== modified file 'juju/providers
--- juju/providers/
+++ juju/providers/
@@ -55,9 +55,20 @@
server_id = machine.instance_id
groups = yield self.nova.
+
+ found = False
for group in groups:
if group['name'] == group_name:
- returnValue(group)
+ found = group
+ break
+
+ # 2012/12/19: kt diablo/hpcloud compatibility
+ if found and not 'rules' in group:
+ group = yield self.nova.
+
+...