summaryrefslogtreecommitdiff
path: root/usr.sbin/vmctl
AgeCommit message (Collapse)Author
2024-08-17Use 'int ch' instead of 'char ch' in one place for getopt.Mike Larkin
Forgot one change during an earlier commit; use 'int ch' to make builds complete without warning on arm64. ok dv
2024-07-10Split vmd into mi/md parts.Dave Voutila
Makes as much of the core of vmd mi, pushing x86-isms into separate compilation units. Adds build logic for arm64, but no emulation yet. (You can build vmd, but it won't have a vmm device to connect to.) Some more cleanup probably needed around interrupt controller abstraction, but that can come as we implement more than the i8259. ok mlarkin@
2024-07-09vmctl(8): set exit code for vmctl stat -rMike Larkin
set exit code to 1 if no running VMs are detected with vmctl stat -r. ok dv
2024-05-18remove prototypes with no matching functionJonathan Gray
2024-05-04add -r to "show" command; ok mlarkinJason McIntyre
2024-05-02vmctl(8): Add 'vmctl status -r'Mike Larkin
The -r option can be used to limit the output of 'vmctl status' to only running VMs. This is useful for machines that have a large number of stopped VMs, as the running ones are printed at the top by default and previously required scrolling back to see the list of running VMs, and/or using 'grep RUNNING'. There is no change for users not using -r. ok dv
2024-04-10vmctl: fix incorrect scaling when converting disk images.Dave Voutila
ctl_convert still had old logic assuming disk sizes were in MiB and not bytes, causing an attempt to create a new disk using the '-i' argument to generate impossibly large output disk images (e.g. 1 MiB ends up 1 TiB). Reported by and diff from Jesper Wallin.
2024-02-16New sentence, new line. Use .Pa for /etc/login.conf.Jonathan Gray
2024-01-12Clarify some behaviour for 'vmctl start' and 'vmctl reload'Mike Larkin
Clarify that vmctl start max memory is governed by the vmd(8) user's max datasize in /etc/login.conf and that vmctl reload only reloads state for non-running VMs. ok dv
2023-11-09vmctl(8): avoid abort when given an invalid "kernel" file.Dave Voutila
The vmctl `start` command allows the user to pass an optional "kernel" file (either a ramdisk kernel or a SeaBIOS image). This file is opened by vmctl and the descriptor passed via imsg. If the file provided isn't a regular file, the attempt to send the start message to vmd(8)'s control socket will fail and results in a the vmctl process aborting. Check the file type after open and fail gracefully if not a regular file. reported by and ok gnezdo@
2023-05-02free the correct pointer. Missed in rev 1.16.Jonathan Gray
ok dv@
2023-04-28Clarify -b usage by `vmctl start`.Dave Voutila
2023-04-28vmd(8)/vmctl(8): allow vm owners to override boot kernel.Dave Voutila
vmd allows non-root users to "own" a vm defined in vm.conf(5). While the user can start/stop the vm, if they break their filesystem they have no means of booting recovery media like a ramdisk kernel. This change opens the provided boot kernel via vmctl and passes the file descriptor through the control channel to vmd. The next boot of the vm will use the provided file descriptor as boot kernel/bios. Subsequent boots (e.g. a reboot) will return to using behavior defined in vm.conf or the default bios image. ok mlarkin@
2023-04-25vmctl(8): no longer needs vmmvar.hDave Voutila
Finally! We can remove kernel headers from vmctl. ok mlarkin@
2023-04-25vmm(4)/vmd(8): pull struct members out of vmm ioctl create struct.Dave Voutila
The object sent to vmm(4) contained file paths and details the kernel does not need for cpu virtualization as device emulation is in userland. Effectively, "pull up" the struct members from the vm_create_params struct to the parent vmop_create_params struct. This allows us to clean up some of vmd(8) and simplify things for switching to having vmctl(8) open the "kernel" file (SeaBIOS, bsd.rd, etc.) to allow users to boot recovery ramdisk kernels. ok mlarkin@
2023-01-28Move some header definitions from vmm(4) to vmd(8).Dave Voutila
Part of an ongoing effort to move userland-specific information out of a kernel header and directly into vmd(8). No functional change. ok mlarkin@
2022-09-01fix unveil(2) in vmctl(8), unix socket needs :w:Sebastian Benoit
ok mestre@ martijn@
2022-07-30vmctl create accepts exactly one argumentKlemens Nanni
Make "vmctl create -s3G 1.img 2.img" fail instead of just creating 1.img and ignoring 2.img. OK dv cheloha
2022-05-13Follow the recent change that the unit of `imgsize' argument ofYASUOKA Masahiko
create_imagefile() became MB. Also change the arguement's type from long to uint64_t that is preferred. ok dv
2022-05-04vmctl(8)/vmd(8): convert disk sizes from MB to bytesDave Voutila
Continue converting other parts to storing data in bytes instead of MB. In this case, the logic for disk sizes was being scaled. This fixes issues reported by Martin Vahlensieck where vmctl could no longer create disks larger than 7 MiB after previous commits to change storing memory sizes as bytes. While this keeps the vm memory limit check in vmctl's size parser, it skips the limit check for disks. The error messages adjust accordingly and this removes the double error message logging. Update comments and function types accordingly. ok marlkin@
2022-05-04Missed removing some memory scaling in vmm, vmctl.Dave Voutila
Continuation of commitid RbITgDkOsW8SMssz removing use of megabytes instead of bytes in vmm(4) and vmctl(8). Missed this spot that only manifests after a vm is started and has its runtime details inspected.
2022-05-03vmm/vmd/vmctl: standardize memory units to bytesDave Voutila
At different points in the vm lifecycle vmm(4), vmctl(8), and vmd(8) refer to a vm's memory range sizes in either bytes or megabytes. This is needlessly complex. Switch to using bytes everywhere and adjust types and constants accordingly. While this makes it possible to specify vm's with memory in fractions of megabytes, the logic requiring whole megabyte values remains. Feedback from deraadt@, mlarkin@, and Matthew Martin. ok mlarkin@
2021-07-12Change the error reporting pattern throughout the tree when unveilBob Beck
fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
2021-06-28Garbage collect loop index i which is no longer used after usage tweak.Theo Buehler
2021-06-26make usage less chatty; ok mlarkinJason McIntyre
2021-06-10vmctl(8)/vmd(8): communicate TERMINATE_VM_EVENT imsgs on vm stop.dv
Instead of translating imsg types, update vmclt(8) to handle receiving IMSG_VMDOP_TERMINATE_VM_EVENT messages on vm termination. This finishes the work previously committed for supporting multiple waiters or the cancellation of a client waiting on a vm shutdown. vmd no longer needs to translate an IMSG_VMDOP_TERMINATE_VM_RESPONSE into an *_EVENT. ok mlarkin@
2021-05-12vmctl(8): remove unveil from disk image creation routinesdv
James Cook reported an issue creating images from qcow2 disks that contained base images. Initial approach suggested was to replace the use of realpath(3), but since this is common code used in vmd(8) the better option is to just remove the use of unveil(1) in vmctl. (It was added very early in vmctl's development before support for disk conversion was added.) This does not change existing unveil usage in vmctl for things like the control socket or the serial console. There's no change to vmd either. Discussed with and OK from mlarkin@
2021-04-02Remove superflouus mmcpy()dv
Reported by Preben Guldberg. ok mlarkin@
2021-03-26Simplify argument parsing of vmctl stopTheo Buehler
The previous argument parsing logic had at least three bugs: a copy-paste error led to an off-by-one and a printf "%s" NULL, as reported by Preben Guldberg. A previous commit led to a dead else branch and a use of uninitialized. This can all be avoided by reworking the logic so as to be readable. Prompted by a diff from Preben ok dv
2021-03-22Properly reflect stopping statekn
Diff from Preben Guldberg < preben at guldberg dot org>, thanks! In "vmctl status", VMs that are being stopped but are still running will simply show up as "running". Give preference to showing the "stopping" state akin to how a paused VM is handled. Tested by Dave Voutila OK tb
2021-03-01Document veb(4) supportkn
Feedback jmc OK dlg
2021-01-27split out extern and decl for -fno-commonTheo de Raadt
2020-09-02Fix clang warning in vmctl(8)Theo Buehler
If the path to a tty doesn't contain a '/' or ends in a '/' use the full path. (The intent is to chop off the leading "/dev/") ok deraadt (who had the same diff) martijn millert
2020-03-11fix spelling of IMSG_VMDOP_TERMINATE_VM_RESPONSE in commentJasper Lievisse Adriaanse
from Matt Schultz
2020-02-16Backout "DHCP is configured on the first interface only"kn
I completely missed that part from vmctl.5's "LOCAL INTERFACES" section. Reading `-L's description itself and the fact that it functions as a boolean switch contrary to how `-i' expects a number, I made the wrong assumption that it can only work for the first interface. "vmctl -Li2" configures two interfaces, one witch DHCP and one without. "vmctl -L -L" however configures two interfaces with DHCP IPs each. My second mistake was to imply analogue behaviour for the configuration. Now that you stated the obvious about `local' being per `interface' line, it makes absoloutely no sense to above mentioned behaviour for static VM definitions. Pointed out by tb
2020-02-15DHCP is configured on the first interface onlykn
A VM can have multiple interfaces, but only the first one gets DHCP if "-L" (vmctl) or "local" (vm.conf) is specified. Positive feedback Mike Larkin
2020-01-03vmctl(8): fix vmctl send exit codepd
vmctl send always returned exit code 1 Patch by Benjamin Baier ok kn@
2019-12-28Run cu(1) in restricted modekn
Users must not not be able to transfer files from the local hypervisor filesystem to VMs/LDOMs, especially since the "vmctl/ldomctl console ..." might be run as root. Disable all relevant escape sequences and cause cu to run under "stdio tty" pledge by using -r. OK deraadt mlarkin
2019-12-17Use local variable isntead of function parameterkn
The parse_size() wrapper around scan_scaled(3) writes its intermediate result to the function argument which is always passed as literal zero. This seems odd, the function parameter has no meaning but merely serves as storage, so let's use a proper function scoped variable instead. OK pd
2019-12-15Explicitly print root user in status OWNER columnkn
With "owner root:wheel" (any group) the status output prints ":wheel" only, presumably to emphasize that only group membership matters. Always print whatever is configured to be explicit and less confusing. OK jasper
2019-12-12vmd: start vms defined in vm.conf in a staggered fashionpd
This addresses 'thundering herd' problem when a lot of vms are configured in vm.conf. A lot of vms booting in parallel can overload the host and also mess up tsc calibration in openbsd guests as it uses PIT which doesn't fire reliably if the host is overloaded. We default to starting vms with parallelism of ncpuonline and a delay 30 seconds between batches. This is configurable in vm.conf. ok mlarkin@ (also addressed comments from cheloha@)
2019-10-27Require at least one interface with -ikn
Either a positive count is given or -i is omitted entirely; vm.conf(5) does not allow interface configuration that results in zero interfaces either. Raise the minimium count value to one and tell more about invalid counts with the usual strtonum(3) idiom. OK reyk
2019-09-15Use (egress) in nat-to examplekn
Without parentheses, this rule evaluates to the static list of addresses at loadtime; this can be a problem when the machine's network is not fully established when pf.conf is loaded. From pf.conf(5): When the interface name is surrounded by parentheses, the rule is automatically updated whenever the interface changes its address. The ruleset does not need to be reloaded. This is especially useful with NAT. This syncs vmctl(8) with the VMM FAQ. Pointed out by Matthias Schmidt, thanks!
2019-09-07Remove unused VMD_DISK_INVALID message type and mark it obsolete.tobhe
ok mlarkin@
2019-08-23vmctl(8): fix wrong output when using 'vmctl stop'Mike Larkin
Fix a wrong output when using 'vmctl stop' without any further arguments. Patch from Caspar Schutijser, thanks! ok deraadt
2019-08-14Improve the error message when supplying an invalid template to vmctlanton
start. Favoring 'invalid template' over 'permission denied' should give the user a better hint on what went wrong. ok kn@ mlarkin@
2019-08-08Fix a bunch of typos in various man pages.Frederic Cambus
2019-07-05zap an extra space in usage();Jason McIntyre
from alessandro gallo
2019-05-31zap trailing whitespace;Jason McIntyre
2019-05-29Change vmctl(8) syntax: command options before the disk/name/id argument.Reyk Floeter
vmctl had a CLI-style syntax (bgpctl-style) for a short time but I changed it back to a more suitable getopt syntax. I replaced the CLI tokens to getopts flags but didn't consider swapping the order of command options and arguments to be more UNIX-like again ("vmctl create disk.img size 10G" simply became "vmctl create disk.img -s 10G"). This changes "create", "start", and "stop" commands to the commonly expected syntax like "vmctl create -s 10G disk.img". Requested by many OK mlarkin@ kn@ solene@