Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEST: Use oVirt Tiny Core instead of cirros #162

Open
wants to merge 25 commits into
base: tinycore-test
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
092cad7
Add ignoring of TimeoutException also to _wait_until
ljelinkova May 24, 2022
f5815d6
he: add storage network for vms
hbraha Apr 13, 2022
67405b5
ost: downgrade nmstate
hbraha May 18, 2022
3ed0680
run vms on el9
hbraha May 1, 2022
c3430cf
Revert "ost: downgrade nmstate"
mrkev-gh May 25, 2022
28754b2
package_mgmt: Remove special jenkins repos handling
tinez May 26, 2022
6be4e53
Update Grafana check for error
ljelinkova May 13, 2022
50d36dd
Fix typo
tinez May 26, 2022
693440c
el9stream: Reboot all hosts
tinez May 26, 2022
01cf93d
update el[89]stream jobs with COPR updates
michalskrivanek May 26, 2022
6fc59c3
jenkins: simplify COPR repo
michalskrivanek May 27, 2022
0694d79
basic: remove async_ argument when calling ExternalVmImportService
nyoxi Apr 12, 2022
9dbb59b
jenkins: fix typo
michalskrivanek May 27, 2022
ccc82fe
add convert disk test (#121)
bennyz May 27, 2022
1dcbe6a
ost_utils: vmconsole - use ip_interface for better readability
erav May 18, 2022
5e2707a
ost_utils: vmconsole - enhance debug logging
erav May 25, 2022
37ff8fa
ost_utils: vmconsole - use default byte stream
erav May 4, 2022
8fae21b
ost_utils: vmconsole - allow several login tries
erav May 24, 2022
d823489
ost_utils: vmconsole - prolong waiting times
erav May 18, 2022
b7a527a
Remove unnecessary empty line
avlitman May 29, 2022
8c5a744
readme: username is admin@ovirt if keycloak is enabled
avlitman May 29, 2022
6ce0c14
engine deploy: downgrade ovn - temp workaround
erav May 31, 2022
0f4d169
setup_engine: Ignore errors on downgrade (#172)
tinez Jun 1, 2022
c248eaa
ost_utils: vmconsole - ignore decode errors
erav Jun 1, 2022
2159bc9
TEST: Use oVirt Tiny Core instead of cirros
tinez May 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ OST_APP_TOKEN=$(jq -r .token token)

[[ -z "$SHA" ]] && SHA=$(curl -sS ${PR_URL} | jq -r .head.sha)
API_URL_BASE=$(echo ${PR_URL} | cut -d / -f 1-6)
[[ "$DISTRO" = "el8stream" ]] && OST_IMAGE="el8stream+https://download.copr.fedorainfracloud.org/results/ovirt/ovirt-master-snapshot/centos-stream-8-x86_64"
[[ "$DISTRO" = "el9stream" ]] && OST_IMAGE="el9stream+https://download.copr.fedorainfracloud.org/results/ovirt/ovirt-master-snapshot/centos-stream-9-x86_64"
[[ "$DISTRO" =~ el[89]stream ]] && OST_IMAGE="${DISTRO}+https://download.copr.fedorainfracloud.org/results/ovirt/ovirt-master-snapshot/centos-stream-\$releasever-x86_64"
[[ "$DISTRO" = "rhel8" ]] && OST_IMAGE=${RHEL_OST_IMAGE}
ost_app_response() { # ost_app_response status conclusion summary
echo "response $1 $2 $3"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Once you've located the engine VM's IP, add it to `/etc/hosts`. You have to use
Now, log in to the web-UI at:

* URL: `https://engine/ovirt-engine/webadmin/`
* Username: `admin`
* Username: `admin` or `admin@ovirt` if keycloak is enabled
* Password: `123456`
* Profile: `internal`

Expand Down
1 change: 1 addition & 0 deletions basic-suite-master/test-scenarios/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ost_utils.pytest.fixtures.ansible import ansible_collect_logs
from ost_utils.pytest.fixtures.ansible import ansible_engine
from ost_utils.pytest.fixtures.ansible import ansible_engine_facts
from ost_utils.pytest.fixtures.ansible import ansible_host0_facts
from ost_utils.pytest.fixtures.ansible import ansible_host0
from ost_utils.pytest.fixtures.ansible import ansible_host1
from ost_utils.pytest.fixtures.ansible import ansible_hosts
Expand Down
34 changes: 23 additions & 11 deletions basic-suite-master/test-scenarios/test_002_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,20 +1211,24 @@ def test_add_blank_vms(engine_api, ost_cluster_name):
high_availability=sdk4.types.HighAvailability(
enabled=False,
),
bios=sdk4.types.Bios(
sdk4.types.BootMenu(False),
sdk4.types.BiosType.Q35_SEA_BIOS,
),
cluster=sdk4.types.Cluster(
name=ost_cluster_name,
),
template=sdk4.types.Template(
name=TEMPLATE_BLANK,
),
display=sdk4.types.Display(
smartcard_enabled=True,
keyboard_layout='en-us',
file_transfer_enabled=True,
copy_paste_enabled=True,
type=sdk4.types.DisplayType.VNC,
),
usb=sdk4.types.Usb(
enabled=True,
enabled=False,
type=sdk4.types.UsbType.NATIVE,
),
memory_policy=sdk4.types.MemoryPolicy(
Expand Down Expand Up @@ -1271,6 +1275,10 @@ def test_add_blank_high_perf_vm2(engine_api, ost_dc_name, ost_cluster_name):
name=TEMPLATE_BLANK,
),
custom_emulated_machine='pc-q35-rhel8.0.0',
bios=sdk4.types.Bios(
sdk4.types.BootMenu(False),
sdk4.types.BiosType.Q35_SEA_BIOS,
),
cpu=sdk4.types.Cpu(
topology=sdk4.types.CpuTopology(
cores=1,
Expand Down Expand Up @@ -1444,23 +1452,27 @@ def test_add_nic(engine_api):


@order_by(_TEST_LIST)
def test_add_graphics_console(engine_api):
def test_add_graphics_console(engine_api, ansible_host0_facts):
if ansible_host0_facts.get('ansible_distribution_major_version') == "9":
# trying to delete and re add VNC will add it back with QXL which doesnt supported on el9
# BZ 1976607
pytest.skip('skip test on el9')
# remove VNC
engine = engine_api.system_service()
vm = test_utils.get_vm_service(engine, VM0_NAME)
consoles_service = vm.graphics_consoles_service()
if len(consoles_service.list()) == 2:
consoles = consoles_service.list()
console = next((c for c in consoles if c.protocol == types.GraphicsType.VNC), None)
if console is not None:
console = consoles_service.console_service('766e63')
console.remove()
assert assert_utils.equals_within_short(lambda: len(consoles_service.list()), 1)

# and add it back
consoles_service.add(
sdk4.types.GraphicsConsole(
protocol=sdk4.types.GraphicsType.VNC,
assert assert_utils.equals_within_short(
lambda: types.GraphicsType.VNC in [t.protocol for t in consoles_service.list()], False
)
consoles_service.add(console=types.GraphicsConsole(protocol=types.GraphicsType.VNC))
assert assert_utils.equals_within_short(
lambda: types.GraphicsType.VNC in [t.protocol for t in consoles_service.list()], True
)
assert assert_utils.equals_within_short(lambda: len(consoles_service.list()), 2)


@order_by(_TEST_LIST)
Expand Down
42 changes: 37 additions & 5 deletions basic-suite-master/test-scenarios/test_004_basic_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
SD_SECOND_NFS_NAME = 'second-nfs'
SD_ISCSI_NAME = 'iscsi'

VM_USER_NAME = 'cirros'
VM_PASSWORD = 'gocubsgo'
VM_USER_NAME = 'tc'
VM_PASSWORD = ''

VM0_NAME = 'vm0'
VM1_NAME = 'vm1'
Expand All @@ -72,6 +72,7 @@
DISK2_NAME = '%s_disk2' % VM2_NAME
DISK3_NAME = '%s_disk3' % VM1_NAME
FLOATING_DISK_NAME = 'floating_disk'
CONVERT_DISK_NAME = 'convert_disk'
BACKUP_DISK_NAME = '%s_disk' % BACKUP_VM_NAME

SD_TEMPLATES_NAME = 'templates'
Expand Down Expand Up @@ -138,6 +139,7 @@
"test_offline_snapshot_restore",
"test_import_template",
"test_live_storage_migration",
"test_convert_disk",
"test_verify_offline_snapshot_restore",
"test_remove_vm2_lease",
"test_hotunplug_disk",
Expand Down Expand Up @@ -483,7 +485,7 @@ def test_remove_vm2_backup_checkpoints(engine_api, get_vm_service_for_vm):

@pytest.fixture(scope="session")
def vm0_fqdn_or_ip(tested_ip_version, management_subnet):
vm0_address = {'ipv4': VM0_NAME, 'ipv6': str(management_subnet[250])}
vm0_address = {'ipv4': VM0_NAME, 'ipv6': VM0_NAME}
return vm0_address[f'ipv{tested_ip_version}']


Expand Down Expand Up @@ -734,6 +736,37 @@ def test_live_storage_migration(engine_api):
assert assert_utils.equals_within_long(lambda: disk_service.get().status, types.DiskStatus.OK)


@order_by(_TEST_LIST)
def test_convert_disk(disks_service):
correlation_id = 'convert_disk'

disks_service.add(
disk=types.Disk(
name=CONVERT_DISK_NAME,
format=types.DiskFormat.RAW,
provisioned_size=2 * MB,
sparse=False,
storage_domains=[types.StorageDomain(name=SD_ISCSI_NAME)],
),
query={'correlation_id': correlation_id},
)

disk = disks_service.list(search='name={}'.format(CONVERT_DISK_NAME))[0]
disk_service = disks_service.disk_service(disk.id)
assert assert_utils.equals_within_short(lambda: disk_service.get().status, types.DiskStatus.OK)

disk_service.convert(
types.Disk(
format=types.DiskFormat.COW,
backup=types.DiskBackup.INCREMENTAL,
),
query={'correlation_id': correlation_id},
)

assert assert_utils.equals_within_short(lambda: disk_service.get().status, types.DiskStatus.OK)
assert assert_utils.equals_within_short(lambda: disk_service.get().format, types.DiskFormat.COW)


@order_by(_TEST_LIST)
def test_export_vm2(engine_api):
engine = engine_api.system_service()
Expand Down Expand Up @@ -792,7 +825,6 @@ def test_import_vm_preallocated(engine_api, ost_cluster_name):
storage_domain=types.StorageDomain(id=sd.id),
host=types.Host(id=host.id),
),
async_=True,
query={'correlation_id': correlation_id},
)

Expand Down Expand Up @@ -973,7 +1005,7 @@ def test_run_vms(
if tested_ip_version == 6:
vms_service = engine_api.system_service().vms_service()
vm = vms_service.list(search='name={}'.format(VM0_NAME))[0]
cirros_serial_console.add_static_ip(vm.id, f'{vm0_fqdn_or_ip}/64', 'eth0')
# cirros_serial_console.add_static_ip(vm.id, f'{vm0_fqdn_or_ip}/64', 'eth0')

assert_vm_is_alive(vm0_fqdn_or_ip)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,5 +590,4 @@ def test_grafana(

grafana.open_dashboard('oVirt Inventory Dashboards', '02 Hosts Inventory Dashboard')
assert not grafana.is_error_visible()

save_screenshot('grafana-dashboard-2')
3 changes: 3 additions & 0 deletions common/deploy-scripts/setup_engine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ cp /usr/share/doc/ovirt-engine/mibs/* /usr/share/snmp/mibs
systemctl start snmptrapd
systemctl enable snmptrapd

# TODO: work around for https://bugzilla.redhat.com/2091565 - Downgrade OVN to 21.12.0-46 to match version on RHVH
rpm -q rhvm && dnf downgrade -y --repofrompath fdp,http://rhsm-pulp.corp.redhat.com/content/dist/layered/rhel8/x86_64/fast-datapath/os --repo fdp ovn-2021-central-21.12.0-46.el8fdp || true

8 changes: 1 addition & 7 deletions common/deploy-scripts/setup_storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ set_selinux_on_nfs() {
}

setup_iscsi() {
# this is ugly, assumes that dedicated storage VMs (ost-[suite]-storage) use their primary network as storage network only on HE suite, and VMs with co-located engine have a dedicated storage network on eth1 (like basic-suite-master).
echo $SUITE
if [[ $(hostname) == *"-storage"* ]] && [[ $(hostname) == *"he-"* ]]; then
NIC=eth0
else
NIC=eth1
fi
NIC=eth1
IP=$(/sbin/ip -o addr show dev $NIC scope global | tac | awk '{split($4,a,"."); print a[1] "." a[2] "." a[3] "." a[4]}'| awk -F/ '{print $1; exit}')

pvcreate --zero n /dev/${ISCSI_DEV}
Expand Down
8 changes: 1 addition & 7 deletions common/deploy-scripts/setup_storage_he_extra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ setup_he_lun() {

# The rest of this function is copied from setup_storage.sh. Keep in sync.
# TODO: Unite or rewrite some day

# this is ugly, assumes that dedicated storage VMs (ost-[suite]-storage) use their primary network as storage network, and VMs with co-located engine have a dedicated storage network on eth1 (like basic-suite-master).
if [[ $(hostname) == *"-storage"* ]]; then
NIC=eth0
else
NIC=eth1
fi
NIC=eth1
IP=$(/sbin/ip -o addr show dev $NIC scope global | tac | awk '{split($4,a,"."); print a[1] "." a[2] "." a[3] "." a[4]}'| awk -F/ '{print $1; exit}')

iscsiadm -m discovery -t sendtargets -p $IP
Expand Down
17 changes: 14 additions & 3 deletions common/init-configs/1_hosted_engine_2_hosts.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
"host-0",
"host-1"
]
},
"storage": {
"template": "common/libvirt-templates/net_template",
"nics": [
"host-0-storage",
"host-1-storage",
"storage-storage"
]
}
},
"vms" : {
Expand All @@ -19,7 +27,8 @@
"common/deploy-scripts/setup_storage_he_extra.sh"
],
"nics": {
"storage": { "template": "common/libvirt-templates/nic_template" }
"storage": { "template": "common/libvirt-templates/nic_template" },
"storage-storage": { "template": "common/libvirt-templates/nic_template" }
},
"root_disk_var": "OST_IMAGES_BASE",
"disks": {
Expand Down Expand Up @@ -47,7 +56,8 @@
"common/deploy-scripts/setup_host.sh"
],
"nics": {
"host-0": { "template": "common/libvirt-templates/nic_template" }
"host-0": { "template": "common/libvirt-templates/nic_template" },
"host-0-storage": { "template": "common/libvirt-templates/nic_template" }
},
"root_disk_var": "OST_IMAGES_HE_INSTALLED",
"disks": {}
Expand All @@ -59,7 +69,8 @@
"common/deploy-scripts/setup_host.sh"
],
"nics": {
"host-1": { "template": "common/libvirt-templates/nic_template" }
"host-1": { "template": "common/libvirt-templates/nic_template" },
"host-1-storage": { "template": "common/libvirt-templates/nic_template" }
},
"root_disk_var": "OST_IMAGES_NODE",
"disks": {}
Expand Down
5 changes: 3 additions & 2 deletions he-basic-suite-master/test-scenarios/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@

@pytest.fixture(scope="session")
def sd_iscsi_host_ip(
storage_management_ips,
storage_ips_for_network,
storage_network_name,
): # pylint: disable=function-redefined
return storage_management_ips[0]
return storage_ips_for_network(storage_network_name)[0]


@pytest.fixture(scope="session")
Expand Down
31 changes: 1 addition & 30 deletions ost_utils/deployment_utils/package_mgmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def expand_repos(custom_repos, working_dir, ost_images_distro):
if re.match(r"https://(www\.|api\.)?github.com/(repos/)?oVirt", repo_url):
repo_urls.append(expand_github_repo(repo_url, working_dir, ost_images_distro))
else:
repo_urls.extend(expand_jenkins_repo(repo_url, ost_images_distro))
repo_urls.append(repo_url)
return repo_urls


Expand Down Expand Up @@ -231,35 +231,6 @@ def _github_unpack_artifact(path: str):
os.unlink(path)


def expand_jenkins_repo(repo_url, ost_images_distro):
expanded_repos = set()
if requests.get(repo_url + '/repodata/repomd.xml').ok:
return [repo_url]

lvl1_page = requests.get(repo_url + '/api/json?depth=3')
lvl1_page.raise_for_status()
lvl1_page = lvl1_page.json()

url = lvl1_page['url']
if url.endswith('/'):
url = url[:-1]

repo_list = set()
for artifact in lvl1_page.get('artifacts', []):
if not artifact['relativePath'].endswith('rpm'):
continue
relative_path = artifact['relativePath'].split('/')[0]
new_url = f'{url}/artifact/{relative_path}'
repo_list.add(new_url)

if len(repo_list) == 0:
raise RuntimeError(f"Couldn't find any repos at {repo_url}")

expanded_repos.update(repo for repo in repo_list if ost_images_distro in repo)

return list(r for r in expanded_repos if 'ppc64le' not in r)


def add_custom_repos(ansible_vm, repo_urls):
for i, repo_url in enumerate(repo_urls):
_add_custom_repo(ansible_vm, f"{REPO_NAME}{i + 1}", repo_url)
Expand Down
7 changes: 5 additions & 2 deletions ost_utils/pytest/fixtures/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ def hostnames_to_add(hosts_hostnames):


@pytest.fixture(scope="session")
def hostnames_to_reboot(hosts_hostnames):
return hosts_hostnames[:1]
def hostnames_to_reboot(hosts_hostnames, ost_images_distro):
# for el8stream we reboot only one of the hosts to make the run faster,
# but on el9stream we need to reboot all of them to apply the monolithic
# libvirt preset
return hosts_hostnames if ost_images_distro == "el9stream" else hosts_hostnames[:1]


@pytest.fixture(scope="session")
Expand Down
5 changes: 5 additions & 0 deletions ost_utils/pytest/fixtures/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ def deploy(
if not request.config.getoption('--skip-custom-repos-check') and not deploy_hosted_engine:
package_mgmt.check_installed_packages(ansible_all)

# TEST: replace cirros with oVirt Tiny Core
ansible_all.shell(
'curl -L -o /var/tmp/cirros.img https://github.com/lveyde/ovirt-tinycore-linux/releases/download/v13.11/oVirtTinyCore64-13.11.qcow2'
)

# report package versions
package_mgmt.report_ovirt_packages_versions(ansible_all)

Expand Down
Loading