diff --git a/mantle/cmd/kola/kola.go b/mantle/cmd/kola/kola.go index a19badafc9..481bff0fe8 100644 --- a/mantle/cmd/kola/kola.go +++ b/mantle/cmd/kola/kola.go @@ -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 diff --git a/mantle/cmd/kola/options.go b/mantle/cmd/kola/options.go index a2b889618c..3d0519029d 100644 --- a/mantle/cmd/kola/options.go +++ b/mantle/cmd/kola/options.go @@ -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"} ) @@ -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() @@ -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) } diff --git a/mantle/cmd/kola/spawn.go b/mantle/cmd/kola/spawn.go index 97e504f7fb..cd55d3d36b 100644 --- a/mantle/cmd/kola/spawn.go +++ b/mantle/cmd/kola/spawn.go @@ -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 ( @@ -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) diff --git a/mantle/kola/harness.go b/mantle/kola/harness.go index 55393a989c..570ede04c5 100644 --- a/mantle/kola/harness.go +++ b/mantle/kola/harness.go @@ -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" @@ -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 @@ -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: @@ -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{} @@ -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 } diff --git a/mantle/kola/tests/ignition/luks.go b/mantle/kola/tests/ignition/luks.go index e689dd1c20..5a5b3b75d0 100644 --- a/mantle/kola/tests/ignition/luks.go +++ b/mantle/kola/tests/ignition/luks.go @@ -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" ) @@ -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" { diff --git a/mantle/kola/tests/ignition/security.go b/mantle/kola/tests/ignition/security.go index dbca853f8f..50a8abaf5d 100644 --- a/mantle/kola/tests/ignition/security.go +++ b/mantle/kola/tests/ignition/security.go @@ -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, }) diff --git a/mantle/kola/tests/misc/boot-mirror.go b/mantle/kola/tests/misc/boot-mirror.go index bffa14fa3c..cb48c07d57 100644 --- a/mantle/kola/tests/misc/boot-mirror.go +++ b/mantle/kola/tests/misc/boot-mirror.go @@ -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" ) @@ -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) } @@ -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) } diff --git a/mantle/kola/tests/misc/network.go b/mantle/kola/tests/misc/network.go index 37e5461db3..280bd665c0 100644 --- a/mantle/kola/tests/misc/network.go +++ b/mantle/kola/tests/misc/network.go @@ -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" ) @@ -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") @@ -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") diff --git a/mantle/kola/tests/rhcos/upgrade.go b/mantle/kola/tests/rhcos/upgrade.go index e2eda9dee0..8f435c3354 100644 --- a/mantle/kola/tests/rhcos/upgrade.go +++ b/mantle/kola/tests/rhcos/upgrade.go @@ -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" ) @@ -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) diff --git a/mantle/platform/machine/unprivqemu/cluster.go b/mantle/platform/machine/qemu/cluster.go similarity index 98% rename from mantle/platform/machine/unprivqemu/cluster.go rename to mantle/platform/machine/qemu/cluster.go index 033860371a..790f04ce94 100644 --- a/mantle/platform/machine/unprivqemu/cluster.go +++ b/mantle/platform/machine/qemu/cluster.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package unprivqemu +package qemu import ( "fmt" @@ -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 diff --git a/mantle/platform/machine/unprivqemu/flight.go b/mantle/platform/machine/qemu/flight.go similarity index 99% rename from mantle/platform/machine/unprivqemu/flight.go rename to mantle/platform/machine/qemu/flight.go index a651b97050..188fd599e9 100644 --- a/mantle/platform/machine/unprivqemu/flight.go +++ b/mantle/platform/machine/qemu/flight.go @@ -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" diff --git a/mantle/platform/machine/unprivqemu/machine.go b/mantle/platform/machine/qemu/machine.go similarity index 99% rename from mantle/platform/machine/unprivqemu/machine.go rename to mantle/platform/machine/qemu/machine.go index c217bb0cff..807fc6a56e 100644 --- a/mantle/platform/machine/unprivqemu/machine.go +++ b/mantle/platform/machine/qemu/machine.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package unprivqemu +package qemu import ( "context" diff --git a/src/cmd-kola b/src/cmd-kola index 8cf39e3973..2fe2a20dcf 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 f5d4754e9b..146b3616f4 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