Author: kaktus Date: Thu Jul 9 20:54:16 2020 New Revision: 363058 URL: https://svnweb.freebsd.org/changeset/base/363058
Log: MFC r362612 bhyve: allow for automatic destruction on power-off Modified: stable/12/usr.sbin/bhyve/bhyve.8 stable/12/usr.sbin/bhyve/bhyverun.c Modified: stable/12/usr.sbin/bhyve/bhyve.8 ============================================================================== --- stable/12/usr.sbin/bhyve/bhyve.8 Thu Jul 9 20:53:56 2020 (r363057) +++ stable/12/usr.sbin/bhyve/bhyve.8 Thu Jul 9 20:54:16 2020 (r363058) @@ -113,6 +113,8 @@ If a is specified more than once the last one has precedence. .It Fl C Include guest memory in core file. +.It Fl D +Destroy the VM on guest initiated power-off. .It Fl e Force .Nm Modified: stable/12/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/12/usr.sbin/bhyve/bhyverun.c Thu Jul 9 20:53:56 2020 (r363057) +++ stable/12/usr.sbin/bhyve/bhyverun.c Thu Jul 9 20:54:16 2020 (r363058) @@ -173,6 +173,7 @@ static int gdb_port = 0; static int guest_vmexit_on_hlt, guest_vmexit_on_pause; static int virtio_msix = 1; static int x2apic_mode = 0; /* default is xAPIC */ +static int destroy_on_poweroff = 0; static int strictio; static int strictmsr = 1; @@ -212,7 +213,7 @@ usage(int code) { fprintf(stderr, - "Usage: %s [-abehuwxACHPSWY]\n" + "Usage: %s [-abehuwxACDHPSWY]\n" " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" " %*s [-g <gdb port>] [-l <lpc>]\n" " %*s [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] <vm>\n" @@ -220,6 +221,7 @@ usage(int code) " -A: create ACPI tables\n" " -c: number of cpus and/or topology specification\n" " -C: include guest memory in core file\n" + " -D: destroy on power-off\n" " -e: exit on unhandled I/O access\n" " -g: gdb port\n" " -h: help\n" @@ -761,6 +763,8 @@ vmexit_suspend(struct vmctx *ctx, struct vm_exit *vmex case VM_SUSPEND_RESET: exit(0); case VM_SUSPEND_POWEROFF: + if (destroy_on_poweroff) + vm_destroy(ctx); exit(1); case VM_SUSPEND_HALT: exit(2); @@ -1021,7 +1025,7 @@ main(int argc, char *argv[]) rtc_localtime = 1; memflags = 0; - optstr = "abehuwxACHIPSWYp:g:G:c:s:m:l:U:"; + optstr = "abehuwxACDHIPSWYp:g:G:c:s:m:l:U:"; while ((c = getopt(argc, argv, optstr)) != -1) { switch (c) { case 'a': @@ -1032,6 +1036,9 @@ main(int argc, char *argv[]) break; case 'b': bvmcons = 1; + break; + case 'D': + destroy_on_poweroff = 1; break; case 'p': if (pincpu_parse(optarg) != 0) { _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"