mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Correct VM existance check on WSL
Replaces GetHyperVisorVMs() with Exists() to better abstract the underlying use-case and slightly imrpove efficiency. Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
This commit is contained in:
@ -123,19 +123,10 @@ func (h HyperVStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineC
|
||||
return err
|
||||
}
|
||||
|
||||
func (h HyperVStubber) GetHyperVisorVMs() ([]string, error) {
|
||||
var (
|
||||
vmNames []string
|
||||
)
|
||||
func (h HyperVStubber) Exists(name string) (bool, error) {
|
||||
vmm := hypervctl.NewVirtualMachineManager()
|
||||
vms, err := vmm.GetAll()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, vm := range vms {
|
||||
vmNames = append(vmNames, vm.ElementName) // Note: elementname is human-readable name
|
||||
}
|
||||
return vmNames, nil
|
||||
exists, _, err := vmm.GetMachineExists(name)
|
||||
return exists, err
|
||||
}
|
||||
|
||||
func (h HyperVStubber) MountType() vmconfigs.VolumeMountType {
|
||||
|
Reference in New Issue
Block a user