diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index a046a8977b..273bbdd380 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -964,13 +964,6 @@ func (v *MachineVM) Remove(_ string, opts machine.RemoveOptions) (string, func() files = append(files, socketPath.Path) files = append(files, v.archRemovalFiles()...) - if err := machine.RemoveConnection(v.Name); err != nil { - logrus.Error(err) - } - if err := machine.RemoveConnection(v.Name + "-root"); err != nil { - logrus.Error(err) - } - vmConfigDir, err := machine.GetConfDir(vmtype) if err != nil { return "", nil, err @@ -1001,6 +994,12 @@ func (v *MachineVM) Remove(_ string, opts machine.RemoveOptions) (string, func() logrus.Error(err) } } + if err := machine.RemoveConnection(v.Name); err != nil { + logrus.Error(err) + } + if err := machine.RemoveConnection(v.Name + "-root"); err != nil { + logrus.Error(err) + } return nil }, nil }