automation-tests/pkg/machine
Valentin Rothberg 8b7701f522 machine: QEMU: recover from failed start
After a failed start, we can run into (somehow inconsistent) states
where the machine won't start because a previous QEMU process is still
running and the PID file is being used.  Stop didn't resolve the issue
as this state wasn't detected.

Allow to recover from this state by a) detecting it during start and
error out with a more helpful message than the error QEMU would
otherwise spit out, and b) by enabling stop to kill the dangling QEMU
process - even after a failed stop.

With the changes, a recovery may look as follows:
```
_  podman git:(main) _ ./bin/darwin/podman machine start
Starting machine "podman-machine-default"
Error: cannot start VM "podman-machine-default": another instance of "/opt/homebrew/bin/qemu-system-aarch64" is already running with process ID 970: please stop and restart the VM
_  podman git:(main) _ ./bin/darwin/podman machine stop
Machine "podman-machine-default" stopped successfully
_  podman git:(main) _ ./bin/darwin/podman machine start
Starting machine "podman-machine-default"
Waiting for VM ...
```

Please note that this change does not prevent us from running into such
inconsistent states but only allows for recovering from them.

[NO NEW TESTS NEEDED] - there is no reliable reproducer.

Fixes: #16054
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-02 11:08:26 +02:00
..
applehv move `removeFilesAndConnections` to a common file 2023-08-01 21:13:58 -04:00
e2e Use bytes size consistently instead of human size 2023-07-06 14:51:06 +02:00
hyperv Move `writeConfig` logic to shared function 2023-08-01 21:40:14 -04:00
os Introduce podman machine os apply 2023-02-15 14:48:12 -05:00
qemu machine: QEMU: recover from failed start 2023-08-02 11:08:26 +02:00
wsl Move `writeConfig` logic to shared function 2023-08-01 21:40:14 -04:00
config.go Podman machine AppleHV pass number 3 2023-07-13 09:06:34 -05:00
config_test.go pkg/machine: add missing build tags to tests 2022-07-04 18:09:30 +02:00
connection.go move `removeFilesAndConnections` to a common file 2023-08-01 21:13:58 -04:00
errors.go MVP for Podman Machine with AppleHV 2023-05-02 13:09:56 -05:00
fcos.go MVP for Podman Machine with AppleHV 2023-05-02 13:09:56 -05:00
fcos_test.go Machine refactor for QEMU/AppleHV 2023-02-22 09:00:24 -06:00
fedora_unix.go WSL refactoring 2023-01-23 10:48:32 -06:00
fedora_windows.go WSL refactoring 2023-01-23 10:48:32 -06:00
ignition.go refactor(machine): remove hard code 2023-06-21 18:49:12 +08:00
ignition_darwin.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
ignition_freebsd.go pkg: Build pkg/machine on FreeBSD 2022-08-13 07:53:34 +01:00
ignition_linux.go fix #17244: use /etc/timezone where `timedatectl` is missing on Linux 2023-01-30 00:36:37 +09:00
ignition_schema.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
ignition_windows.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
keys.go refactor: improve get ssh path duplicate code 2023-06-07 09:03:35 +08:00
machine_common.go Move `writeConfig` logic to shared function 2023-08-01 21:40:14 -04:00
machine_unix.go Podman machine AppleHV pass number 3 2023-07-13 09:06:34 -05:00
machine_unsupported.go go fmt: use go 1.18 conditional-build syntax 2022-03-18 09:11:53 +01:00
machine_windows.go Expose Podman named pipe in Inspect output 2023-02-03 00:05:28 +02:00
pull.go Move alternate image acquisition to separate function 2023-08-01 09:53:38 -04:00
ssh.go fix(ssh): start machine failed to start with exit status 255 2023-06-16 19:39:38 +08:00
update.go Set machine docker.sock according to rootful flag 2023-05-14 23:56:15 -05:00
volumes.go Podman machine AppleHV pass number 3 2023-07-13 09:06:34 -05:00