def test_set_Node(): from PetaSAN.core.cluster.configuration import configuration from PetaSAN.backend.cluster.manage_node import ManageNode from PetaSAN.backend.cluster.deploy import Wizard from PetaSAN.core.cluster.network import Network net = Network() wizerd = Wizard() conf = configuration() node = NodeInfo() m_node = ManageNode() node.backend_1_ip = "192.168.130.100" node.backend_2_ip = "192.168.120.100" node.management_ip = net.get_node_management_ip() #clu= conf.get_cluster_info() #clu.management_nodes.append(node) #conf.set_cluster_network_info(clu) print wizerd.set_node_info(node)
def set_node_info(self, node_info): """ :type node_info: NodeInfo """ try: config = configuration() net = Network() node_info.name = config.get_node_name() node_info.management_ip = net.get_node_management_ip() config.set_node_info(node_info) config_api = ConfigAPI() if call_script(config_api.get_node_start_ips_script_path()) != 0: raise Exception("Error could not start backend network.") logger.info("Set node info completed successfully.") except Exception as ex: logger.exception(ex.message) return Status().error return Status().done
from PetaSAN.core.common.enums import BondMode import sys from PetaSAN.core.cluster.configuration import configuration from PetaSAN.core.cluster.network import Network from PetaSAN.core.common.cmd import * logger.debug("Loading network configurations.") network = Network() config = configuration() node = config.get_node_info() cluster = config.get_cluster_info() node_management_eth_name = network.get_node_management_interface() node_management_vlan_id = network.get_node_management_vlan_id() node_management_eth_ip = network.get_node_management_ip() node_management_eth_netmask = network.get_node_management_netmask() gateway = Network().get_def_gateway() bonds = config.get_cluster_bonds() jumbo_eths = [] if hasattr(configuration().get_cluster_info(), "jumbo_frames"): jumbo_eths = config.get_cluster_info().jumbo_frames def create_bond(bond): if call_cmd("echo +{} > /sys/class/net/bonding_masters".format(bond.name)): # logger.debug("echo +{} > /sys/class/net/bonding_masters".format(bond.name)) if call_cmd("echo {} > /sys/class/net/{}/bonding/mode".format(bond.mode, bond.name)): # logger.debug("echo {} > /sys/class/net/{}/bonding/mode".format(bond.mode, bond.name)) if call_cmd("echo 100 > /sys/class/net/{}/bonding/miimon".format(bond.name)):