Skip to content

Commit

Permalink
Merge "LBAAS upgrade from 2.0 to 2.2+" into R2.21.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Nov 4, 2015
2 parents 4773e6e + c75c82e commit b08912f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
21 changes: 16 additions & 5 deletions src/config/svc-monitor/svc_monitor/instance_manager.py
Expand Up @@ -310,11 +310,22 @@ def cleanup_svc_vm_ports(self, vmi_list):
continue

for iip in vmi_obj.get_instance_ip_back_refs() or []:
try:
self._vnc_lib.instance_ip_delete(id=iip['uuid'])
InstanceIpSM.delete(iip['uuid'])
except NoIdError:
pass
vip = False
iip_cache = InstanceIpSM.locate(iip['uuid'])
for port_id in iip_cache.virtual_machine_interfaces:
port = VirtualMachineInterfaceSM.get(port_id)
if port and port.virtual_ip:
vip = True
break
if vip:
self._vnc_lib.ref_update('instance-ip', iip['uuid'],
'virtual-machine-interface', vmi_id, None, 'DELETE')
else:
try:
self._vnc_lib.instance_ip_delete(id=iip['uuid'])
InstanceIpSM.delete(iip['uuid'])
except NoIdError:
pass

try:
self._vnc_lib.virtual_machine_interface_delete(id=vmi_id)
Expand Down
28 changes: 8 additions & 20 deletions src/config/svc-monitor/svc_monitor/svc_monitor.py
Expand Up @@ -392,26 +392,14 @@ def upgrade(self):
continue
nova_vm = self._nova_client.oper('servers', 'get',
si.proj_name, id=vm_id)
if not nova_vm:
continue
if not nova_vm.name.split('__')[-1].isdigit():
if nova_vm:
vm_name = nova_vm.name
else:
vm_name = vm.name
if not vm_name.split('__')[-1].isdigit():
continue

si_obj = ServiceInstance()
si_obj.name = si.name
si_obj.fq_name = si.fq_name
index = int(nova_vm.name.split('__')[-1]) - 1
instance_name = self.vm_manager._get_instance_name(
si_obj, index)
vm_obj = VirtualMachine()
vm_obj.uuid = vm_id
vm_obj.fq_name = [vm_id]
vm_obj.set_display_name(instance_name + '__' +
st.virtualization_type)
try:
self._vnc_lib.virtual_machine_update(vm_obj)
except Exception:
pass
vm.virtualization_type = st.virtualization_type
self._delete_service_instance(vm)

def launch_services(self):
for si in ServiceInstanceSM.values():
Expand Down Expand Up @@ -798,7 +786,7 @@ def _create_service_instance(self, si):

def _delete_service_instance(self, vm):
self.logger.log_info("Deleting VM %s %s" %
((':').join(vm.proj_fq_name), vm.uuid))
((':').join(vm.fq_name), vm.uuid))

try:
if vm.virtualization_type == svc_info.get_vm_instance_type():
Expand Down

0 comments on commit b08912f

Please sign in to comment.