diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2016-11-24 07:58:56 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2016-11-24 07:58:56 +0000 |
commit | 81d8dac5286fc0d2981df1a3284c184ae3c6e9d5 (patch) | |
tree | 02c8d9ed18b4e832e7e4f28e5f1a183d2be41829 /usr.sbin/vmd/vmd.c | |
parent | 318a7884e9d299146de19d369e29bf264cc1180c (diff) |
Add support for booting the kernel from the disk image.
This make the kernel/-k argument optional and, if not specified, tries
to find the /bsd kernel in the primary hd0a partition of the first
disk image itself. It doesn't support hd0a:/etc/boot.conf yet, and it
is no BIOS or full boot loader, but it makes booting and handling of
VMs a bit easier - booting an external kernel is still supported.
The UFS file system code ufs.c is directly from libsa which is also
used by the real boot loader. The code compiles with a few signedness
warning which will be fixed separately.
OK mlarkin@
Diffstat (limited to 'usr.sbin/vmd/vmd.c')
-rw-r--r-- | usr.sbin/vmd/vmd.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c index c29d4aac3ae..857976e3e0b 100644 --- a/usr.sbin/vmd/vmd.c +++ b/usr.sbin/vmd/vmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.c,v 1.42 2016/11/22 21:55:54 reyk Exp $ */ +/* $OpenBSD: vmd.c,v 1.43 2016/11/24 07:58:55 reyk Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -199,8 +199,11 @@ vmd_dispatch_vmm(int fd, struct privsep_proc *p, struct imsg *imsg) break; } - log_info("%s: started vm %d successfully, tty %s", - vcp->vcp_name, vcp->vcp_id, vm->vm_ttyname); + log_info("%s: started vm %d successfully, " + "kernel %s, tty %s", vcp->vcp_name, vcp->vcp_id, + strlen(vcp->vcp_kernel) ? + vcp->vcp_kernel : "hd0a:" VM_DEFAULT_KERNEL, + vm->vm_ttyname); break; case IMSG_VMDOP_TERMINATE_VM_RESPONSE: case IMSG_VMDOP_TERMINATE_VM_EVENT: @@ -664,13 +667,16 @@ vm_register(struct privsep *ps, struct vmop_create_params *vmc, if (vcp->vcp_ncpus == 0) vcp->vcp_ncpus = 1; if (vcp->vcp_ncpus > VMM_MAX_VCPUS_PER_VM) { - log_debug("invalid number of CPUs"); + log_warnx("invalid number of CPUs"); goto fail; } else if (vcp->vcp_ndisks > VMM_MAX_DISKS_PER_VM) { - log_debug("invalid number of disks"); + log_warnx("invalid number of disks"); goto fail; } else if (vcp->vcp_nnics > VMM_MAX_NICS_PER_VM) { - log_debug("invalid number of interfaces"); + 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"); goto fail; } |