Skip to content

Commit

Permalink
Generate mac from instance ip for service VMs
Browse files Browse the repository at this point in the history
Generate the same mac-address for all interfaces sharing the same
IP.

Change-Id: I6276f48e851afb5becb932e6ae3d33c2813217b5
Closes-Bug: #1461882
  • Loading branch information
rrugge committed Jun 5, 2015
1 parent 5a35ba1 commit 8488ab5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/config/svc-monitor/svc_monitor/instance_manager.py
Expand Up @@ -102,7 +102,7 @@ def _allocate_iip(self, vn_obj, iip_name):
try:
self._vnc_lib.instance_ip_create(iip_obj)
except RefsExistError:
pass
iip_obj = self._vnc_lib.instance_ip_read(fq_name=[iip_name])

return iip_obj

Expand Down Expand Up @@ -259,7 +259,6 @@ def validate_network_config(self, st, si):
nic['static-route-enable'] = st_if.get('static_route_enable')
nic['static-routes'] = si_if.get('static_routes')
nic['user-visible'] = user_visible
nic['mac-address'] = self.mac_alloc(vn_id)
si.vn_info.insert(index, nic)

if config_complete:
Expand Down Expand Up @@ -398,8 +397,6 @@ def _create_svc_vm_port(self, nic, instance_name, si, st,
vmi_updated = True

if vmi_create:
mac_addrs_obj = MacAddressesType([nic['mac-address']])
vmi_obj.set_virtual_machine_interface_mac_addresses(mac_addrs_obj)
try:
self._vnc_lib.virtual_machine_interface_create(vmi_obj)
except RefsExistError:
Expand All @@ -426,6 +423,11 @@ def _create_svc_vm_port(self, nic, instance_name, si, st,
% (instance_name, proj_obj.name))
return

# set mac address
mac_addrs_obj = MacAddressesType([self.mac_alloc(iip_obj.uuid)])
vmi_obj.set_virtual_machine_interface_mac_addresses(mac_addrs_obj)
self._vnc_lib.virtual_machine_interface_update(vmi_obj)

# check if vmi already linked to iip
iip_update = True
iip = InstanceIpSM.get(iip_obj.uuid)
Expand Down
5 changes: 2 additions & 3 deletions src/config/svc-monitor/svc_monitor/svc_monitor.py
Expand Up @@ -713,9 +713,8 @@ def _delete_service_instance(self, vm):
return True

def _relaunch_service_instance(self, si):
if si.state == 'active':
si.state = 'relaunch'
self._create_service_instance(si)
si.state = 'relaunch'
self._create_service_instance(si)

def _check_service_running(self, si):
st = ServiceTemplateSM.get(si.service_template)
Expand Down

0 comments on commit 8488ab5

Please sign in to comment.