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. In addition a change to daemonize the haproxy process instead
of managing through supervisor.

Change-Id: I2394f29c4a11bffeee4b0184ce6cd6867b01e0e9
Closes-Bug: #1461882
  • Loading branch information
rrugge committed Jun 5, 2015
1 parent d49d95b commit 560f20c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 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 @@ -262,7 +262,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 @@ -401,8 +400,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 @@ -429,6 +426,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 @@ -734,9 +734,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
Expand Up @@ -134,7 +134,7 @@ def set_lbaas(self):
raise ValueError('Need to create the network namespace before set '
'up the lbaas')

haproxy_process.start_update_haproxy(self.cfg_file, self.namespace)
haproxy_process.start_update_haproxy(self.cfg_file, self.namespace, True)

try:
self.ip_ns.netns.execute(['route', 'add', 'default', 'gw', self.gw_ip])
Expand All @@ -146,7 +146,7 @@ def release_lbaas(self):
raise ValueError('Need to create the network namespace before '
'relasing lbaas')

haproxy_process.stop_haproxy(self.cfg_file)
haproxy_process.stop_haproxy(self.cfg_file, True)

try:
self.ip_ns.netns.execute(['route', 'del', 'default'])
Expand Down

0 comments on commit 560f20c

Please sign in to comment.