Commit
9962e406c664ed5521f5aca500c860a331cb3979 introduced a
problem where if the VM failed to startup, it would not be
correctly cleaned up. Amongst other things the SELinux
security label would not be removed, which prevents the VM
from ever starting again.
The virDomainIsActive() check at the start of qemudShutdownVMDaemon
checks for vm->def->id not being -1. By moving the assignment of the
VM id to the start of qemudStartVMDaemon, we can ensure cleanup will
occur on failure
* src/qemu/qemu_driver.c: Move initialization of 'vm->def->id'
so that qemudShutdownVMDaemon() will process the shutdown
if (virDomainObjSetDefTransient(driver->caps, vm, true) < 0)
goto cleanup;
+ vm->def->id = driver->nextvmid++;
+
/* Must be run before security labelling */
DEBUG0("Preparing host devices");
if (qemuPrepareHostDevices(driver, vm->def) < 0)
}
DEBUG0("Building emulator command line");
- vm->def->id = driver->nextvmid++;
if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig,
priv->monJSON != 0, qemuCmdFlags,
migrateFrom, stdin_fd,