Skip to content

Commit

Permalink
kola: Remove 'qemu-unpriv' and make 'qemu' the default
Browse files Browse the repository at this point in the history
There is no longer a privileged 'qemu' platform and the 'qemu' and
'qemu-unpriv' platforms are the same.
  • Loading branch information
travier committed Jun 13, 2023
1 parent 0f52e60 commit 941cad2
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 44 deletions.
2 changes: 1 addition & 1 deletion mantle/cmd/kola/kola.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,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
Expand Down
28 changes: 14 additions & 14 deletions mantle/cmd/kola/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var (
kolaPlatform string
kolaParallelArg string
kolaArchitectures = []string{"amd64"}
kolaPlatforms = []string{"aws", "azure", "do", "esx", "gcp", "openstack", "packet", "qemu", "qemu-unpriv", "qemu-iso"}
kolaPlatforms = []string{"aws", "azure", "do", "esx", "gcp", "openstack", "packet", "qemu", "qemu-iso"}
kolaDistros = []string{"fcos", "rhcos", "scos"}
)

Expand Down Expand Up @@ -177,23 +177,23 @@ func syncOptionsImpl(useCosa bool) error {
return fmt.Errorf("unsupported %v %q", name, item)
}

// 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 == "iso" {
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" {
if kolaPlatform == "" && kola.QEMUIsoOptions.IsoPath != "" {
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
if kolaParallelArg == "auto" {
ncpu, err := system.GetProcessors()
Expand Down Expand Up @@ -339,7 +339,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.SecureExecution && kola.QEMUOptions.DiskImage == "" && kola.CosaBuild.Meta.BuildArtifacts.SecureExecutionQemu != nil {
kola.QEMUOptions.DiskImage = filepath.Join(kola.CosaBuild.Dir, kola.CosaBuild.Meta.BuildArtifacts.SecureExecutionQemu.Path)
}
Expand Down
4 changes: 2 additions & 2 deletions mantle/cmd/kola/spawn.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/coreos/coreos-assembler/mantle/kola"
"github.com/coreos/coreos-assembler/mantle/platform"
"github.com/coreos/coreos-assembler/mantle/platform/conf"
"github.com/coreos/coreos-assembler/mantle/platform/machine/unprivqemu"
"github.com/coreos/coreos-assembler/mantle/platform/machine/qemu"
)

var (
Expand Down Expand Up @@ -178,7 +178,7 @@ func runSpawn(cmd *cobra.Command, args []string) error {
}

switch qc := cluster.(type) {
case *unprivqemu.Cluster:
case *qemu.Cluster:
mach, err = qc.NewMachineWithQemuOptions(userdata, machineOpts)
default:
plog.Fatalf("unreachable: qemu cluster %v unknown type", qc)
Expand Down
15 changes: 5 additions & 10 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ import (
"github.com/coreos/coreos-assembler/mantle/platform/machine/gcloud"
"github.com/coreos/coreos-assembler/mantle/platform/machine/openstack"
"github.com/coreos/coreos-assembler/mantle/platform/machine/packet"
"github.com/coreos/coreos-assembler/mantle/platform/machine/qemu"
"github.com/coreos/coreos-assembler/mantle/platform/machine/qemuiso"
"github.com/coreos/coreos-assembler/mantle/platform/machine/unprivqemu"
"github.com/coreos/coreos-assembler/mantle/system"
"github.com/coreos/coreos-assembler/mantle/util"
coreosarch "github.com/coreos/stream-metadata-go/arch"
Expand Down Expand Up @@ -114,7 +114,7 @@ var (
GCPOptions = gcloudapi.Options{Options: &Options} // glue to set platform options from main
OpenStackOptions = openstackapi.Options{Options: &Options} // glue to set platform options from main
PacketOptions = packetapi.Options{Options: &Options} // glue to set platform options from main
QEMUOptions = unprivqemu.Options{Options: &Options} // glue to set platform options from main
QEMUOptions = qemu.Options{Options: &Options} // glue to set platform options from main
QEMUIsoOptions = qemuiso.Options{Options: &Options} // glue to set platform options from main

CosaBuild *util.LocalBuild // this is a parsed cosa build
Expand Down Expand Up @@ -299,8 +299,8 @@ func NewFlight(pltfrm string) (flight platform.Flight, err error) {
flight, err = openstack.NewFlight(&OpenStackOptions)
case "packet":
flight, err = packet.NewFlight(&PacketOptions)
case "qemu-unpriv":
flight, err = unprivqemu.NewFlight(&QEMUOptions)
case "qemu":
flight, err = qemu.NewFlight(&QEMUOptions)
case "qemu-iso":
flight, err = qemuiso.NewFlight(&QEMUIsoOptions)
default:
Expand Down Expand Up @@ -480,11 +480,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{}
Expand Down Expand Up @@ -638,7 +633,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
}
Expand Down
4 changes: 2 additions & 2 deletions mantle/kola/tests/ignition/luks.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
ut "github.com/coreos/coreos-assembler/mantle/kola/tests/util"
"github.com/coreos/coreos-assembler/mantle/platform"
"github.com/coreos/coreos-assembler/mantle/platform/conf"
"github.com/coreos/coreos-assembler/mantle/platform/machine/unprivqemu"
"github.com/coreos/coreos-assembler/mantle/platform/machine/qemu"
"github.com/coreos/coreos-assembler/mantle/util"
)

Expand Down Expand Up @@ -76,7 +76,7 @@ func setupTangMachine(c cluster.TestCluster) ut.TangServer {
// the golang compiler no longer checks that the individual types in the case have the
// NewMachineWithQemuOptions function, but rather whether platform.Cluster
// does which fails
case *unprivqemu.Cluster:
case *qemu.Cluster:
m, err = pc.NewMachineWithQemuOptions(ignition, options)
for _, hfp := range options.HostForwardPorts {
if hfp.Service == "tang" {
Expand Down
2 changes: 1 addition & 1 deletion mantle/kola/tests/ignition/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func init() {
"TLSServe": register.CreateNativeFuncWrap(TLSServe),
},
Tags: []string{"ignition"},
// QEMU unprivileged doesn't support multiple VMs communicating with each other.
// QEMU doesn't support multiple VMs communicating with each other.
ExcludePlatforms: []string{"qemu"},
Timeout: 20 * time.Minute,
})
Expand Down
6 changes: 3 additions & 3 deletions mantle/kola/tests/misc/boot-mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/coreos/coreos-assembler/mantle/kola/tests/util"
"github.com/coreos/coreos-assembler/mantle/platform"
"github.com/coreos/coreos-assembler/mantle/platform/conf"
"github.com/coreos/coreos-assembler/mantle/platform/machine/unprivqemu"
"github.com/coreos/coreos-assembler/mantle/platform/machine/qemu"
ut "github.com/coreos/coreos-assembler/mantle/util"
)

Expand Down Expand Up @@ -103,7 +103,7 @@ func runBootMirrorTest(c cluster.TestCluster) {
// FIXME: for QEMU tests kola currently assumes the host CPU architecture
// matches the one under test
userdata := bootmirror.Subst("LAYOUT", coreosarch.CurrentRpmArch())
m, err = c.Cluster.(*unprivqemu.Cluster).NewMachineWithQemuOptions(userdata, options)
m, err = c.Cluster.(*qemu.Cluster).NewMachineWithQemuOptions(userdata, options)
if err != nil {
c.Fatal(err)
}
Expand Down Expand Up @@ -150,7 +150,7 @@ func runBootMirrorLUKSTest(c cluster.TestCluster) {
// FIXME: for QEMU tests kola currently assumes the host CPU architecture
// matches the one under test
userdata := bootmirrorluks.Subst("LAYOUT", coreosarch.CurrentRpmArch())
m, err = c.Cluster.(*unprivqemu.Cluster).NewMachineWithQemuOptions(userdata, options)
m, err = c.Cluster.(*qemu.Cluster).NewMachineWithQemuOptions(userdata, options)
if err != nil {
c.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions mantle/kola/tests/misc/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/coreos/coreos-assembler/mantle/kola/register"
"github.com/coreos/coreos-assembler/mantle/platform"
"github.com/coreos/coreos-assembler/mantle/platform/conf"
"github.com/coreos/coreos-assembler/mantle/platform/machine/unprivqemu"
"github.com/coreos/coreos-assembler/mantle/platform/machine/qemu"
"github.com/coreos/coreos-assembler/mantle/util"
)

Expand Down Expand Up @@ -488,7 +488,7 @@ func setupMultipleNetworkTest(c cluster.TestCluster, primaryMac, secondaryMac st
// the golang compiler no longer checks that the individual types in the case have the
// NewMachineWithQemuOptions function, but rather whether platform.Cluster
// does which fails
case *unprivqemu.Cluster:
case *qemu.Cluster:
m, err = pc.NewMachineWithQemuOptions(userdata, options)
default:
panic("unreachable")
Expand Down Expand Up @@ -553,7 +553,7 @@ func setupWithInterfacesTest(c cluster.TestCluster, primaryMac, secondaryMac str
// the golang compiler no longer checks that the individual types in the case have the
// NewMachineWithQemuOptions function, but rather whether platform.Cluster
// does which fails
case *unprivqemu.Cluster:
case *qemu.Cluster:
m, err = pc.NewMachineWithQemuOptions(userdata, options)
default:
panic("unreachable")
Expand Down
4 changes: 2 additions & 2 deletions mantle/kola/tests/rhcos/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"github.com/coreos/coreos-assembler/mantle/kola/tests/util"
"github.com/coreos/coreos-assembler/mantle/platform"
"github.com/coreos/coreos-assembler/mantle/platform/conf"
"github.com/coreos/coreos-assembler/mantle/platform/machine/unprivqemu"
"github.com/coreos/coreos-assembler/mantle/platform/machine/qemu"
installer "github.com/coreos/coreos-assembler/mantle/util"
"github.com/coreos/go-semver/semver"
)
Expand Down Expand Up @@ -213,7 +213,7 @@ func rhcosUpgradeFromOcpRhcos(c cluster.TestCluster) {
}`)

switch pc := c.Cluster.(type) {
case *unprivqemu.Cluster:
case *qemu.Cluster:
ostreeCommit := kola.CosaBuild.Meta.OstreeCommit
temp := os.TempDir()
rhcosQcow2, err := downloadLatestReleasedRHCOS(temp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package unprivqemu
package qemu

import (
"fmt"
Expand Down Expand Up @@ -102,7 +102,7 @@ func (qc *Cluster) NewMachineWithQemuOptions(userdata *conf.UserData, options pl
}
} else if conf.IsEmpty() {
} else {
return nil, fmt.Errorf("unprivileged qemu only supports Ignition or empty configs")
return nil, fmt.Errorf("qemu only supports Ignition or empty configs")
}

builder.ConfigFile = confPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package unprivqemu
package qemu

import (
"github.com/coreos/pkg/capnslog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package unprivqemu
package qemu

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd-kola
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion src/cmd-offline-update
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 941cad2

Please sign in to comment.