MCPcopy Create free account
hub / github.com/apache/cloudstack / reconfigure_interfaces

Function reconfigure_interfaces

systemvm/debian/opt/cloud/bin/cs/CsHelper.py:40–58  ·  view source on GitHub ↗
(router_config, interfaces)

Source from the content-addressed store, hash-verified

38
39
40def reconfigure_interfaces(router_config, interfaces):
41 for interface in interfaces:
42 cmd = "ip link show %s | grep ' state '" % interface.get_device()
43 for device in execute(cmd):
44 if " DOWN " in device:
45 cmd = "ip link set %s up" % interface.get_device()
46 # If redundant only bring up public interfaces that are not eth1.
47 # Reason: private gateways are public interfaces.
48 # configure_router.py and keepalived will deal with eth1 public interface.
49
50 if router_config.is_redundant() and interface.is_public():
51 state_cmd = STATE_COMMANDS[router_config.get_type()]
52 logging.info("Check state command => %s" % state_cmd)
53 state = execute(state_cmd)[0]
54 logging.info("Route state => %s" % state)
55 if interface.get_device() != PUBLIC_INTERFACES[router_config.get_type()] and state == "PRIMARY":
56 execute(cmd)
57 else:
58 execute(cmd)
59
60
61def is_mounted(name):

Callers

nothing calls this directly

Calls 6

get_deviceMethod · 0.80
is_redundantMethod · 0.80
executeFunction · 0.70
is_publicMethod · 0.45
get_typeMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected