mirror of
https://github.com/containers/podman.git
synced 2025-06-23 18:59:30 +08:00
basic hypverv machine implementation
with libhvee, we are able to do the basics of podman machine management on hyperv. The basic functions like init, rm, stop, and start are all functional. Start and stop will periodically throw a benign error processing the hyperv message being returned from the action. The error is described in the todo's below. notable items: * no podman commands will work (like ps, images, etc) * the machine must be initialized with --image-path and fed a custom image. * disk size is set to 100GB statically. * the vm joins the default hyperv network which is TCP/IP network based. * podman machine ssh does not work * podman machine set does not work * you can grab the ip address from hyperv and fake a machine connection with `podman system connection`. * when booting, use the hyperv console to know the boot is complete. TODOs: * podman machine ssh * podman machine set * podman machine rm needs force bool * disk size in NewMachine is set to 100GB * podman start needs to wait until fully booted * establish a boot complete signal from guest * implement gvproxy like user networking * fix benign failures in stop/start -> Error: error 2147749890 (FormatMessage failed with: The system cannot find message text for message number 0x%1 in the message file for %2.) [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
@ -57,7 +57,7 @@ type VirtProvider interface {
|
||||
LoadVMByName(name string) (VM, error)
|
||||
NewMachine(opts InitOptions) (VM, error)
|
||||
RemoveAndCleanMachines() error
|
||||
VMType() string
|
||||
VMType() VMType
|
||||
}
|
||||
|
||||
type RemoteConnectionType string
|
||||
@ -183,7 +183,7 @@ func (rc RemoteConnectionType) MakeSSHURL(host, path, port, userName string) url
|
||||
}
|
||||
|
||||
// GetCacheDir returns the dir where VM images are downloaded into when pulled
|
||||
func GetCacheDir(vmType string) (string, error) {
|
||||
func GetCacheDir(vmType VMType) (string, error) {
|
||||
dataDir, err := GetDataDir(vmType)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@ -197,12 +197,12 @@ func GetCacheDir(vmType string) (string, error) {
|
||||
|
||||
// GetDataDir returns the filepath where vm images should
|
||||
// live for podman-machine.
|
||||
func GetDataDir(vmType string) (string, error) {
|
||||
func GetDataDir(vmType VMType) (string, error) {
|
||||
dataDirPrefix, err := DataDirPrefix()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
dataDir := filepath.Join(dataDirPrefix, vmType)
|
||||
dataDir := filepath.Join(dataDirPrefix, vmType.String())
|
||||
if _, err := os.Stat(dataDir); !errors.Is(err, os.ErrNotExist) {
|
||||
return dataDir, nil
|
||||
}
|
||||
@ -222,12 +222,12 @@ func DataDirPrefix() (string, error) {
|
||||
|
||||
// GetConfigDir returns the filepath to where configuration
|
||||
// files for podman-machine should live
|
||||
func GetConfDir(vmType string) (string, error) {
|
||||
func GetConfDir(vmType VMType) (string, error) {
|
||||
confDirPrefix, err := ConfDirPrefix()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
confDir := filepath.Join(confDirPrefix, vmType)
|
||||
confDir := filepath.Join(confDirPrefix, vmType.String())
|
||||
if _, err := os.Stat(confDir); !errors.Is(err, os.ErrNotExist) {
|
||||
return confDir, nil
|
||||
}
|
||||
@ -379,3 +379,24 @@ type ConnectionConfig struct {
|
||||
// PodmanPipe is the exported podman service named pipe (Windows hosts only)
|
||||
PodmanPipe *VMFile `json:"PodmanPipe"`
|
||||
}
|
||||
|
||||
type VMType int64
|
||||
|
||||
const (
|
||||
QemuVirt VMType = iota
|
||||
WSLVirt
|
||||
AppleHvVirt
|
||||
HyperVVirt
|
||||
)
|
||||
|
||||
func (v VMType) String() string {
|
||||
switch v {
|
||||
case WSLVirt:
|
||||
return "wsl"
|
||||
case AppleHvVirt:
|
||||
return "applehv"
|
||||
case HyperVVirt:
|
||||
return "hyperv"
|
||||
}
|
||||
return "qemu"
|
||||
}
|
||||
|
Reference in New Issue
Block a user