1
//go:build amd64 || arm64
8
"github.com/containers/podman/v5/pkg/machine"
9
"github.com/containers/podman/v5/pkg/machine/env"
10
"github.com/containers/podman/v5/pkg/machine/shim"
11
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
14
// MachineOS manages machine OS's from outside the machine.
15
type MachineOS struct {
17
VM *vmconfigs.MachineConfig
18
Provider vmconfigs.VMProvider
23
// Apply applies the image by sshing into the machine and running apply from inside the VM.
24
func (m *MachineOS) Apply(image string, opts ApplyOptions) error {
25
args := []string{"podman", "machine", "os", "apply", image}
27
if err := machine.CommonSSH(m.VM.SSH.RemoteUsername, m.VM.SSH.IdentityPath, m.VMName, m.VM.SSH.Port, args); err != nil {
31
dirs, err := env.GetMachineDirs(m.Provider.VMType())
37
if err := shim.Stop(m.VM, m.Provider, dirs, false); err != nil {
40
if err := shim.Start(m.VM, m.Provider, dirs, machine.StartOptions{NoInfo: true}); err != nil {
43
fmt.Printf("Machine %q restarted successfully\n", m.VMName)