コード例 #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_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)
コード例 #3
0
 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()
コード例 #4
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
     )
コード例 #5
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)
コード例 #6
0
ファイル: hostlib.py プロジェクト: xutian/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
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)
コード例 #8
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)
コード例 #9
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))
        return engine
コード例 #10
0
ファイル: engine.py プロジェクト: xutian/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
コード例 #11
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)
コード例 #12
0
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)
コード例 #13
0
ファイル: fqdn.py プロジェクト: xutian/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)
コード例 #14
0
 def deactivate(self):
     syncutil.sync(exec_func=self._deactivate,
                   exec_func_args=(),
                   success_criteria=lambda s: s)
コード例 #15
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)
コード例 #16
0
ファイル: hostlib.py プロジェクト: xutian/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)
コード例 #17
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)
コード例 #18
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)
コード例 #19
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)
コード例 #20
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)
コード例 #21
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)
コード例 #22
0
 def wait_for_networks_in_sync(self, networks=None):
     syncutil.sync(exec_func=self.networks_in_sync,
                   exec_func_args=(networks, ),
                   success_criteria=lambda s: s)
コード例 #23
0
 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)
コード例 #24
0
 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)
コード例 #25
0
 def destroy_sync(self):
     syncutil.sync(
         exec_func=self.destroy,
         exec_func_args=(),
         error_criteria=error.sd_destroy_error_not_due_to_busy)
コード例 #26
0
 def wait_for_up_status(self, timeout=5 * 60):
     yield
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=self._host_up_status_success_criteria,
                   timeout=timeout)
コード例 #27
0
 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)
コード例 #28
0
ファイル: hostlib.py プロジェクト: xutian/ovirt-system-tests
 def wait_for_networks_in_sync(self, networks=None):
     syncutil.sync(exec_func=self.networks_in_sync,
                   exec_func_args=(networks,),
                   success_criteria=lambda s: s)
コード例 #29
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)
コード例 #30
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)
コード例 #31
0
ファイル: hostlib.py プロジェクト: xutian/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)
コード例 #32
0
 def _wait_for_status(self, status):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == status)
コード例 #33
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
    )
コード例 #34
0
ファイル: hostlib.py プロジェクト: xutian/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)
コード例 #35
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)
コード例 #36
0
ファイル: virtlib.py プロジェクト: xutian/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
     )
コード例 #37
0
ファイル: virtlib.py プロジェクト: xutian/ovirt-system-tests
 def _wait_for_status(self, statuses):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s in statuses)
コード例 #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 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)
コード例 #40
0
ファイル: virtlib.py プロジェクト: xutian/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
     )
コード例 #41
0
 def destroy_sync(self):
     syncutil.sync(exec_func=self.destroy,
                   exec_func_args=(),
                   error_criteria=error.sd_destroy_error_not_due_to_busy)
コード例 #42
0
ファイル: virtlib.py プロジェクト: xutian/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_up_status(self):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == types.DiskStatus.OK)
コード例 #44
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
     )