containerized-data-importer/tools/vddk-test/entrypoint.sh
Maya Rashish 02e70a5a54
Use centos:stream9 as a base image, cleanup unused code (#1983)
* Retire ember LVM code, unused

(Rationale: avoid having to change more things for changing the
base image)

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Remove unreferenced files from WORKSPACE

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Switch to centos:stream9 as a base image.

It has a significantly longer support cycle than Fedora releases,
and supposedly offers vulnerability scans.

Add a tinyCore.vdi to the repo instead of generating it.
The centos qemu-img has read-only VDI support, so we can't generate
it. Generate it using my system and add to the file-host.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Use full names for pulls from dockerhub

CentOS doesn't like short tags

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Avoid specifying checksum for CentOS images.

They expire faster than we can update checksums, this is unfortunate
but perhaps they will soon publish images at a lower rate allowing
us to keep up.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Bump number of open file limit to avoid bazel crashes

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Update builder to include #2087, builder based on centos stream9

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Update checksums that seem wrong

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Update ovirt links: old ones were removed

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Remove unused RPMs

Noticed due to: duplicated checksum but no problem in testsuite,
lack of aarch64 equivalent.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Put nbdkit-vddk-plugin back for amd64.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Use quay.io instead of dockerhub.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Install util-linux-core for /usr/sbin/blockdev

Needed after #2174

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Update nbdkit/libnbd/nginx/ovirt versions to the latest

The previous version we were using can't be fetched any more

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Generate our own CentOS stream9 image using RPMs

Now updating the dependencies can be done by running `make rpm-deps`
and committing the change, like kubevirt.

This creates a small complication that we need to run update-ca-trust
to trust root CAs. Do this on the pod, using the entrypoint to do so.

Use a single image with all the dependencies for the test tools, we
don't benefit from making them minimal and it saved some trouble in
the conversion.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Fixup imageio test container

Run update-ca-trust and update-crypto-policies before running
ovirt-imageio, to stop error messages.

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2022-04-20 19:37:51 +02:00

52 lines
1.4 KiB
Bash

#!/usr/bin/env bash
set -m
set -x
mkfifo /tmp/vcfifo
tar xvf /usr/bin/vcsim.tar.gz -C /usr/bin
tar xvf /usr/bin/govc.tar.gz -C /usr/bin
/usr/bin/vcsim -l :8989 -E /tmp/vcfifo -dc 0 &
eval "$(cat /tmp/vcfifo)"
export GOVC_INSECURE=1
TESTSTORE=/tmp/teststore
mkdir -p $TESTSTORE
/usr/bin/govc datacenter.create testdc
/usr/bin/govc cluster.create testcluster
/usr/bin/govc cluster.add -hostname testhost -username user -password pass -noverify
/usr/bin/govc datastore.create -type local -name teststore -path $TESTSTORE testcluster/*
/usr/bin/govc vm.create testvm
while read line; do
if [[ $line =~ (^[\s]*UUID:[\s]*)(.*)$ ]]; then
uuid="${BASH_REMATCH[2]}"
echo $uuid > /tmp/vmid
fi
done < <(govc vm.info testvm)
/usr/bin/govc vm.disk.create -vm testvm -name testvm/testdisk.vmdk -size 2GB
while read line; do
if [[ $line =~ (^[\s]*File:[\s]*)(.*)$ ]]; then
file="${BASH_REMATCH[2]}"
echo $file > /tmp/vmdisk
fi
done < <(govc device.info -vm testvm)
/usr/bin/govc snapshot.create -vm testvm Snapshot-1
/usr/bin/govc snapshot.create -vm testvm Snapshot-2
while read line; do
if [[ $line =~ \[(.*?)\].*Snapshot-1 ]]; then
snapshot1="${BASH_REMATCH[1]}"
echo $snapshot1 > /tmp/vmsnapshot1
fi
if [[ $line =~ \[(.*?)\].*Snapshot-2 ]]; then
snapshot2="${BASH_REMATCH[1]}"
echo $snapshot2 > /tmp/vmsnapshot2
fi
done < <(govc snapshot.tree -vm testvm -i)
fg