]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add error message when migrate from distributed router to centralized
authorSergey Belous <sbelous@mirantis.com>
Fri, 24 Jul 2015 10:41:35 +0000 (13:41 +0300)
committerSergey Belous <sbelous@mirantis.com>
Fri, 24 Jul 2015 13:57:09 +0000 (16:57 +0300)
When trying to migrate from distributed router to centralized
a NotImplementedError occurs with empty message.
Need to concretize a message.

Closes-Bug: #1477509
Change-Id: I2b57ec5af38a0f87c1ab256cb8af66bc443be824

neutron/common/exceptions.py
neutron/db/l3_dvr_db.py
neutron/tests/unit/db/test_l3_dvr_db.py

index c6ec6ccca5407117f89eff47a7a0d4ee074766c3..373c69979b69cab0e8b04a6509e28da8cc015b0f 100644 (file)
@@ -69,6 +69,10 @@ class ServiceUnavailable(NeutronException):
     message = _("The service is unavailable")
 
 
+class NotSupported(NeutronException):
+    message = _('Not supported: %(msg)s')
+
+
 class AdminRequired(NotAuthorized):
     message = _("User does not have admin privileges: %(reason)s")
 
index f4aa8a13ea6831faadbb13a05b6f602e9f589314..47fbbc63f2e9676f4ab9f8fac22d72a1be5d4730 100644 (file)
@@ -87,7 +87,8 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
             router_res.get('distributed') is False):
             LOG.info(_LI("Centralizing distributed router %s "
                          "is not supported"), router_db['id'])
-            raise NotImplementedError()
+            raise n_exc.NotSupported(msg=_("Migration from distributed router "
+                                           "to centralized"))
         elif (not router_db.extra_attributes.distributed and
               router_res.get('distributed')):
             # Notify advanced services of the imminent state transition
index c5fbb45e8d721bee61c97a34858a118d782b5f7d..419e168fb7a29d8d361146d021c3b1d5e20affe7 100644 (file)
@@ -85,7 +85,7 @@ class L3DvrTestCase(testlib_api.SqlTestCase):
             'distributed': True
         }
         router_db = self._create_router(router)
-        self.assertRaises(NotImplementedError,
+        self.assertRaises(exceptions.NotSupported,
                           self.mixin._validate_router_migration,
                           self.ctx, router_db, {'distributed': False})