Skip to content

Commit

Permalink
Fixed service-instance delete issue
Browse files Browse the repository at this point in the history
During the loadbalancer delete, If the instance ip
is removed before the service instance, the evalute of
service instance would call the create_service_instance()
which would do the chown/update for the instance_ip which
may not be there which would cause this error.

Added exception handler to handle this.

Change-Id: I7688b8818f4b68c117ebc024d192fa3f2b4454fb
Closes-bug: #1716881
  • Loading branch information
ymariappan committed Sep 19, 2017
1 parent a0b6ae2 commit 2af08a8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
10 changes: 6 additions & 4 deletions src/config/api-server/vnc_cfg_api_server.py
Expand Up @@ -1928,8 +1928,9 @@ def obj_chown_http_post(self):

try:
obj_type = self._db_conn.uuid_to_obj_type(obj_uuid)
except NoIdError:
raise cfgm_common.exceptions.HttpError(400, 'Invalid object id')
except NoIdError as e:
# Not present in DB
raise cfgm_common.exceptions.HttpError(404, str(e))

# ensure user has RW permissions to object
perms = self._permissions.obj_perms(get_request(), obj_uuid)
Expand Down Expand Up @@ -1961,8 +1962,9 @@ def obj_chmod_http_post(self):

try:
obj_type = self._db_conn.uuid_to_obj_type(obj_uuid)
except NoIdError:
raise cfgm_common.exceptions.HttpError(400, 'Invalid object id')
except NoIdError as e:
# Not present in DB
raise cfgm_common.exceptions.HttpError(404, str(e))

# ensure user has RW permissions to object
perms = self._permissions.obj_perms(get_request(), obj_uuid)
Expand Down
18 changes: 12 additions & 6 deletions src/config/svc-monitor/svc_monitor/instance_manager.py
Expand Up @@ -143,7 +143,10 @@ def _link_and_update_iip_for_family(self, si, vmi_obj, iip_obj):
iip_obj.set_instance_ip_mode(u'active-standby')

iip_obj.add_virtual_machine_interface(vmi_obj)
self._vnc_lib.instance_ip_update(iip_obj)
try:
self._vnc_lib.instance_ip_update(iip_obj)
except NoIdError:
pass

def _link_and_update_iip(self, si, vmi_obj, iip_obj, iipv6_obj):
if iip_obj:
Expand Down Expand Up @@ -603,7 +606,7 @@ def _create_svc_vm_port(self, nic, instance_name, si, st,
self._vnc_lib.virtual_machine_interface_update(vmi_obj)

# VMI should be owned by tenant
self._vnc_lib.chown(vmi_obj.uuid, si.parent_key)
self._vnc_lib.chown(vmi_obj.uuid, proj_obj.uuid)

VirtualMachineInterfaceSM.locate(vmi_obj.uuid)

Expand All @@ -628,10 +631,13 @@ def _create_svc_vm_port(self, nic, instance_name, si, st,
return

# instance-ip should be owned by tenant
if iip_obj:
self._vnc_lib.chown(iip_obj.uuid, si.parent_key)
if iipv6_obj:
self._vnc_lib.chown(iipv6_obj.uuid, si.parent_key)
try:
if iip_obj:
self._vnc_lib.chown(iip_obj.uuid, proj_obj.uuid)
if iipv6_obj:
self._vnc_lib.chown(iipv6_obj.uuid, proj_obj.uuid)
except NoIdError:
pass

# set mac address
if vmi_create:
Expand Down

0 comments on commit 2af08a8

Please sign in to comment.