migration: Report error when shutdown fails
[qemu/kevin.git] / tests / vm / centos
blob097a9ca14d3cc6daa110ee45f4eea68c974da32c
1 #!/usr/bin/env python3
3 # CentOS 8 Stream image
5 # Copyright 2018, 2022 Red Hat Inc.
7 # Authors:
8 #  Fam Zheng <famz@redhat.com>
10 # This code is licensed under the GPL version 2 or later.  See
11 # the COPYING file in the top-level directory.
14 import os
15 import sys
16 import subprocess
17 import basevm
18 import time
20 class CentosVM(basevm.BaseVM):
21     name = "centos"
22     arch = "x86_64"
23     BUILD_SCRIPT = """
24         set -e;
25         cd $(mktemp -d);
26         export SRC_ARCHIVE=/dev/vdb;
27         sudo chmod a+r $SRC_ARCHIVE;
28         tar -xf $SRC_ARCHIVE;
29         make docker-test-block@centos8 {verbose} J={jobs} NETWORK=1;
30         make docker-test-quick@centos8 {verbose} J={jobs} NETWORK=1;
31     """
33     def build_image(self, img):
34         cimg = self._download_with_cache("https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20220125.1.x86_64.qcow2")
35         img_tmp = img + ".tmp"
36         subprocess.check_call(['cp', '-f', cimg, img_tmp])
37         self.exec_qemu_img("resize", img_tmp, "50G")
38         self.boot(img_tmp, extra_args = ["-cdrom", self.gen_cloud_init_iso()])
39         self.wait_ssh()
40         self.ssh_root_check("touch /etc/cloud/cloud-init.disabled")
41         self.ssh_root_check("dnf update -y")
42         self.ssh_root_check("dnf install -y dnf-plugins-core")
43         self.ssh_root_check("dnf config-manager --set-enabled powertools")
44         self.ssh_root_check("dnf install -y podman make ninja-build git python3")
45         self.ssh_root("poweroff")
46         self.wait()
47         os.rename(img_tmp, img)
48         return 0
50 if __name__ == "__main__":
51     sys.exit(basevm.main(CentosVM))