To answer my own question about restarting VMs that have stopped or were
disabled in vm.conf:

If you do a vmctl reload as root, it will restart any VMs that are no
longer running but are defined and enabled in /etc/vm.conf. It also looks
as if removing the "disabled" flag from a record in vm.conf and then doing
a reload will start a previously disabled VM.
using "vmctl load ${configfile}" is also handy for creating one-off
configuration clauses for VMs you want to start ad-hoc.

I'm still trying to figure out how VM ownership works.

On Fri, Apr 14, 2017 at 11:00 PM, Ax0n <[email protected]> wrote:

> First: Great work, everyone. Tons of ground got covered.
>
> vmm seems to not be respecting the "owner" directive until after I shut
> the VMs down. It's completely plausible I'm doing something wrong. I
> haven't messed with vmm in -CURRENT since mid-January. I'm using
> 6.1-RELEASE right now.
>
> On the host end, I have dhcpd listening on vether0  and the most basic of
> pf NAT configured. Honestly, I'm okay running these as root. This is just
> my personal laptop with some VMs for testing Apache/MySQL apps and new
> snapshots. Using doas(8) I can connect to any of the consoles.
>
> Also, is there a way to re-start a defined VM by its vm.conf definition
> without restarting vmd, and/or start up a VM that's marked as disabled in
> vm.conf?
>
> Log and dmesg follows.
>
> $ id
> uid=1000(axon) gid=1000(axon) groups=1000(axon), 0(wheel)
> $ vmctl status
>    ID   PID VCPUS  MAXMEM  CURMEM     TTY        OWNER NAME
>     2  4096     1    128M    122M   ttyp1         root OBSDSnap64.vm
>     1 12592     1    128M    128M   ttyp0         root OBSD61.vm
> $ vmctl console 1
> cu: open("/dev/ttyp0"): Permission denied
> $ cat /etc/vm.conf
> # bridge0 for VMs, NAT and dhcpd
> switch "local" {
>         add vether0
>         up
> }
>
> # OpenBSD 6.1
> vm "OBSD61.vm" {
>         owner axon
>         memory 128M
>         disk "/home/axon/vmm/obsd61.img"
>         interface {
>                 switch "local"
>                 lladdr fe:e1:ba:d0:eb:ab
>         }
> }
>
> # OpenBSD amd64 Snapshot
> vm "OBSDSnap64.vm" {
>         owner axon
>         memory 128M
>         disk "/home/axon/vmm/obsd-snap64.img"
>         interface {
>                 switch "local"
>                 lladdr fe:e1:ba:d0:eb:ac
>         }
> }
>
> $ ssh 10.13.37.200
> [email protected]'s password:
> Last login: Fri Apr 14 22:11:40 2017 from 10.13.37.1
> OpenBSD 6.1 (GENERIC) #19: Sat Apr  1 13:42:46 MDT 2017
>
> Welcome to OpenBSD: The proactively secure Unix-like operating system.
>
> Please use the sendbug(1) utility to report bugs in the system.
> Before reporting a bug, please try to reproduce it with the latest
> version of the code.  With bug reports, please try to ensure that
> enough information to reproduce the problem is enclosed, and if a
> known fix for it exists, include that as well.
>
> $ doas halt -p
> Connection to 10.13.37.200 closed by remote host.
> Connection to 10.13.37.200 closed.
> $ vmctl status # after waiting 30 seconds or so for the VM to clean up...
>    ID   PID VCPUS  MAXMEM  CURMEM     TTY        OWNER NAME
>     2  4096     1    128M    122M   ttyp1         root OBSDSnap64.vm
>     -     -     1    128M       -       -         axon OBSD61.vm
>
> ## Now I'm the proud owner of a halted vm. :D
>
> $ doas vmctl console 2
> Connected to /dev/ttyp1 (speed 9600)
>
>
> OpenBSD/amd64 (deepthought.labs.h-i-r.net) (tty00)
>
> login:
>
> [EOT]
>
> $ dmesg
> OpenBSD 6.1 (GENERIC.MP) #20: Sat Apr  1 13:45:56 MDT 2017
>     [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> RTC BIOS diagnostic error 80<clock_battery>
> real mem = 8227655680 (7846MB)
> avail mem = 7973625856 (7604MB)
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xe9d90 (47 entries)
> bios0: vendor Acer version "V1.07" date 11/07/2011
> bios0: Acer Aspire 5733Z
> acpi0 at bios0: rev 2
> acpi0: sleep states S0 S3 S4 S5
> acpi0: tables DSDT FACP ASF! HPET APIC MCFG SLIC BOOT ASPT DMAR SSDT SSDT
> SSDT
> acpi0: wakeup devices AZAL(S3) P0P1(S4) EHC1(S3) USB1(S3) USB2(S3)
> USB3(S3) USB4(S3) USB5(S3) USB6(S3) USB7(S3) RP01(S4) PEG5(S4)
> acpitimer0 at acpi0: 3579545 Hz, 24 bits
> acpihpet0 at acpi0: 14318179 Hz
> acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
> cpu0 at mainbus0: apid 0 (boot processor)
> cpu0: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2527.84 MHz
> cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,
> CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,
> PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,
> CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,RDTSCP,
> LONG,LAHF,PERF,ITSC,SENSOR,ARAT
> cpu0: 256KB 64b/line 8-way L2 cache
> cpu0: TSC frequency 2527838640 <(252)%20783-8640> Hz
> cpu0: smt 0, core 0, package 0
> mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
> cpu0: apic clock running at 133MHz
> cpu0: mwait min=64, max=64, C-substates=0.2.1.1, IBE
> cpu1 at mainbus0: apid 1 (application processor)
> cpu1: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2527.44 MHz
> cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,
> CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,
> PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,
> CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,RDTSCP,
> LONG,LAHF,PERF,ITSC,SENSOR,ARAT
> cpu1: 256KB 64b/line 8-way L2 cache
> cpu1: smt 1, core 0, package 0
> cpu2 at mainbus0: apid 4 (application processor)
> cpu2: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2527.44 MHz
> cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,
> CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,
> PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,
> CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,RDTSCP,
> LONG,LAHF,PERF,ITSC,SENSOR,ARAT
> cpu2: 256KB 64b/line 8-way L2 cache
> cpu2: smt 0, core 2, package 0
> cpu3 at mainbus0: apid 5 (application processor)
> cpu3: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2527.44 MHz
> cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,
> CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,
> PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,
> CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,RDTSCP,
> LONG,LAHF,PERF,ITSC,SENSOR,ARAT
> cpu3: 256KB 64b/line 8-way L2 cache
> cpu3: smt 1, core 2, package 0
> ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins
> acpimcfg0 at acpi0 addr 0xe0000000, bus 0-255
> acpiprt0 at acpi0: bus 0 (PCI0)
> acpiprt1 at acpi0: bus -1 (P0P2)
> acpiprt2 at acpi0: bus 3 (P0P1)
> acpiprt3 at acpi0: bus 1 (RP01)
> acpiprt4 at acpi0: bus 2 (RP02)
> acpiprt5 at acpi0: bus -1 (RP03)
> acpiprt6 at acpi0: bus -1 (RP04)
> acpiprt7 at acpi0: bus -1 (RP05)
> acpiprt8 at acpi0: bus -1 (RP06)
> acpiprt9 at acpi0: bus -1 (RP07)
> acpiprt10 at acpi0: bus -1 (RP08)
> acpiprt11 at acpi0: bus -1 (PEG5)
> acpiec0 at acpi0
> acpicpu0 at acpi0: C3(350@245 mwait.3@0x20), C1(1000@3 mwait.1), PSS
> acpicpu1 at acpi0: C3(350@245 mwait.3@0x20), C1(1000@3 mwait.1), PSS
> acpicpu2 at acpi0: C3(350@245 mwait.3@0x20), C1(1000@3 mwait.1), PSS
> acpicpu3 at acpi0: C3(350@245 mwait.3@0x20), C1(1000@3 mwait.1), PSS
> "pnp0c14" at acpi0 not configured
> acpibat0 at acpi0: BAT0 model "Li_Ion_4000mA " serial 716a type Lion oem
> "SANYO "
> acpiac0 at acpi0: AC unit online
> acpibtn0 at acpi0: PWRB
> acpibtn1 at acpi0: LID0
> acpibtn2 at acpi0: SLPB
> "PNP0303" at acpi0 not configured
> "ETD0500" at acpi0 not configured
> "PNP0C14" at acpi0 not configured
> "PNP0C14" at acpi0 not configured
> acpivideo0 at acpi0: GFX0
> acpivout0 at acpivideo0: DD03
> acpivideo1 at acpi0: VGA_
> cpu0: Enhanced SpeedStep 2527 MHz: speeds: 2533, 2399, 2266, 2133, 1999,
> 1866, 1733, 1599, 1466, 1333, 1199 MHz
> pci0 at mainbus0 bus 0
> pchb0 at pci0 dev 0 function 0 "Intel Core Host" rev 0x02
> inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics" rev 0x02
> drm0 at inteldrm0
> intagp0 at inteldrm0
> agp0 at intagp0: aperture at 0xc0000000, size 0x10000000
> inteldrm0: msi
> inteldrm0: 1366x768, 32bpp
> wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
> wsdisplay0: screen 1-5 added (std, vt100 emulation)
> "Intel 3400 MEI" rev 0x06 at pci0 dev 22 function 0 not configured
> ehci0 at pci0 dev 26 function 0 "Intel 3400 USB" rev 0x05: apic 2 int 16
> usb0 at ehci0: USB revision 2.0
> uhub0 at usb0 configuration 1 interface 0 "Intel EHCI root hub" rev
> 2.00/1.00 addr 1
> azalia0 at pci0 dev 27 function 0 "Intel 3400 HD Audio" rev 0x05: msi
> azalia0: codecs: Realtek ALC272
> audio0 at azalia0
> ppb0 at pci0 dev 28 function 0 "Intel 3400 PCIE" rev 0x05: msi
> pci1 at ppb0 bus 1
> bge0 at pci1 dev 0 function 0 "Broadcom BCM57780" rev 0x01, BCM57780 A1
> (0x57780001): msi, address dc:0e:a1:91:7a:b9
> brgphy0 at bge0 phy 1: BCM57780 10/100/1000baseT PHY, rev. 1
> ppb1 at pci0 dev 28 function 1 "Intel 3400 PCIE" rev 0x05: msi
> pci2 at ppb1 bus 2
> athn0 at pci2 dev 0 function 0 "Atheros AR9285" rev 0x01: apic 2 int 17
> athn0: AR9285 rev 2 (1T1R), ROM rev 13, address 00:25:d3:f4:f8:4b
> ehci1 at pci0 dev 29 function 0 "Intel 3400 USB" rev 0x05: apic 2 int 23
> usb1 at ehci1: USB revision 2.0
> uhub1 at usb1 configuration 1 interface 0 "Intel EHCI root hub" rev
> 2.00/1.00 addr 1
> ppb2 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0xa5
> pci3 at ppb2 bus 3
> pcib0 at pci0 dev 31 function 0 "Intel HM55 LPC" rev 0x05
> ahci0 at pci0 dev 31 function 2 "Intel 3400 AHCI" rev 0x05: msi, AHCI 1.3
> ahci0: port 0: 3.0Gb/s
> ahci0: port 1: 1.5Gb/s
> scsibus1 at ahci0: 32 targets
> sd0 at scsibus1 targ 0 lun 0: <ATA, SanDisk SDSSDA12, Z320> SCSI3 0/direct
> fixed naa.5001b444a668bf8d
> sd0: 114473MB, 512 bytes/sector, 234441648 sectors, thin
> cd0 at scsibus1 targ 1 lun 0: <HL-DT-ST, DVDRAM GT51N, 1.00> ATAPI 5/cdrom
> removable
> ichiic0 at pci0 dev 31 function 3 "Intel 3400 SMBus" rev 0x05: apic 2 int
> 19
> iic0 at ichiic0
> spdmem0 at iic0 addr 0x50: 4GB DDR3 SDRAM PC3-10600 SO-DIMM
> spdmem1 at iic0 addr 0x52: 4GB DDR3 SDRAM PC3-10600 SO-DIMM
> itherm0 at pci0 dev 31 function 6 "Intel 3400 Thermal" rev 0x05
> isa0 at pcib0
> isadma0 at isa0
> pckbc0 at isa0 port 0x60/5 irq 1 irq 12
> pckbd0 at pckbc0 (kbd slot)
> wskbd0 at pckbd0: console keyboard, using wsdisplay0
> pms0 at pckbc0 (aux slot)
> wsmouse0 at pms0 mux 0
> pms0: Elantech Touchpad, version 2, firmware 0x40213
> pcppi0 at isa0 port 0x61
> spkr0 at pcppi0
> pci4 at mainbus0 bus 255
> pchb1 at pci4 dev 0 function 0 "Intel QuickPath" rev 0x02
> pchb2 at pci4 dev 0 function 1 "Intel QuickPath" rev 0x02
> pchb3 at pci4 dev 2 function 0 "Intel QPI Link" rev 0x02
> pchb4 at pci4 dev 2 function 1 "Intel QPI Physical" rev 0x02
> pchb5 at pci4 dev 2 function 2 "Intel Reserved" rev 0x02
> pchb6 at pci4 dev 2 function 3 "Intel Reserved" rev 0x02
> vmm0 at mainbus0: VMX/EPT
> uhub2 at uhub0 port 1 configuration 1 interface 0 "Intel Rate Matching
> Hub" rev 2.00/0.00 addr 2
> uvideo0 at uhub2 port 1 configuration 1 interface 0 "SuYin 1.3M HD WebCam"
> rev 2.00/1.02 addr 3
> video0 at uvideo0
> umass0 at uhub2 port 2 configuration 1 interface 0 "Generic USB2.0-CRW"
> rev 2.00/38.82 addr 4
> umass0: using SCSI over Bulk-Only
> scsibus2 at umass0: 2 targets, initiator 0
> sd1 at scsibus2 targ 1 lun 0: <Generic-, Multi-Card, 1.00> SCSI0 0/direct
> removable serial.0bda0138516388200000
> uhub3 at uhub1 port 1 configuration 1 interface 0 "Intel Rate Matching
> Hub" rev 2.00/0.00 addr 2
> vscsi0 at root
> scsibus3 at vscsi0: 256 targets
> softraid0 at root
> scsibus4 at softraid0: 256 targets
> sd2 at scsibus4 targ 1 lun 0: <OPENBSD, SR CRYPTO, 006> SCSI2 0/direct
> fixed
> sd2: 114470MB, 512 bytes/sector, 234435953 sectors
> root on sd2a (a4380b2f3d86c7ab.a) swap on sd2b dump on sd2b

Reply via email to