Machine init --provider

Add the ability for users to override the default provider when creating mahcines.  The new flag is `--provider` and allows you to specifiy a valid vmtype for the platform.  This PR also removes the previous list test where we tested listing all providers.  I added a PR for testing --provider which includes a standard `machine ls` which defaults now to showing all providers.

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2025-10-03 14:01:49 -05:00
parent 386c8f3fe9
commit 5e1c2f8d7d
17 changed files with 162 additions and 119 deletions

View File

@@ -10,22 +10,8 @@ import (
)
type initMachine struct {
/*
--cpus uint Number of CPUs (default 1)
--disk-size uint Disk size in GiB (default 100)
--ignition-path string Path to ignition file
--username string Username of the remote user (default "core" for FCOS, "user" for Fedora)
--image-path string Path to bootable image (default "testing")
-m, --memory uint Memory in MiB (default 2048)
--now Start machine now
--rootful Whether this machine should prefer rootful container execution
--playbook string Run an ansible playbook after first boot
--tls-verify Require HTTPS and verify certificates when contacting registries
--timezone string Set timezone (default "local")
-v, --volume stringArray Volumes to mount, source:target
--volume-driver string Optional volume driver
*/
playbook string
provider string
cpus *uint
diskSize *uint
swap *uint
@@ -80,6 +66,9 @@ func (i *initMachine) buildCmd(m *machineTestBuilder) []string {
if l := len(i.playbook); l > 0 {
cmd = append(cmd, "--playbook", i.playbook)
}
if l := len(i.provider); l > 0 {
cmd = append(cmd, "--provider", i.provider)
}
if i.userModeNetworking {
cmd = append(cmd, "--user-mode-networking")
}
@@ -176,6 +165,11 @@ func (i *initMachine) withRunPlaybook(p string) *initMachine {
return i
}
func (i *initMachine) withProvider(p string) *initMachine {
i.provider = p
return i
}
func (i *initMachine) withTlsVerify(tlsVerify *bool) *initMachine {
i.tlsVerify = tlsVerify
return i