summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Willey <todd@lapex>2010-07-16 15:11:48 -0400
committerTodd Willey <todd@lapex>2010-07-16 15:11:48 -0400
commitc954657ba018dbeda5db6ef39dc68a0fe48f421f (patch)
treee9b6c9ae9b306a37417251c4093b3897106d71e7
parent67d4e16a8c18989e73456f79220b97faa7374d92 (diff)
Fixes things that were not quite right after big merge party.
-rw-r--r--nova/auth/users.py25
-rw-r--r--nova/compute/network.py10
2 files changed, 21 insertions, 14 deletions
diff --git a/nova/auth/users.py b/nova/auth/users.py
index 72edcc2aa..0903341b4 100644
--- a/nova/auth/users.py
+++ b/nova/auth/users.py
@@ -462,11 +462,11 @@ class UserManager(object):
description=None, member_users=None):
if member_users:
member_users = [User.safe_id(u) for u in member_users]
+ # NOTE(vish): try to associate a vpn ip and port first because
+ # if it throws an exception, we save having to
+ # create and destroy a project
+ Vpn.create(name)
with LDAPWrapper() as conn:
- # NOTE(vish): try to associate a vpn ip and port first because
- # if it throws an exception, we save having to
- # create and destroy a project
- Vpn.create(name)
return conn.create_project(name,
User.safe_id(manager_user),
description,
@@ -527,15 +527,16 @@ class UserManager(object):
with LDAPWrapper() as conn:
user = User.safe_id(user)
result = conn.create_user(user, access, secret, admin)
- if create_project:
- # NOTE(vish): if the project creation fails, we delete
- # the user and return an exception
- try:
- conn.create_project(user, user, user)
- except Exception:
+ if create_project:
+ # NOTE(vish): if the project creation fails, we delete
+ # the user and return an exception
+ try:
+ conn.create_project(user, user, user)
+ except Exception:
+ with LDAPWrapper() as conn:
conn.delete_user(user)
- raise
- return result
+ raise
+ return result
def delete_user(self, user, delete_project=True):
with LDAPWrapper() as conn:
diff --git a/nova/compute/network.py b/nova/compute/network.py
index 8592d7af7..ff527f74e 100644
--- a/nova/compute/network.py
+++ b/nova/compute/network.py
@@ -130,8 +130,9 @@ class Vlan(datastore.BasicModel):
@datastore.absorb_connection_error
def all(cls):
set_name = cls._redis_set_name(cls.__name__)
- for project,vlan in datastore.Redis.instance().hgetall(set_name):
- yield cls(project, vlan)
+ elements = datastore.Redis.instance().hgetall(set_name)
+ for project in elements:
+ yield cls(project, elements[project])
@datastore.absorb_connection_error
def save(self):
@@ -291,6 +292,7 @@ class BridgedNetwork(BaseNetwork):
netmask
"""
+ bridge_gets_ip = False
override_type = 'network'
@classmethod
@@ -532,6 +534,10 @@ def get_vlan_for_project(project_id):
return Vlan.create(project_id, vnum)
raise compute_exception.AddressNotAllocated("Out of VLANs")
+def get_network_by_interface(iface, security_group='default'):
+ vlan = iface.rpartition("br")[2]
+ return get_project_network(Vlan.dict_by_vlan().get(vlan), security_group)
+
def get_network_by_address(address):
logging.debug("Get Network By Address: %s" % address)
for project in users.UserManager.instance().get_projects():