cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

centos (1677B)


      1#!/usr/bin/env python3
      2#
      3# CentOS image
      4#
      5# Copyright 2018 Red Hat Inc.
      6#
      7# Authors:
      8#  Fam Zheng <famz@redhat.com>
      9#
     10# This code is licensed under the GPL version 2 or later.  See
     11# the COPYING file in the top-level directory.
     12#
     13
     14import os
     15import sys
     16import subprocess
     17import basevm
     18import time
     19
     20class 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        make docker-test-mingw@fedora  {verbose} J={jobs} NETWORK=1;
     32    """
     33
     34    def build_image(self, img):
     35        cimg = self._download_with_cache("https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.3.2011-20201204.2.x86_64.qcow2")
     36        img_tmp = img + ".tmp"
     37        subprocess.check_call(["ln", "-f", cimg, img_tmp])
     38        self.exec_qemu_img("resize", img_tmp, "50G")
     39        self.boot(img_tmp, extra_args = ["-cdrom", self.gen_cloud_init_iso()])
     40        self.wait_ssh()
     41        self.ssh_root_check("touch /etc/cloud/cloud-init.disabled")
     42        self.ssh_root_check("dnf update -y")
     43        self.ssh_root_check("dnf install -y dnf-plugins-core")
     44        self.ssh_root_check("dnf config-manager --set-enabled powertools")
     45        self.ssh_root_check("dnf install -y podman make ninja-build git python3")
     46        self.ssh_root("poweroff")
     47        self.wait()
     48        os.rename(img_tmp, img)
     49        return 0
     50
     51if __name__ == "__main__":
     52    sys.exit(basevm.main(CentosVM))