Howdy.

Attached is a patch to fix the following condition:
When attempting to start a VM from vm.conf that fails (can't allocate
resources, etc...), do not remove vm from vm list.

Reported to bugs@ by mpi@.

Comments? Ok?

+--+
Carlos
Index: config.c
===================================================================
RCS file: /home/los/cvs/src/usr.sbin/vmd/config.c,v
retrieving revision 1.40
diff -u -p -a -u -r1.40 config.c
--- config.c    5 Jan 2018 13:34:52 -0000       1.40
+++ config.c    25 Jan 2018 03:25:23 -0000
@@ -416,8 +416,13 @@ config_setvm(struct privsep *ps, struct 
                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;

Reply via email to