From 275c7f5c6707cd170d382cc737e21c30b62087a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Fri, 3 Feb 2023 16:01:26 +0100 Subject: [PATCH] kola: Remove 'qemu-unpriv' and make 'qemu' the default There is no longer a privileged 'qemu' platform and the 'qemu' and 'qemu-unpriv' platforms are the same. --- mantle/cmd/kola/kola.go | 2 +- mantle/cmd/kola/options.go | 28 ++++++++++++++-------------- mantle/kola/harness.go | 9 ++------- src/cmd-kola | 2 +- src/cmd-offline-update | 2 +- 5 files changed, 19 insertions(+), 24 deletions(-) diff --git a/mantle/cmd/kola/kola.go b/mantle/cmd/kola/kola.go index ace7d0ef17..eb40c38512 100644 --- a/mantle/cmd/kola/kola.go +++ b/mantle/cmd/kola/kola.go @@ -582,7 +582,7 @@ func syncFindParentImageOptions() error { // Here we handle the --fetch-parent-image --> platform-specific options // based on its cosa build metadata switch kolaPlatform { - case "qemu-unpriv": + case "qemu": if qemuImageDir == "" { if qemuImageDir, err = os.MkdirTemp("/var/tmp", "kola-run-upgrade"); err != nil { return err diff --git a/mantle/cmd/kola/options.go b/mantle/cmd/kola/options.go index c455b75816..ba78f0ec03 100644 --- a/mantle/cmd/kola/options.go +++ b/mantle/cmd/kola/options.go @@ -39,7 +39,7 @@ var ( kolaPlatform string kolaParallelArg string kolaArchitectures = []string{"amd64"} - kolaPlatforms = []string{"aws", "azure", "do", "esx", "gce", "openstack", "packet", "qemu", "qemu-unpriv", "qemu-iso"} + kolaPlatforms = []string{"aws", "azure", "do", "esx", "gce", "openstack", "packet", "qemu", "qemu-iso"} kolaDistros = []string{"fcos", "rhcos", "scos"} ) @@ -172,21 +172,21 @@ func syncOptionsImpl(useCosa bool) error { return fmt.Errorf("unsupported %v %q", name, item) } + if kolaPlatform == "iso" { + kolaPlatform = "qemu-iso" + } // TODO: Could also auto-synchronize if e.g. --aws-ami is passed - if kolaPlatform == "" { - if kola.QEMUIsoOptions.IsoPath != "" { - kolaPlatform = "qemu-iso" - } else { - kolaPlatform = "qemu-unpriv" - } + if kolaPlatform == "" && kola.QEMUIsoOptions.IsoPath != "" { + kolaPlatform = "qemu-iso" } - // There used to be a "privileged" qemu path, it is no longer supported. - // Alias qemu to qemu-unpriv. - if kolaPlatform == "qemu" { - kolaPlatform = "qemu-unpriv" - } else if kolaPlatform == "iso" { - kolaPlatform = "qemu-iso" + // There used to be two QEMU platforms: privileged ('qemu') and + // unprivileged ('qemu-unpriv'). We first removed support for privileged + // QEMU and aliased it to 'qemu-unpriv' and then renamed and merged + // 'qemu-unpriv' to 'qemu' to unify on a single name. 'qemu' is now the + // default. + if kolaPlatform == "" { + kolaPlatform = "qemu" } // test parallelism @@ -334,7 +334,7 @@ func syncOptions() error { // options that can be derived from the cosa build metadata func syncCosaOptions() error { switch kolaPlatform { - case "qemu-unpriv", "qemu": + case "qemu": if kola.QEMUOptions.DiskImage == "" && kola.CosaBuild.Meta.BuildArtifacts.Qemu != nil { kola.QEMUOptions.DiskImage = filepath.Join(kola.CosaBuild.Dir, kola.CosaBuild.Meta.BuildArtifacts.Qemu.Path) } diff --git a/mantle/kola/harness.go b/mantle/kola/harness.go index 5f827466ab..df8a3eb94f 100644 --- a/mantle/kola/harness.go +++ b/mantle/kola/harness.go @@ -279,7 +279,7 @@ func NewFlight(pltfrm string) (flight platform.Flight, err error) { flight, err = openstack.NewFlight(&OpenStackOptions) case "packet": flight, err = packet.NewFlight(&PacketOptions) - case "qemu-unpriv": + case "qemu": flight, err = unprivqemu.NewFlight(&QEMUOptions) case "qemu-iso": flight, err = qemuiso.NewFlight(&QEMUIsoOptions) @@ -469,11 +469,6 @@ func filterTests(tests map[string]*register.Test, patterns []string, pltfrm stri checkPlatforms := []string{pltfrm} - // qemu-unpriv has the same restrictions as QEMU but might also want additional restrictions due to the lack of a Local cluster - if pltfrm == "qemu-unpriv" { - checkPlatforms = append(checkPlatforms, "qemu") - } - // sort tags into include/exclude positiveTags := []string{} negativeTags := []string{} @@ -627,7 +622,7 @@ func filterTests(tests map[string]*register.Test, patterns []string, pltfrm stri if allowed, excluded := isAllowed(Options.Distribution, t.Distros, t.ExcludeDistros); !allowed || excluded { continue } - if pltfrm == "qemu-unpriv" { + if pltfrm == "qemu" { if allowed, excluded := isAllowed(QEMUOptions.Firmware, t.Firmwares, t.ExcludeFirmwares); !allowed || excluded { continue } diff --git a/src/cmd-kola b/src/cmd-kola index ab880210d8..0c503c02b4 100755 --- a/src/cmd-kola +++ b/src/cmd-kola @@ -49,7 +49,7 @@ r = re.compile("-p(=.+)?|--platform(=.+)?") platformargs = list(filter(r.match, unknown_args)) if os.getuid() != 0 and len(platformargs) == 0: - kolaargs.extend(['-p', 'qemu-unpriv']) + kolaargs.extend(['-p', 'qemu']) if args.build is not None: kolaargs.extend(['--build', args.build]) diff --git a/src/cmd-offline-update b/src/cmd-offline-update index fc06faff49..28efe1773f 100755 --- a/src/cmd-offline-update +++ b/src/cmd-offline-update @@ -10,7 +10,7 @@ # cd /path/to/rhcos-4.8 # cp --reflink=auto /path/to/rhcos-4.6.0-x86_64-qemu.qcow2 tmp/ # cosa offline-update tmp/rhcos-4.6.0-x86_64-qemu.qcow2 -# kola run -p qemu-unpriv -b rhcos --qemu-image tmp/rhcos-4.6.0-x86_64-qemu.qcow2 basic +# kola run -p qemu -b rhcos --qemu-image tmp/rhcos-4.6.0-x86_64-qemu.qcow2 basic set -euo pipefail