77 ri.router[l3_constants.INTERFACE_KEY] = [] |
77 ri.router[l3_constants.INTERFACE_KEY] = [] |
78 ri.router[l3_constants.FLOATINGIP_KEY] = [] |
78 ri.router[l3_constants.FLOATINGIP_KEY] = [] |
79 self.process_router(ri) |
79 self.process_router(ri) |
80 if self.conf.enable_metadata_proxy: |
80 if self.conf.enable_metadata_proxy: |
81 self._destroy_metadata_proxy(ri.router_id, ri.ns_name) |
81 self._destroy_metadata_proxy(ri.router_id, ri.ns_name) |
82 |
82 ra.disable_ipv6_ra(ri.router_id) |
83 del self.router_info[router_id] |
83 del self.router_info[router_id] |
84 |
84 |
85 def _get_metadata_proxy_process_manager(self, router_id, ns_name): |
85 def _get_metadata_proxy_process_manager(self, router_id, ns_name): |
86 return external_process.ProcessManager( |
86 return external_process.ProcessManager( |
87 self.conf, |
87 self.conf, |
366 # proceed with the old-style of doing things |
366 # proceed with the old-style of doing things |
367 mac_address = ex_gw_port['mac_address'] |
367 mac_address = ex_gw_port['mac_address'] |
368 dl.create_vnic(self.conf.external_network_datalink, |
368 dl.create_vnic(self.conf.external_network_datalink, |
369 mac_address=mac_address, vid=vid) |
369 mac_address=mac_address, vid=vid) |
370 else: |
370 else: |
371 # This is to handle HA by Solaris Cluster and is similar to |
371 self.driver.plug(ex_gw_port['tenant_id'], |
372 # the code we already have for the DHCP Agent. So, when |
372 ex_gw_port['network_id'], |
373 # the 1st L3 agent is down and the second L3 agent tries to |
373 ex_gw_port['id'], external_dlname) |
374 # connect its VNIC to EVS, we will end up in "vport in use" |
|
375 # error. So, we need to reset the vport before we connect |
|
376 # the VNIC to EVS. |
|
377 cmd = ['/usr/sbin/evsadm', 'show-vport', '-f', |
|
378 'vport=%s' % ex_gw_port['id'], '-co', |
|
379 'evs,vport,status'] |
|
380 stdout = utils.execute(cmd) |
|
381 evsname, vportname, status = stdout.strip().split(':') |
|
382 tenant_id = ex_gw_port['tenant_id'] |
|
383 if status == 'used': |
|
384 cmd = ['/usr/sbin/evsadm', 'reset-vport', '-T', tenant_id, |
|
385 '%s/%s' % (evsname, vportname)] |
|
386 utils.execute(cmd) |
|
387 |
|
388 # next remove protection setting on the VPort to allow |
|
389 # multiple floating IPs to be configured on the l3e* |
|
390 # interface |
|
391 evsvport = "%s/%s" % (ex_gw_port['network_id'], |
|
392 ex_gw_port['id']) |
|
393 cmd = ['/usr/sbin/evsadm', 'set-vportprop', '-T', |
|
394 tenant_id, '-p', 'protection=none', evsvport] |
|
395 utils.execute(cmd) |
|
396 dl.connect_vnic(evsvport, tenant_id) |
|
397 |
374 |
398 self.driver.init_l3(external_dlname, [ex_gw_port['ip_cidr']]) |
375 self.driver.init_l3(external_dlname, [ex_gw_port['ip_cidr']]) |
399 |
376 |
400 # TODO(gmoodalb): wrap route(1m) command within a class in net_lib.py |
377 # TODO(gmoodalb): wrap route(1m) command within a class in net_lib.py |
401 gw_ip = ex_gw_port['subnet']['gateway_ip'] |
378 gw_ip = ex_gw_port['subnet']['gateway_ip'] |
439 utils.execute(cmd, check_exit_code=False) |
416 utils.execute(cmd, check_exit_code=False) |
440 |
417 |
441 if net_lib.Datalink.datalink_exists(external_dlname): |
418 if net_lib.Datalink.datalink_exists(external_dlname): |
442 self.driver.fini_l3(external_dlname) |
419 self.driver.fini_l3(external_dlname) |
443 self.driver.unplug(external_dlname) |
420 self.driver.unplug(external_dlname) |
444 |
|
445 # remove the EVS VPort associated with external network |
|
446 cmd = ['/usr/sbin/evsadm', 'remove-vport', |
|
447 '-T', ex_gw_port['tenant_id'], |
|
448 '%s/%s' % (ex_gw_port['network_id'], ex_gw_port['id'])] |
|
449 try: |
|
450 utils.execute(cmd) |
|
451 except Exception as err: |
|
452 LOG.error(_("Failed to delete the EVS VPort associated with " |
|
453 "external network: %s") % err) |
|
454 |
421 |
455 def _get_ippool_name(self, mac_address, suffix=None): |
422 def _get_ippool_name(self, mac_address, suffix=None): |
456 # Generate a unique-name for ippool(1m) from that last 3 |
423 # Generate a unique-name for ippool(1m) from that last 3 |
457 # bytes of mac-address. It is called pool name, but it is |
424 # bytes of mac-address. It is called pool name, but it is |
458 # actually a 32 bit integer |
425 # actually a 32 bit integer |
594 |
561 |
595 if net_lib.Datalink.datalink_exists(internal_dlname): |
562 if net_lib.Datalink.datalink_exists(internal_dlname): |
596 self.driver.fini_l3(internal_dlname) |
563 self.driver.fini_l3(internal_dlname) |
597 self.driver.unplug(internal_dlname) |
564 self.driver.unplug(internal_dlname) |
598 |
565 |
599 # remove the EVS VPort associated with internal network |
|
600 cmd = ['/usr/sbin/evsadm', 'remove-vport', '-T', port['tenant_id'], |
|
601 '%s/%s' % (port['network_id'], port['id'])] |
|
602 try: |
|
603 utils.execute(cmd) |
|
604 except Exception as err: |
|
605 LOG.error(_("Failed to delete the EVS VPort associated with " |
|
606 "internal network: %s") % err) |
|
607 |
|
608 def routes_updated(self, ri): |
566 def routes_updated(self, ri): |
609 pass |
567 pass |