WwangxiyuanUpdate doc
b85bfd3f创建于 2022年8月15日历史提交
- name: Initialize test resource
  hosts: controller
  become: true
  tasks:
    - name: Install required package
      yum:
        name:
          - wget

    - name: Create test flavor
      shell: |
        source ~/.admin-openrc
        openstack flavor create --disk 1 --vcpus 2 --ram 1024 --id 1 --public my-flavor
        openstack flavor create --disk 1 --vcpus 2 --ram 1024 --id 2 --public my-flavor-alt

    - name: Download test image
      shell: |
        source ~/.admin-openrc
        if [[ `uname -m` == 'aarch64' ]];then
          wget http://download.cirros-cloud.net/0.5.2/cirros-0.5.2-aarch64-disk.img -O cirros-0.5.2.img
        else
          wget http://download.cirros-cloud.net/0.5.2/cirros-0.5.2-x86_64-disk.img -O cirros-0.5.2.img
        fi

    - name: Create test image
      shell: |
        source ~/.admin-openrc
        openstack image create --disk-format qcow2 --container-format bare --file ./cirros-0.5.2.img --public my-image -c id -f value
      register: image_id

    - name: Create test image alt
      shell: |
        source ~/.admin-openrc
        openstack image create --disk-format qcow2 --container-format bare --file ./cirros-0.5.2.img --public my-image-alt  -c id -f value
      register: image_id_alt

    - name: Create test public network
      shell: |
        source ~/.admin-openrc
        openstack network create --external --share public-network --provider-network-type flat --provider-physical-network provider --default -c id -f value
      register: public_network_id

    - name: Create test role
      shell: |
        source ~/.admin-openrc
        openstack role create ResellerAdmin

    - name: Load glance metadata
      shell: glance-manage db_load_metadefs

    - name: Create other network resource
      shell: |
        source ~/.admin-openrc
        # Create default shared subnet pool for tempest test
        openstack subnet pool create --pool-prefix 192.168.253.0/24 --default --share --default-prefix-length 26 default_subnet_pool
        # Init the ext subnet
        openstack subnet create --subnet-range {{ default_ext_subnet_range }} --gateway {{ default_ext_subnet_gateway }} --network public-network public-subnet
        # Init the private network
        openstack network create --internal --share private-network
        openstack subnet create --subnet-range 172.188.0.0/16 --network private-network private-subnet
        # Connect the simulative ext network with private network via a router 
        openstack router create my-router
        openstack router set my-router --external-gateway {{ public_network_id.stdout }}
        openstack router add subnet my-router private-subnet
        # Update security group rule
        openstack security group rule create default --ingress --protocol icmp
        openstack security group rule create default --ingress --protocol tcp --dst-port 22

    - name: Genereate tempest folder
      shell: |
        tempest init mytest

        cat << EOF > /root/mytest/etc/tempest-cirros.conf
        [DEFAULT]
        log_dir = /root/mytest/logs
        log_file = tempest.log

        [auth]
        admin_username = admin
        admin_password = root
        admin_project_name = admin
        admin_domain_name = Default

        [identity]
        auth_version = v3
        uri_v3 = http://{{ hostvars['controller']['ansible_default_ipv4']['address'] }}:5000/v3

        [identity-feature-enabled]
        security_compliance = true
        project_tags = true
        application_credentials = true

        [compute]
        flavor_ref = 1
        flavor_ref_alt = 2
        image_ref = {{ image_id.stdout }}
        image_ref_alt = {{ image_id_alt.stdout }}
        min_microversion = 2.1
        max_microversion = 2.79
        min_compute_nodes = 2
        fixed_network_name = private-network
        build_timeout = 120

        [scenario]
        img_file = /root/cirros-0.5.2.img
        img_container_format = bare
        img_disk_format = qcow2

        [compute-feature-enabled]
        change_password = false
        swap_volume = true
        volume_multiattach = true
        resize = true
        #volume_backed_live_migration = true
        #block_migration_for_live_migration = true
        #block_migrate_cinder_iscsi = true
        #scheduler_enabled_filters = DifferentHostFilter
        vnc_console = true
        live_migration = false

        [oslo_concurrency]
        lock_path = /root/mytest/tempest_lock

        [volume]
        min_microversion = 3.0
        max_microversion = 3.59
        backend_names = lvm
        build_timeout = 120

        [volume-feature-enabled]
        backup = false
        multi_backend = true
        manage_volume = true
        manage_snapshot = true
        extend_attached_volume = true

        [service_available]
        nova = true
        cinder = true
        neutron = true
        glance = true
        horizon = true
        heat = true
        placement = true
        swift = true
        keystone = true

        [placement]
        min_microversion = 1.0
        max_microversion = 1.36

        [network]
        public_network_id = {{ public_network_id.stdout }}
        project_network_cidr = 172.189.0.0/16
        floating_network_name = public-network
        build_timeout = 120

        [network-feature-enabled]
        port_security = true
        ipv6_subnet_attributes = true
        qos_placement_physnet = true

        [image]
        build_timeout = 120

        [image-feature-enabled]
        import_image = true

        [object-storage-feature-enabled]
        container_sync = false

        [validation]
        image_ssh_user = cirros
        image_ssh_password = gocubsgo
        image_alt_ssh_user = cirros
        image_alt_ssh_password = gocubsgo
        ping_timeout = 60
        ssh_timeout = 120

        [debug]
        trace_requests = .*
        EOF

    # Some tests fail on openEuler due to some error that unable to repair at
    # the moment. Skip them by hand.
    - name: Generate black list for cirros
      shell: |
        cat << EOF > /root/mytest/black_list_file
        ^tempest.api.object_storage.test_container_sync_middleware
        ^tempest.scenario.test_encrypted_cinder_volumes.TestEncryptedCinderVolumes
        ^tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_boot_server_from_encrypted_volume_luks
        ^tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_volume_boot_pattern
        ^tempest.scenario.test_stamp_pattern.TestStampPattern.test_stamp_pattern
        ^tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops
        ^tempest.api.compute.servers.test_device_tagging.TaggedBootDevicesTest.test_tagged_attachment
        ^tempest.api.compute.servers.test_device_tagging.TaggedBootDevicesTest.test_tagged_boot_devices
        ^tempest.api.compute.servers.test_device_tagging.TaggedBootDevicesTest_v242.test_tagged_boot_devices
        ^tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_change_server_password
        EOF

    - name: Generate tempest folder
      debug:
        msg: "The environment is ready for test, please login controller and run `tempest run` command in mytest folder.  Or run 'oos env test' command for tempest test."