diff --git a/mantle/cmd/kola/qemuexec.go b/mantle/cmd/kola/qemuexec.go index 5a16be4011759c9dbfcfd3456f92d91d3dfa2b48..93082545ef49e219b351c4fea02f42a880a759d5 100644 --- a/mantle/cmd/kola/qemuexec.go +++ b/mantle/cmd/kola/qemuexec.go @@ -84,9 +84,10 @@ func init() { cmdQemuExec.Flags().StringVarP(&firstbootkargs, "firstbootkargs", "", "", "Additional first boot kernel arguments") cmdQemuExec.Flags().StringArrayVar(&kargs, "kargs", nil, "Additional kernel arguments applied") cmdQemuExec.Flags().BoolVarP(&usernet, "usernet", "U", false, "Enable usermode networking") - cmdQemuExec.Flags().StringSliceVar(&ignitionFragments, "add-ignition", nil, "Append well-known Ignition fragment: [\"autologin\", \"autoresize\"]") + cmdQemuExec.Flags().StringSliceVar(&ignitionFragments, "add-ignition", nil, "Append well-known Ignition fragment: [\"autologin\", \"autoresize\", \"noautoupdate\"]") cmdQemuExec.Flags().StringVarP(&hostname, "hostname", "", "", "Set hostname via DHCP") cmdQemuExec.Flags().IntVarP(&memory, "memory", "m", 0, "Memory in MB") + cmdQemuExec.Flags().StringVar(&architecture, "arch", "", "Use full emulation for target architecture (e.g. aarch64, x86_64, s390x, ppc64le)") cmdQemuExec.Flags().StringArrayVarP(&addDisks, "add-disk", "D", []string{}, "Additional disk, human readable size (repeatable)") cmdQemuExec.Flags().BoolVar(&cpuCountHost, "auto-cpus", false, "Automatically set number of cpus to host count") cmdQemuExec.Flags().BoolVar(&directIgnition, "ignition-direct", false, "Do not parse Ignition, pass directly to instance") @@ -113,6 +114,8 @@ func renderFragments(fragments []string, c *conf.Conf) error { c.AddAutoLogin() case "autoresize": c.AddAutoResize() + case "noautoupdate": + c.DisableAutomaticUpdates() default: return fmt.Errorf("Unknown fragment: %s", fragtype) } @@ -247,6 +250,12 @@ func runQemuExec(cmd *cobra.Command, args []string) error { builder := platform.NewQemuBuilder() defer builder.Close() + if architecture != "" { + if err := builder.SetArchitecture(architecture); err != nil { + return err + } + } + var config *conf.Conf if butane != "" { buf, err := os.ReadFile(butane) diff --git a/mantle/platform/machine/qemu/cluster.go b/mantle/platform/machine/qemu/cluster.go index 8b0e4dce99cdbeca01b4ac8fe15e4612c4b49b89..28d159f01535d26b0617d83f98eeb78752524c21 100644 --- a/mantle/platform/machine/qemu/cluster.go +++ b/mantle/platform/machine/qemu/cluster.go @@ -19,6 +19,7 @@ import ( "os" "path/filepath" "strconv" + "strings" "sync" "time" @@ -120,6 +121,13 @@ func (qc *Cluster) NewMachineWithQemuOptions(userdata *conf.UserData, options pl builder.Hostname = fmt.Sprintf("qemu%d", qc.BaseCluster.AllocateMachineSerial()) builder.ConsoleFile = qm.consolePath + // This one doesn't support configuring the path because we can't + // reliably change the Ignition config here... + for _, path := range qc.flight.opts.BindRO { + destpathrel := strings.TrimLeft(path, "/") + builder.MountHost(path, "/kola/host/"+destpathrel, true) + } + if qc.flight.opts.Memory != "" { memory, err := strconv.ParseInt(qc.flight.opts.Memory, 10, 32) if err != nil { diff --git a/mantle/platform/machine/qemu/flight.go b/mantle/platform/machine/qemu/flight.go index 188fd599e90db97c0dd6608c0f6a87e0686cdf41..8abc4db8e633e10d0d066c8fcfa67612229b8051 100644 --- a/mantle/platform/machine/qemu/flight.go +++ b/mantle/platform/machine/qemu/flight.go @@ -46,6 +46,9 @@ type Options struct { //Option to create a temporary software TPM - true by default Swtpm bool + // Array of $hostpath + BindRO []string + //IBM Secure Execution SecureExecution bool SecureExecutionIgnitionPubKey string diff --git a/mantle/platform/qemu.go b/mantle/platform/qemu.go index ccdbe66e7678d950d5efe1167e7fb521928a1307..38e6bafcd9e608daedee655f81e30c1a14016c6d 100644 --- a/mantle/platform/qemu.go +++ b/mantle/platform/qemu.go @@ -692,11 +692,12 @@ func (builder *QemuBuilder) setupAdditionalNetworking() error { // SetArchitecture enables qemu full emulation for the target architecture. func (builder *QemuBuilder) SetArchitecture(arch string) error { switch arch { - case "x86_64", "aarch64", "s390x", "ppc64le": + //case "x86_64", "aarch64", "s390x", "ppc64le": + case "x86_64", "aarch64": builder.architecture = arch return nil } - return fmt.Errorf("architecture %s not supported by coreos-assembler qemu", arch) + return fmt.Errorf("architecture %s not supported by nestos-assembler qemu", arch) } // SetSecureExecution enables qemu confidential guest support and adds hostkey to ignition config. diff --git a/src/deps.txt b/src/deps.txt index 50cbafc2c0ce2b8af96ede59460e07ba77935414..5d38e443d93936c101bfa7bfdc3792125c64536b 100644 --- a/src/deps.txt +++ b/src/deps.txt @@ -32,7 +32,7 @@ make git rpm-build libguestfs-tools libguestfs-tools-c virtiofsd /usr/bin/qemu-img qemu-kvm swtpm # And the main arch emulators for cross-arch testing #qemu-system-aarch64-core qemu-system-ppc-core qemu-system-s390x-core qemu-system-x86-core -qemu-system-aarch64-core qemu-system-x86-core +qemu-system-aarch64 qemu-system-x86 # Useful for moving files around rsync