mirror of
https://github.com/containers/podman.git
synced 2026-07-14 09:11:49 -04:00
The following PR is the very first step in what will a series of steps to apply a "common" machine configuration file to all providers. Function names, method names, struct names, and field names are all up for debate. The purpose of this PR is to offer a glimpse at the direction we intend to take. This PR also contains temporary structs (i.e. aThing) that are not exported. These are merely placeholders. The configuration work in this PR is also unused of yet. But the code is compiled. Once merged, we can begin the next step of development. [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
44 lines
1.6 KiB
Go
44 lines
1.6 KiB
Go
//go:build darwin
|
|
// +build darwin
|
|
|
|
package vfkit
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/containers/podman/v4/pkg/machine/define"
|
|
)
|
|
|
|
type Endpoint string
|
|
|
|
// VZMachineState is what the restful service in vfkit will return
|
|
type VZMachineState string
|
|
|
|
const (
|
|
// Values that the machine can be in
|
|
// "VirtualMachineStateStoppedVirtualMachineStateRunningVirtualMachineStatePausedVirtualMachineStateErrorVirtualMachineStateStartingVirtualMachineStatePausingVirtualMachineStateResumingVirtualMachineStateStopping"
|
|
VZMachineStateStopped VZMachineState = "VirtualMachineStateStopped"
|
|
VZMachineStateRunning VZMachineState = "VirtualMachineStateRunning"
|
|
VZMachineStatePaused VZMachineState = "VirtualMachineStatePaused"
|
|
VZMachineStateError VZMachineState = "VirtualMachineStateError"
|
|
VZMachineStateStarting VZMachineState = "VirtualMachineStateStarting"
|
|
VZMachineStatePausing VZMachineState = "VirtualMachineStatePausing"
|
|
VZMachineStateResuming VZMachineState = "VirtualMachineStateResuming"
|
|
VZMachineStateStopping VZMachineState = "VirtualMachineStateStopping"
|
|
)
|
|
|
|
func ToMachineStatus(val string) (define.Status, error) {
|
|
switch val {
|
|
case string(VZMachineStateRunning), string(VZMachineStatePausing), string(VZMachineStateResuming), string(VZMachineStateStopping), string(VZMachineStatePaused):
|
|
return define.Running, nil
|
|
case string(VZMachineStateStopped):
|
|
return define.Stopped, nil
|
|
case string(VZMachineStateStarting):
|
|
return define.Starting, nil
|
|
case string(VZMachineStateError):
|
|
return "", errors.New("machine is in error state")
|
|
}
|
|
return "", fmt.Errorf("unknown machine state: %s", val)
|
|
}
|