Support parameter "skip_host_detach" in LogicalPort API
This patch will add the support for parameter skip_host_detach in LogicalPort deletion request as the preparation of a corner fix which will delete the discovered port without host detach. The other preparation in this patch is to add the new Exception class VifRestoreAlreadyCompleted. Change-Id: I012dbc7db5c0af31d670e71e1d04fa6216f269b3
This commit is contained in:
parent
d73f0aeb76
commit
d11fe387c7
@ -523,6 +523,17 @@ class LogicalPortTestCase(BaseTestResource):
|
||||
super(LogicalPortTestCase, self).test_delete_resource(
|
||||
extra_params='detach=true')
|
||||
|
||||
def test_delete_port_skip_host_detach(self):
|
||||
"""Test deleting port with skip_host_detach=true."""
|
||||
mocked_resource = self.get_mocked_resource()
|
||||
fake_uuid = uuidutils.generate_uuid()
|
||||
mocked_resource.delete_skip_host_detach(fake_uuid)
|
||||
uri = ('https://1.2.3.4/api/v1/%s/%s?detach=true&skip_host_detach='
|
||||
'true' % (mocked_resource.uri_segment, fake_uuid))
|
||||
test_client.assert_json_call(
|
||||
'delete', mocked_resource, uri,
|
||||
headers=self.default_headers())
|
||||
|
||||
def test_get_logical_port_by_attachment(self):
|
||||
"""Test deleting port."""
|
||||
mocked_resource = self.get_mocked_resource()
|
||||
|
@ -112,7 +112,8 @@ def http_error_to_exception(status_code, error_code, related_error_codes=None):
|
||||
'500232': exceptions.StaleRevision, # Missing dependent objects
|
||||
'503040': exceptions.NsxSegemntWithVM,
|
||||
'100148': exceptions.StaleRevision,
|
||||
'500012': exceptions.NsxInvalidPath},
|
||||
'500012': exceptions.NsxInvalidPath,
|
||||
'612504': exceptions.VifRestoreAlreadyCompleted},
|
||||
requests.codes.CONFLICT: exceptions.StaleRevision,
|
||||
requests.codes.PRECONDITION_FAILED: exceptions.StaleRevision,
|
||||
requests.codes.INTERNAL_SERVER_ERROR:
|
||||
|
@ -249,3 +249,7 @@ class RetryConfirm(NsxLibException):
|
||||
class ResourceInUse(ManagerError):
|
||||
message = _("The object cannot be deleted as either it has children or it "
|
||||
"is being referenced by other objects")
|
||||
|
||||
|
||||
class VifRestoreAlreadyCompleted(ManagerError):
|
||||
message = _("Vif Restore failed: %(details)s")
|
||||
|
@ -187,6 +187,10 @@ class LogicalPort(utils.NsxLibApiBase):
|
||||
def delete(self, lport_id):
|
||||
self._delete_with_retry('%s?detach=true' % lport_id)
|
||||
|
||||
def delete_skip_host_detach(self, lport_id):
|
||||
self._delete_with_retry(
|
||||
'%s?detach=true&skip_host_detach=true' % lport_id)
|
||||
|
||||
def update(self, lport_id, vif_uuid,
|
||||
name=None, admin_state=None,
|
||||
address_bindings=None, switch_profile_ids=None,
|
||||
|
Loading…
Reference in New Issue
Block a user