def test_assign_labeled_network( system_service, networks_service, hosts_service, ost_dc_name, ost_cluster_name, ): """ Adds the labeled network to the cluster and asserts the hosts are attached """ labeled_net = networks_service.list(search=f'name={LABELED_NET_NAME}')[0] # the logical network will be automatically assigned to all host network # interfaces with that label asynchronously cluster_service = test_utils.get_cluster_service(system_service, ost_cluster_name) assert cluster_service.networks_service().add(labeled_net) for host in test_utils.hosts_in_cluster_v4(system_service, ost_cluster_name): host_service = hosts_service.host_service(id=host.id) assert assert_utils.true_within_short( lambda: _host_is_attached_to_network( system_service, host_service, LABELED_NET_NAME, ost_dc_name, ))
def set_network_usages_in_cluster(engine, network_name, cluster_name, usages): cluster_service = test_utils.get_cluster_service(engine, cluster_name) query = u'name={}'.format(test_utils.quote_search_string(network_name)) network = engine.networks_service().list(search=query)[0] network_service = cluster_service.networks_service().network_service(id=network.id) network.usages = usages return network_service.update(network)
def _add_network_to_cluster(api, datacenter_id, ovirt_network_id): cluster_service = test_utils.get_cluster_service(api.system_service(), CLUSTER_NAME) assert cluster_service.networks_service().add( network=types.Network(id=ovirt_network_id, required=False), )
def set_postcopy_migration_policy(system_service): cluster_service = test_utils.get_cluster_service(system_service, CLUSTER_NAME) cluster_service.update( cluster=Cluster(migration=MigrationOptions(policy=MigrationPolicy(id=MIGRATION_POLICY_POSTCOPY))) )
def _get_cluster_network_service(engine, cluster_name): cluster_service = test_utils.get_cluster_service(engine, cluster_name) return cluster_service.networks_service()