vmd: allow vm with "cdrom" but no disk

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

vmd: allow vm with "cdrom" but no disk

Stuart Henderson
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 | Threaded
Open this post in threaded view
|

Re: vmd: allow vm with "cdrom" but no disk

Carlos Cardenas
On Wed, Jan 10, 2018 at 02:00:57PM +0000, Stuart Henderson wrote:
> 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?

ok ccardenas

>
> 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 | Threaded
Open this post in threaded view
|

Re: vmd: allow vm with "cdrom" but no disk

Mike Larkin
In reply to this post by Stuart Henderson
On Wed, Jan 10, 2018 at 02:00:57PM +0000, Stuart Henderson wrote:
> 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?
>

sure

> 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");
>