Fix lookup of HyperV VMs with matching name

Fixes https://github.com/podman-container-tools/podman/issues/29138

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
(cherry picked from commit bec840d716)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Mario Loriedo 2026-07-07 23:39:48 +02:00 committed by Paul Holzinger
parent 2012cca598
commit cedb305e31
No known key found for this signature in database
GPG key ID: EB145DD938A3CAF2

View file

@ -206,6 +206,11 @@ func (h HyperVStubber) Exists(name string) (bool, error) {
vmm := hypervctl.NewVirtualMachineManager()
exists, _, err := vmm.GetMachineExists(name)
if errors.Is(err, hypervctl.ErrHyperVNamespaceMissing) {
// Hyper-V services are turned off,
// return `false`.
return false, nil
}
return exists, err
}