Added locking to vm creation.