Currently we require either "kernel" or "disk", but there may be
some viable use cases where just a CDROM image is given. This adjusts
the check to avoid bailing in that case.

OK?

Index: vmd.c
===================================================================
RCS file: /cvs/src/usr.sbin/vmd/vmd.c,v
retrieving revision 1.78
diff -u -p -r1.78 vmd.c
--- vmd.c       8 Jan 2018 11:58:27 -0000       1.78
+++ vmd.c       10 Jan 2018 13:57:26 -0000
@@ -1140,8 +1140,9 @@ vm_register(struct privsep *ps, struct v
        } else if (vcp->vcp_nnics > VMM_MAX_NICS_PER_VM) {
                log_warnx("invalid number of interfaces");
                goto fail;
-       } else if (strlen(vcp->vcp_kernel) == 0 && vcp->vcp_ndisks == 0) {
-               log_warnx("no kernel or disk specified");
+       } else if (strlen(vcp->vcp_kernel) == 0 &&
+           vcp->vcp_ndisks == 0 && strlen(vcp->vcp_cdrom) == 0) {
+               log_warnx("no kernel or disk/cdrom specified");
                goto fail;
        } else if (strlen(vcp->vcp_name) == 0) {
                log_warnx("invalid VM name");

Reply via email to