summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorTrey Morris <trey.morris@rackspace.com>2011-06-20 11:56:15 -0500
committerTrey Morris <trey.morris@rackspace.com>2011-06-20 11:56:15 -0500
commit0502a2b35fb1a4424e7249cb9f39d7fc98bf37b5 (patch)
treedec6563c259d0a069077846177dc47b4a2b6f44e /nova
parent9873968029e19e9846e04951f841d02c27c9d6ae (diff)
downloadnova-0502a2b35fb1a4424e7249cb9f39d7fc98bf37b5.tar.gz
nova-0502a2b35fb1a4424e7249cb9f39d7fc98bf37b5.tar.xz
nova-0502a2b35fb1a4424e7249cb9f39d7fc98bf37b5.zip
updated the exceptions around virtual interface creation, updated flatDHCP manager comment
Diffstat (limited to 'nova')
-rw-r--r--nova/db/sqlalchemy/api.py9
-rw-r--r--nova/exception.py4
-rw-r--r--nova/network/manager.py7
3 files changed, 13 insertions, 7 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index f86180b1f..3cb35b649 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -816,9 +816,12 @@ def virtual_interface_create(context, values):
:param values: = dict containing column values
"""
- vif_ref = models.VirtualInterface()
- vif_ref.update(values)
- vif_ref.save()
+ try:
+ vif_ref = models.VirtualInterface()
+ vif_ref.update(values)
+ vif_ref.save()
+ except IntegrityError:
+ raise exception.VirtualInterfaceCreateException()
return vif_ref
diff --git a/nova/exception.py b/nova/exception.py
index a4c1b2d30..8e67de965 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -118,6 +118,10 @@ class NovaException(Exception):
return self._error_string
+class VirtualInterfaceCreateException(NovaException):
+ message = _("Virtual Interface creation failed")
+
+
class VirtualInterfaceMacAddressException(NovaException):
message = _("5 attempts to create virtual interface"
"with unique mac address failed")
diff --git a/nova/network/manager.py b/nova/network/manager.py
index 68818c6d7..f51738643 100644
--- a/nova/network/manager.py
+++ b/nova/network/manager.py
@@ -62,7 +62,6 @@ from nova import quota
from nova import utils
from nova import rpc
from nova.network import api as network_api
-from sqlalchemy.exc import IntegrityError
import random
@@ -452,7 +451,7 @@ class NetworkManager(manager.SchedulerDependentManager):
try:
self.db.virtual_interface_create(context, vif)
break
- except IntegrityError:
+ except exception.VirtualInterfaceCreateException:
vif['address'] = self.generate_mac_address()
else:
self.db.virtual_interface_delete_by_instance(context,
@@ -711,8 +710,8 @@ class FlatDHCPManager(FloatingIP, RPCAllocateFixedIP, NetworkManager):
"""Flat networking with dhcp.
FlatDHCPManager will start up one dhcp server to give out addresses.
- It never injects network settings into the guest. Otherwise it behaves
- like FlatDHCPManager.
+ It never injects network settings into the guest. It also manages bridges.
+ Otherwise it behaves like FlatManager.
"""