Use the correct emulator prefix for qemu cleanup steps
The qemu pid detection code can find the correct qemu binary, no matter
if it is qemu-kvm* or qemu-system*. Now it uses the qemu binary prefix
also for deteccting the pid on shutdowns.
@@ -322,7 +322,7 @@ func main() {
log.InitializeLogging("virt-launcher")
if !*noFork {
- exitCode, err := ForkAndMonitor("qemu-kvm", *ephemeralDiskDir, *containerDiskDir)
+ exitCode, err := ForkAndMonitor(*containerDiskDir)
if err != nil {
log.Log.Reason(err).Error("monitoring virt-launcher failed")
os.Exit(1)
@@ -449,7 +449,7 @@ func main() {
// ForkAndMonitor itself to give qemu an extra grace period to properly terminate
// in case of virt-launcher crashes
-func ForkAndMonitor(qemuProcessCommandPrefix string, ephemeralDiskDir string, containerDiskDir string) (int, error) {
+func ForkAndMonitor(containerDiskDir string) (int, error) {
defer cleanupContainerDiskDirectory(containerDiskDir)
cmd := exec.Command(os.Args[0], append(os.Args[1:], "--no-fork", "true")...)
cmd.Stdout = os.Stdout
@@ -514,8 +514,10 @@ func ForkAndMonitor(qemuProcessCommandPrefix string, ephemeralDiskDir string, co
// are not everywhere available where libvirt and qemu are. There we usually call qemu-kvm
// which resides in /usr/libexec/qemu-kvm
pid, _ := virtlauncher.FindPid("qemu-system")
+ qemuProcessCommandPrefix := "qemu-system"
if pid <= 0 {
pid, _ = virtlauncher.FindPid("qemu-kvm")
+ qemuProcessCommandPrefix = "qemu-kvm"
}
if pid > 0 {
p, err := os.FindProcess(pid)
