def host_1_with_mig_net(migration_network, host_1_up): ip_config = netlib.create_static_ip_config_assignment( addr=MIG_NET_IPv4_ADDR_2, mask=MIG_NET_IPv4_MASK) mig_att_data = hostlib.NetworkAttachmentData(migration_network, ETH1, [ip_config]) host_1_up.setup_networks([mig_att_data]) yield host_1_up host_1_up.remove_networks((migration_network, ))
def display_network_attached_to_host_0(host_0_up, display_network): ETH1 = 'eth1' DISP_NET_IPv4_ADDR_1 = '192.0.3.1' DISP_NET_IPv4_MASK = '255.255.255.0' ip_config = netlib.create_static_ip_config_assignment( addr=DISP_NET_IPv4_ADDR_1, mask=DISP_NET_IPv4_MASK) disp_att_data = hostlib.NetworkAttachmentData( display_network, ETH1, [ip_config]) host_0_up.setup_networks([disp_att_data]) yield host_0_up host_0_up.remove_networks([display_network])
def display_network_attached_to_host_0(host_0_up, display_network): ETH1 = 'eth1' DISP_NET_IPv4_ADDR_1 = '192.0.3.1' DISP_NET_IPv4_MASK = '255.255.255.0' ip_config = netlib.create_static_ip_config_assignment( addr=DISP_NET_IPv4_ADDR_1, mask=DISP_NET_IPv4_MASK) disp_att_data = hostlib.NetworkAttachmentData(display_network, ETH1, [ip_config]) host_0_up.setup_networks([disp_att_data]) yield host_0_up host_0_up.remove_networks([display_network])
def cluster_hosts_net_setup(cluster_hosts_up, req_net, cluster_net): try: for i, host in enumerate(cluster_hosts_up): ip_config = netlib.create_static_ip_config_assignment( addr=REQ_NET_IPv4_ADDR_PREFIX + str(i + 2), mask=REQ_NET_IPv4_MASK) req_att_data = hostlib.NetworkAttachmentData( req_net, ETH1, [ip_config]) host.setup_networks([req_att_data]) except Exception as e: # if setup fails for some of the hosts roll it back before aborting remove_net_from_hosts(cluster_hosts_up, req_net) raise e yield cluster_hosts_up remove_net_from_hosts(cluster_hosts_up, req_net)
def create_attachment(network, i): ip_config = netlib.create_static_ip_config_assignment( addr='192.168.125.' + str(i + 2), mask='255.255.255.0' ) att_datum = hostlib.NetworkAttachmentData(network, ETH2, (ip_config,)) return att_datum
def _create_net_attachment_data(qos_net): ip_config = netlib.create_static_ip_config_assignment( addr=QOS_NET_IPv4_ADDR, mask=QOS_NET_IPv4_MASK) att_data = hostlib.NetworkAttachmentData(qos_net, ETH2, (ip_config, )) return att_data
def _create_net_attachment_data(qos_net): ip_config = netlib.create_static_ip_config_assignment( addr=QOS_NET_IPv4_ADDR, mask=QOS_NET_IPv4_MASK ) att_data = hostlib.NetworkAttachmentData(qos_net, ETH2, (ip_config,)) return att_data
def create_attachment(network, i): ip_config = netlib.create_static_ip_config_assignment(addr='192.168.125.' + str(i + 2), mask='255.255.255.0') att_datum = hostlib.NetworkAttachmentData(network, ETH2, (ip_config, )) return att_datum