Fix neutron protection plugin exceptions

In [0], some exceptions were removed, but this was sent before the
network protection plugin was merged. As a result, the network
protection plugin is using the old, removed exception.
Use the correct exceptions.

  [0] https://review.openstack.org/467960/

Change-Id: I9a4e02fead2b7948b51eeb2d7ca305f3f0b24ccd
This commit is contained in:
Yuval Brik 2017-08-13 16:08:30 +03:00
parent 19917ee7f3
commit 3a534f0fdd
2 changed files with 10 additions and 12 deletions

View File

@ -308,11 +308,6 @@ class RestoreResourceFailed(KarborException):
" type=%(resource_type)s")
class GetBackupFailed(KarborException):
message = _("Get Backup failed: %(reason)s, id=%(resource_id)s,"
" type=%(resource_type)s")
class FlowError(KarborException):
message = _("Flow: %(flow)s, Error: %(error)s")

View File

@ -31,7 +31,7 @@ neutron_backup_opts = [
cfg.IntOpt(
'poll_interval', default=15,
help='Poll interval for Neutron backup status'
),
),
]
@ -243,7 +243,8 @@ class ProtectOperation(protection_plugin.Operation):
LOG.error("create backup failed, network_id: %s.", network_id)
bank_section.update_object("status",
constants.CHECKPOINT_STATUS_ERROR)
raise exception.CreateBackupFailed(
raise exception.CreateResourceFailed(
name="Network Backup",
reason=err,
resource_id=network_id,
resource_type=self._SUPPORT_RESOURCE_TYPES)
@ -308,7 +309,7 @@ class RestoreOperation(protection_plugin.Operation):
is_success = self._check_complete(neutron_client, net_ids, 'network')
if not is_success:
raise Exception("Crate networks failed")
raise Exception("Create networks failed")
def _restore_subnets(self, neutron_client, new_resources,
nets_meta, subs_meta):
@ -395,7 +396,7 @@ class RestoreOperation(protection_plugin.Operation):
is_success = self._check_complete(neutron_client, port_ids, 'port')
if not is_success:
raise Exception("Crate port failed")
raise Exception("Create port failed")
def _get_new_external_gateway(self, public_network_id, gateway_info,
neutron_client):
@ -435,7 +436,7 @@ class RestoreOperation(protection_plugin.Operation):
is_success = self._check_complete(neutron_client, router_ids, 'router')
if not is_success:
raise Exception("Crate router failed")
raise Exception("Create router failed")
def _restore_routerinterfaces(self, neutron_client, new_resources,
subs_meta, routers_meta, ports_meta):
@ -626,7 +627,8 @@ class RestoreOperation(protection_plugin.Operation):
except Exception as e:
LOG.error("restore network backup failed, network_id: %s.",
network_id)
raise exception.RestoreBackupFailed(
raise exception.RestoreResourceFailed(
name="Network Backup",
reason=six.text_type(e),
resource_id=network_id,
resource_type=constants.NETWORK_RESOURCE_TYPE
@ -655,7 +657,8 @@ class DeleteOperation(protection_plugin.Operation):
LOG.error("Delete backup failed, network_id: %s.", network_id)
bank_section.update_object("status",
constants.RESOURCE_STATUS_ERROR)
raise exception.DeleteBackupFailed(
raise exception.DeleteResourceFailed(
name="Network Backup",
reason=err,
resource_id=network_id,
resource_type=self._SUPPORT_RESOURCE_TYPES)