]> git.proxmox.com Git - mirror_qemu.git/blob - tests/vm/centos.aarch64
tests: acpi: add non zero function device with acpi-index on non-hotpluggble bus
[mirror_qemu.git] / tests / vm / centos.aarch64
1 #!/usr/bin/env python3
2 #
3 # Centos aarch64 image
4 #
5 # Copyright 2020 Linaro
6 #
7 # Authors:
8 # Robert Foley <robert.foley@linaro.org>
9 # Originally based on ubuntu.aarch64
10 #
11 # This code is licensed under the GPL version 2 or later. See
12 # the COPYING file in the top-level directory.
13 #
14
15 import os
16 import sys
17 import subprocess
18 import basevm
19 import time
20 import traceback
21 import aarch64vm
22
23
24 DEFAULT_CONFIG = {
25 'cpu' : "max",
26 'machine' : "virt,gic-version=max",
27 'install_cmds' : (
28 "dnf config-manager --set-enabled powertools, "
29 "dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo, "
30 "dnf install -y make ninja-build git python38 gcc gcc-c++ flex bison "\
31 "glib2-devel pixman-devel zlib-devel docker-ce.aarch64, "
32 "systemctl enable docker, "
33 ),
34 # We increase beyond the default time since during boot
35 # it can take some time (many seconds) to log into the VM.
36 'ssh_timeout' : 60,
37 }
38
39
40 class CentosAarch64VM(basevm.BaseVM):
41 name = "centos8.aarch64"
42 arch = "aarch64"
43 image_name = "CentOS-Stream-GenericCloud-8-20220125.1.aarch64.qcow2"
44 image_link = "https://cloud.centos.org/centos/8-stream/aarch64/images/"
45 image_link += image_name
46 BUILD_SCRIPT = """
47 set -e;
48 cd $(mktemp -d);
49 export SRC_ARCHIVE=/dev/vdb;
50 sudo chmod a+r $SRC_ARCHIVE;
51 tar -xf $SRC_ARCHIVE;
52 ./configure {configure_opts};
53 make --output-sync {target} -j{jobs} {verbose};
54 """
55
56 def boot(self, img, extra_args=None):
57 aarch64vm.create_flash_images(self._tmpdir, self._efi_aarch64)
58 default_args = aarch64vm.get_pflash_args(self._tmpdir)
59 if extra_args:
60 extra_args.extend(default_args)
61 else:
62 extra_args = default_args
63 # We always add these performance tweaks
64 # because without them, we boot so slowly that we
65 # can time out finding the boot efi device.
66 if '-smp' not in extra_args and \
67 '-smp' not in self._config['extra_args'] and \
68 '-smp' not in self._args:
69 # Only add if not already there to give caller option to change it.
70 extra_args.extend(["-smp", "8"])
71 # We have overridden boot() since aarch64 has additional parameters.
72 # Call down to the base class method.
73 super(CentosAarch64VM, self).boot(img, extra_args=extra_args)
74
75 def build_image(self, img):
76 cimg = self._download_with_cache(self.image_link)
77 img_tmp = img + ".tmp"
78 subprocess.run(['cp', '-f', cimg, img_tmp])
79 self.exec_qemu_img("resize", img_tmp, "50G")
80 self.boot(img_tmp, extra_args = ["-cdrom", self.gen_cloud_init_iso()])
81 self.wait_ssh(wait_root=True)
82 self.ssh_root_check("touch /etc/cloud/cloud-init.disabled")
83
84 # If the user chooses *not* to do the second phase,
85 # then we will jump right to the graceful shutdown
86 if self._config['install_cmds'] != "":
87 install_cmds = self._config['install_cmds'].split(',')
88 for cmd in install_cmds:
89 self.ssh_root_check(cmd)
90
91 self.ssh_root("poweroff")
92 self.wait()
93 os.rename(img_tmp, img)
94 print("image creation complete: {}".format(img))
95 return 0
96
97
98 if __name__ == "__main__":
99 defaults = aarch64vm.get_config_defaults(CentosAarch64VM, DEFAULT_CONFIG)
100 sys.exit(basevm.main(CentosAarch64VM, defaults))