From a8bb34534e0ad143d9019638041f536303fc6cb3 Mon Sep 17 00:00:00 2001 From: Bruno Goncalves Date: Oct 18 2017 08:56:35 +0000 Subject: kill qemu if can't access launched qcow2 image --- diff --git a/inventory/standard-inventory-qcow2 b/inventory/standard-inventory-qcow2 index 24978dc..6505cc7 100755 --- a/inventory/standard-inventory-qcow2 +++ b/inventory/standard-inventory-qcow2 @@ -208,6 +208,11 @@ def host(image): except subprocess.CalledProcessError: time.sleep(3) else: + # Kill the qemu process + try: + os.kill(proc.pid, signal.SIGTERM) + except OSError: + pass raise RuntimeError("could not access launched qcow2 image: {0}".format(image)) # Process of our parent