コード例 #1
0
def test_security_groups_allow_icmp(system, ovs_cluster, host_in_ovs_cluster,
                                    host_0, host_1,
                                    default_ovn_provider_client,
                                    ovn_physnet_small_mtu,
                                    vm_in_ovn_network_up,
                                    vnic_attached_to_ovn_network):
    other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])
    syncutil.sync(exec_func=_ping_successful,
                  exec_func_args=(other_host.address, other_host.root_password,
                                  VM0_NAME, MAX_ICMP_DATA_SIZE),
                  success_criteria=lambda success: success)

    with _enable_port_security(vnic_attached_to_ovn_network,
                               default_ovn_provider_client):
        with pytest.raises(PingFailed, match=r'status code 1'):
            ssh_ping(other_host.address,
                     other_host.root_password,
                     VM0_NAME,
                     data_size=MAX_ICMP_DATA_SIZE)

        with _allow_icmp_from_host(other_host):
            syncutil.sync(exec_func=_ping_successful,
                          exec_func_args=(other_host.address,
                                          other_host.root_password, VM0_NAME,
                                          MAX_ICMP_DATA_SIZE),
                          success_criteria=lambda success: success)
コード例 #2
0
def test_security_groups_allow_icmp(
    system,
    ovs_cluster,
    host_not_in_ovs_cluster,
    ssh_host_not_in_ovs_cluster,
    default_ovn_provider_client,
    ovn_physnet_small_mtu,
    vm_in_ovn_network_up,
    vnic_attached_to_ovn_network,
    target,
    af,
    ansible_private_dir,
):
    syncutil.sync(
        exec_func=ssh_host_not_in_ovs_cluster.ping_successful,
        exec_func_args=(target, af.version, _max_icmp_data_size(af.family)),
        success_criteria=lambda success: success,
    )

    with _enable_port_security(vnic_attached_to_ovn_network, default_ovn_provider_client):
        time.sleep(10)
        ssh_host_not_in_ovs_cluster.assert_no_ping(target, af.version, _max_icmp_data_size(af.family))

        with _allow_icmp_from_host(host_not_in_ovs_cluster, af.version, ansible_private_dir):
            syncutil.sync(
                exec_func=ssh_host_not_in_ovs_cluster.ping_successful,
                exec_func_args=(target, af.version, _max_icmp_data_size(af.family)),
                success_criteria=lambda success: success,
            )
コード例 #3
0
def _wait_for_running_vm(serial_vmconsole, vm_id):
    syncutil.sync(
        exec_func=serial_vmconsole.can_log_in,
        exec_func_args=(vm_id, ),
        success_criteria=lambda logged_in: logged_in,
        retry_interval=20,
    )
コード例 #4
0
def test_bond_active_slave(system, default_data_center, default_cluster,
                           host_0_up):
    bond_data = netattachlib.ActiveSlaveBonding(
        BOND_NAME, slave_names=(SLAVE1, SLAVE2)
    )
    with hostlib.setup_networks(host_0_up, bonding_data=(bond_data,)):
        bond = hostlib.Bond(host_0_up)
        bond.import_by_name(BOND_NAME)
        bond.wait_for_up_status()
        initial_active_slave = bond.active_slave
        inactive_slave = bond.inactive_slaves[0]
        sshlib.Node(
            host_0_up.address, host_0_up.root_password
        ).change_active_slave(BOND_NAME, inactive_slave.name)
        try:
            syncutil.sync(
                exec_func=lambda: bond.active_slave,
                exec_func_args=(),
                success_criteria=lambda active_slave:
                    active_slave.id != initial_active_slave.id,
                timeout=10
            )
        except syncutil.Timeout:
            raise ActiveSlaveNotChangedError(
                'active slave: {} initial active slave: {}'.format(
                    bond.active_slave.name, initial_active_slave.name
                )
            )
コード例 #5
0
def test_security_groups_allow_icmp(system, ovs_cluster, host_in_ovs_cluster,
                                    host_0, host_1,
                                    default_ovn_provider_client,
                                    ovn_physnet_small_mtu,
                                    vm_in_ovn_network_up,
                                    vnic_attached_to_ovn_network):
    other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])
    syncutil.sync(exec_func=_ping_successful,
                  exec_func_args=(
                      other_host.address,
                      other_host.root_password,
                      VM0_NAME,
                      MAX_ICMP_DATA_SIZE
                  ),
                  success_criteria=lambda success: success)

    with _enable_port_security(vnic_attached_to_ovn_network,
                               default_ovn_provider_client):
        with pytest.raises(PingFailed, match=r'status code 1'):
            ssh_ping(other_host.address,
                     other_host.root_password,
                     VM0_NAME,
                     data_size=MAX_ICMP_DATA_SIZE)

        with _allow_icmp_from_host(other_host):
            syncutil.sync(exec_func=_ping_successful,
                          exec_func_args=(
                              other_host.address,
                              other_host.root_password,
                              VM0_NAME,
                              MAX_ICMP_DATA_SIZE
                          ),
                          success_criteria=lambda success: success)
コード例 #6
0
ファイル: hostlib.py プロジェクト: minqf/ovirt-system-tests
 def deactivate(self):
     self.wait_for_up_status()
     syncutil.sync(exec_func=self._service.deactivate,
                   exec_func_args=(),
                   timeout=3 * 60,
                   error_criteria=Host._is_error_non_transient)
     self.wait_for_maintenance_status()
コード例 #7
0
ファイル: joblib.py プロジェクト: didib/ovirt-system-tests
 def wait_for_done(self):
     self._report_started()
     self._report_ill_fated()
     syncutil.sync(exec_func=lambda: self.done,
                   exec_func_args=(),
                   success_criteria=lambda done: done)
     self._report_started()
     self._report_ill_fated()
コード例 #8
0
def test_max_mtu_size(
    system, ovs_cluster, ssh_host_not_in_ovs_cluster, ovn_physnet_small_mtu, vm_in_ovn_network_up, target, af
):
    syncutil.sync(
        exec_func=ssh_host_not_in_ovs_cluster.ping_successful,
        exec_func_args=(target, af.version, _max_icmp_data_size(af.family)),
        success_criteria=lambda success: success,
    )
コード例 #9
0
 def wait_until_available(self):
     syncutil.sync(
         exec_func=lambda: self.is_provider_available(
             self.get_sdk_type().name
         ),
         exec_func_args=(),
         success_criteria=lambda s: s
     )
コード例 #10
0
ファイル: hostlib.py プロジェクト: oVirt/ovirt-system-tests
 def deactivate(self):
     self.wait_for_up_status()
     syncutil.sync(
         exec_func=self._service.deactivate,
         exec_func_args=(),
         timeout=3 * 60,
         error_criteria=Host._is_error_non_transient
     )
     self.wait_for_maintenance_status()
コード例 #11
0
def test_connect_vm_to_external_physnet(system, ovs_cluster,
                                        host_in_ovs_cluster, host_0, host_1,
                                        vm_in_ovn_network_up):
    other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])

    syncutil.sync(exec_func=_ping_successful,
                  exec_func_args=(other_host.address, other_host.root_password,
                                  VM0_NAME, MAX_ICMP_DATA_SIZE),
                  success_criteria=lambda success: success)
コード例 #12
0
ファイル: engine.py プロジェクト: didib/ovirt-system-tests
def ovirt_engine_service_up(ovirt_engine_setup, engine_facts,
                            engine_full_username, engine_password):
    syncutil.sync(exec_func=_create_engine_connection,
                  exec_func_args=(engine_facts.ipv4_default_address,
                                  engine_full_username,
                                  engine_password),
                  success_criteria=lambda api: isinstance(api, Connection),
                  timeout=10*60)
    yield
コード例 #13
0
ファイル: hostlib.py プロジェクト: didib/ovirt-system-tests
 def activate(self):
     syncutil.sync(exec_func=self._service.activate,
                   exec_func_args=(),
                   success_criteria=lambda s: self.is_up,
                   error_criteria=lambda e: error.is_not_ovirt_or_unlisted(
                       e, [
                           'Related operation is currently in progress',
                           'Cannot activate Host. Host in Up status',
                       ]),
                   timeout=3 * 60)
     joblib.AllJobs(self.system).wait_for_done()
コード例 #14
0
ファイル: hostlib.py プロジェクト: didib/ovirt-system-tests
 def force_select_spm(self):
     syncutil.sync(
         exec_func=self.service.force_select_spm,
         exec_func_args=(),
         success_criteria=lambda r: self.is_spm,
         error_criteria=lambda e: error.
         is_not_ovirt_or_unlisted(e, [
             'Cannot force select SPM. The Storage Pool has running tasks',
             'Cannot force select SPM. Unknown Data Center status',
             'is already SPM or contending',
         ]))
コード例 #15
0
ファイル: hostlib.py プロジェクト: didib/ovirt-system-tests
 def deactivate(self):
     syncutil.sync(exec_func=self._service.deactivate,
                   exec_func_args=(),
                   timeout=3 * 60,
                   success_criteria=lambda s: self.is_in_maintenance,
                   error_criteria=lambda e: error.is_not_ovirt_or_unlisted(
                       e, [
                           'Host has asynchronous running tasks',
                           'Host is contending',
                           'Host is already in Maintenance mode',
                       ]))
     joblib.AllJobs(self.system).wait_for_done()
コード例 #16
0
def test_connect_vm_to_external_physnet(system, ovs_cluster,
                                        host_in_ovs_cluster, host_0, host_1,
                                        vm_in_ovn_network_up):
        other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])

        syncutil.sync(exec_func=_ping_successful,
                      exec_func_args=(
                          other_host.address,
                          other_host.root_password,
                          VM0_NAME,
                          MAX_ICMP_DATA_SIZE
                      ),
                      success_criteria=lambda success: success)
コード例 #17
0
def test_max_mtu_size(system, ovs_cluster, host_in_ovs_cluster, host_0, host_1,
                      ovn_physnet_small_mtu, vm_in_ovn_network_up):
    other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])

    syncutil.sync(exec_func=_ping_successful,
                  exec_func_args=(other_host.address, other_host.root_password,
                                  VM0_NAME, MAX_ICMP_DATA_SIZE),
                  success_criteria=lambda success: success)

    with pytest.raises(PingFailed, match=r'status code 1'):
        ssh_ping(other_host.address,
                 other_host.root_password,
                 VM0_NAME,
                 data_size=MAX_ICMP_DATA_SIZE + 1)
コード例 #18
0
ファイル: hostlib.py プロジェクト: didib/ovirt-system-tests
 def change_cluster(self, cluster):
     spm_before_deactivate = self.is_spm
     self.deactivate()
     syncutil.sync(exec_func=self.update,
                   exec_func_args={'cluster': cluster.get_sdk_type()},
                   success_criteria=lambda sdk_type:
                   (hasattr(sdk_type, 'cluster') and sdk_type.cluster.id ==
                    cluster.id))
     self.activate()
     if spm_before_deactivate:
         # Deactivation removed SPM status from this host and caused the DC
         # to become Non Responsive. This is an unstable state.
         # Wait for stabilization indicated by DC state UP when either:
         # - another host becomes SPM after deactivating this host
         # - this host becomes SPM after its reactivation
         self._get_data_center().wait_for_up_status()
コード例 #19
0
ファイル: hostlib.py プロジェクト: didib/ovirt-system-tests
 def update(self, **kwargs):
     return syncutil.sync(
         exec_func=super(Host, self).update,
         exec_func_args=kwargs,
         error_criteria=lambda e: error.
         is_not_ovirt_or_unlisted(e, [
             'Cannot edit Host. Related operation is currently in progress'
         ]))
コード例 #20
0
ファイル: engine.py プロジェクト: oVirt/ovirt-system-tests
def engine(fqdn, env, artifacts_path):
    with suite.collect_artifacts(env, artifacts_path, 'pre-tests'):
        engine = env.get_vms()[ENGINE_DOMAIN]

        ANSWER_FILE_TMP = '/tmp/answer-file'

        engine.copy_to(ANSWER_FILE_SRC, ANSWER_FILE_TMP)
        engine.ssh(
            [
                'engine-setup',
                '--config-append={}'.format(ANSWER_FILE_TMP),
                '--accept-defaults',
            ]
        )
        syncutil.sync(exec_func=_get_engine_api,
                      exec_func_args=(engine,),
                      success_criteria=lambda api: isinstance(api, Connection))
        return engine
コード例 #21
0
def test_max_mtu_size(system, ovs_cluster, host_in_ovs_cluster, host_0, host_1,
                      ovn_physnet_small_mtu, vm_in_ovn_network_up):
    other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])

    syncutil.sync(exec_func=_ping_successful,
                  exec_func_args=(
                      other_host.address,
                      other_host.root_password,
                      VM0_NAME,
                      MAX_ICMP_DATA_SIZE
                  ),
                  success_criteria=lambda success: success)

    with pytest.raises(PingFailed, match=r'status code 1'):
        ssh_ping(other_host.address,
                 other_host.root_password,
                 VM0_NAME,
                 data_size=MAX_ICMP_DATA_SIZE + 1)
コード例 #22
0
def engine(fqdn, env, artifacts_path):
    with suite.collect_artifacts(env, artifacts_path, 'pre-tests'):
        engine = env.get_vms()[ENGINE_DOMAIN]

        ANSWER_FILE_TMP = '/tmp/answer-file'

        engine.copy_to(ANSWER_FILE_SRC, ANSWER_FILE_TMP)
        engine.ssh(
            [
                'engine-setup',
                '--config-append={}'.format(ANSWER_FILE_TMP),
                '--accept-defaults',
            ]
        )

        syncutil.sync(exec_func=_get_engine_api,
                      exec_func_args=(engine,),
                      success_criteria=lambda api: isinstance(api, Connection),
                      timeout=10*60)
        yield engine
コード例 #23
0
def test_hotplug_multiple_vnics(running_cirros_vm):
    for i in range(10):
        for name in NIC_NAMES.values():
            vnic = running_cirros_vm.get_vnic(name)
            plugged = vnic.plugged
            LOGGER.debug(
                f'test hot {"unplug" if plugged else "plug"} multiple rounds: vnic {vnic.name}, round {i}'
            )
            if plugged:
                vnic.hotunplug()
            else:
                vnic.hotplug()
            syncutil.sync(
                exec_func=lambda: vnic.plugged,
                exec_func_args=(),
                success_criteria=lambda p: p is not plugged,
                delay_start=1,
                retry_interval=1,
                timeout=10,
            )
コード例 #24
0
 def lookup_ip_address_with_dns_query(self, hostname):
     """
     Wait for the ip address to update in the dns lookup
     :param hostname: str
     :return: ipv4 address as a string
     """
     return syncutil.sync(
         exec_func=self._lookup_ip_address_with_dns_query,
         exec_func_args=(hostname,),
         success_criteria=lambda ip: ip != '',
         timeout=TIMEOUT
     )
コード例 #25
0
ファイル: fqdn.py プロジェクト: emesika/ovirt-system-tests
def _enable_dynamic_ipv6(lago_host, nic_name):
    """
    this function connects to the specified lago VM using its ssh API to:
    * request the host OS to dynamically assign an ipv6 address to the
      specified NIC
    * wait for the address to be assigned (it might take up to a few seconds)
    * retrieve the address
    :return: the ipv6 address as string
    :raise: timeout exception if global ipv6 address not found on NIC
    """
    _assign_ipv6(lago_host, nic_name)
    return syncutil.sync(exec_func=_get_ipv6,
                         exec_func_args=(lago_host, nic_name),
                         success_criteria=lambda ipv6: ipv6 != '',
                         timeout=10)
コード例 #26
0
ファイル: fqdn.py プロジェクト: oVirt/ovirt-system-tests
def engine_storage_ipv6(engine):
    """
    lago creates a storage network with an ipv6 subnet and connects it to NIC
    eth1 of its VMs but does not assign an ip (v6) to the NIC.
    this function connects to the engine VM using its ssh API to:
    * assign an ipv6 address to the NIC
    * wait for the address to be assigned (it might take up to a few seconds)
    * retrieve the address
    :return: the ipv6 address as string
    :raise: timeout exception if global ipv6 address not found on NIC
    """
    STORAGE_NET_NIC_NAME = 'eth1'
    _assign_ipv6(engine, STORAGE_NET_NIC_NAME)
    return syncutil.sync(exec_func=_get_ipv6,
                         exec_func_args=(engine, STORAGE_NET_NIC_NAME),
                         success_criteria=lambda ipv6: ipv6 != '',
                         timeout=10)
コード例 #27
0
ファイル: virtlib.py プロジェクト: oVirt/ovirt-system-tests
 def _sync_disk_attachment(self, disk_attachment_id):
     syncutil.sync(
         exec_func=self._is_disk_attachment_active,
         exec_func_args=(disk_attachment_id,),
         success_criteria=lambda s: s
     )
コード例 #28
0
ファイル: hostlib.py プロジェクト: oVirt/ovirt-system-tests
 def wait_for_non_operational_status(self):
     NONOP = HostStatus.NON_OPERATIONAL
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == NONOP)
コード例 #29
0
ファイル: hostlib.py プロジェクト: oVirt/ovirt-system-tests
 def wait_for_up_status(self, timeout=HOST_TIMEOUT_SHORT):
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=self._host_up_status_success_criteria,
                   timeout=timeout)
コード例 #30
0
 def wait_for_up_status(self):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == types.DiskStatus.OK)
コード例 #31
0
ファイル: hostlib.py プロジェクト: oVirt/ovirt-system-tests
 def wait_for_maintenance_status(self):
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == HostStatus.MAINTENANCE)
コード例 #32
0
ファイル: virtlib.py プロジェクト: oVirt/ovirt-system-tests
 def wait_for_preview_status(self):
     syncutil.sync(
         exec_func=lambda: self.get_sdk_type().snapshot_status,
         exec_func_args=(),
         success_criteria=lambda status: status == SnapshotStatus.IN_PREVIEW
     )
コード例 #33
0
 def _wait_for_status(self, status):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == status)
コード例 #34
0
 def _sync_disk_attachment(self, disk_attachment_id):
     syncutil.sync(exec_func=self._is_disk_attachment_active,
                   exec_func_args=(disk_attachment_id, ),
                   success_criteria=lambda s: s)
コード例 #35
0
 def wait_for_preview_status(self):
     syncutil.sync(exec_func=lambda: self.get_sdk_type().snapshot_status,
                   exec_func_args=(),
                   success_criteria=lambda status: status == SnapshotStatus.
                   IN_PREVIEW)
コード例 #36
0
 def wait_until_empty(self):
     self._report_is_empty('before')
     syncutil.sync(exec_func=self.is_empty,
                   exec_func_args=(),
                   success_criteria=lambda empty: empty)
     self._report_is_empty('after')
コード例 #37
0
def wait_for_template_ok_status(system, template_name):
    syncutil.sync(exec_func=_get_template,
                  exec_func_args=(system.templates_service, template_name),
                  success_criteria=_check_template)
コード例 #38
0
 def wait_until_available(self):
     syncutil.sync(exec_func=lambda: self.is_provider_available(
         self.get_sdk_type().name),
                   exec_func_args=(),
                   success_criteria=lambda s: s)
コード例 #39
0
 def _wait_for_status(self, status):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == status,
                   timeout=60 * 5)
コード例 #40
0
 def _wait_for_sd_status(self, sd, status):
     sd_service = self._sd_service(sd)
     syncutil.sync(exec_func=lambda: sd_service.get().status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == status)
コード例 #41
0
 def deactivate_storage_domain_sync(self, sd):
     syncutil.sync(
         exec_func=self.deactivate_storage_domain,
         exec_func_args=(sd, ),
         error_criteria=error.sd_deactivation_error_not_due_to_busy)
コード例 #42
0
ファイル: virtlib.py プロジェクト: oVirt/ovirt-system-tests
 def wait_for_ready_status(self):
     syncutil.sync(
         exec_func=lambda: self.get_sdk_type().snapshot_status,
         exec_func_args=(),
         success_criteria=lambda status: status == SnapshotStatus.READY
     )
コード例 #43
0
 def _wait_for_status(self, statuses):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s in statuses)
コード例 #44
0
ファイル: hostlib.py プロジェクト: oVirt/ovirt-system-tests
 def wait_for_networks_out_of_sync(self, networks=None):
     syncutil.sync(exec_func=self.networks_out_of_sync,
                   exec_func_args=(networks,),
                   success_criteria=lambda s: s)
コード例 #45
0
 def wait_for_ready_status(self):
     syncutil.sync(
         exec_func=lambda: self.get_sdk_type().snapshot_status,
         exec_func_args=(),
         success_criteria=lambda status: status == SnapshotStatus.READY)
コード例 #46
0
 def destroy_sync(self):
     syncutil.sync(
         exec_func=self.destroy,
         exec_func_args=(),
         error_criteria=error.sd_destroy_error_not_due_to_busy)
コード例 #47
0
 def wait_for_snapshot_removal(self, snapshot_id):
     syncutil.sync(exec_func=self._is_snapshot_present,
                   exec_func_args=(),
                   success_criteria=lambda present: not present)
コード例 #48
0
ファイル: virtlib.py プロジェクト: oVirt/ovirt-system-tests
 def wait_for_snapshot_removal(self, snapshot_id):
     syncutil.sync(
         exec_func=self._is_snapshot_present,
         exec_func_args=(),
         success_criteria=lambda present: not present
     )