From 649f977f689e43d67a380024dfa9fb6df365fa5d Mon Sep 17 00:00:00 2001 From: ccardenas Date: Fri, 26 Jan 2018 05:34:41 +0000 Subject: [PATCH] Fix Failure on Start When attempting to start a vm from vm.conf that fails due to inadequate resources and such, do not remote vm entry from vm list. Reported by mpi@ ok mpi@ --- usr.sbin/vmd/config.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/usr.sbin/vmd/config.c b/usr.sbin/vmd/config.c index b2d0010f5e1..ae3fbebc2b4 100644 --- a/usr.sbin/vmd/config.c +++ b/usr.sbin/vmd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.40 2018/01/05 13:34:52 jca Exp $ */ +/* $OpenBSD: config.c,v 1.41 2018/01/26 05:34:41 ccardenas Exp $ */ /* * Copyright (c) 2015 Reyk Floeter @@ -416,8 +416,13 @@ config_setvm(struct privsep *ps, struct vmd_vm *vm, uint32_t peerid, uid_t uid) free(tapfds); } - log_debug("%s: calling vm_remove", __func__); - vm_remove(vm); + if (vm->vm_from_config) { + log_debug("%s: calling stop vm %d", __func__, vm->vm_vmid); + vm_stop(vm, 0); + } else { + log_debug("%s: calling remove vm %d", __func__, vm->vm_vmid); + vm_remove(vm); + } errno = saved_errno; if (errno == 0) errno = EINVAL; -- 2.20.1