Ejemplo n.º 1
0
def isolate(nodes, env):
    nodes.sort(key=lambda node: node.id, reverse=True)
    hub = nodes[0]
    deployment_info = env_util.get_node_default_facts(env, nodes=[hub.data["id"]])
    network.create_bridges(hub, env, deployment_info)
    for node in nodes[1:]:
        deployment_info = env_util.get_node_default_facts(env, nodes=[node.data["id"]])
        network.setup_isolation(hub, node, env, deployment_info)
    for node in nodes:
        network.flush_arp(node)
Ejemplo n.º 2
0
    def predeploy(self):
        default_info = env_util.get_node_default_facts(self.env)
        deployment_info = []
        network_data = self.env.get_network_data()
        gw_admin = transformations.get_network_gw(network_data,
                                                  "fuelweb_admin")
        if self.isolated:
            facts = [info for info
                     in default_info if info['uid'] == str(self.node.id)]
            env_util.write_facts_to_dir(facts, self.node.data['cluster'])

        for info in default_info:
            if not ('primary-controller' in info['roles'] or
                    info['uid'] == str(self.node.id)):
                continue
            if self.isolated:
                transformations.remove_ports(info)
                if info['uid'] == str(self.node.id):
                    endpoints = info["network_scheme"]["endpoints"]
                    self.gateway = endpoints["br-ex"]["gateway"]
                transformations.reset_gw_admin(info, gw_admin)
            # From run_ping_checker
            info['run_ping_checker'] = False
            env_util.prepare_net_info(info)
            deployment_info.append(info)
        if deployment_info:
            self.env.upload_facts('deployment', deployment_info)
Ejemplo n.º 3
0
def test_util_env(mocker, api, modified, nodes):
    env = mock.Mock()
    env.get_default_facts.return_value = api
    assert modified == env_util.get_node_default_facts(env, nodes)
    env.get_default_facts.assert_called_once_with('deployment', nodes=nodes)