5

如何列出从 hyperkit 启动的虚拟机?
hyperkit 帮助仅在下面:

hyperkit -h                                                                                                                             11:25:45
Usage: hyperkit [-behuwxMACHPWY] [-c vcpus] [-F <pidfile>] [-g <gdb port>] [-l <lpc>]
                [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] -f <fw>
       -A: create ACPI tables
       -c: # cpus (default 1)
       -C: include guest memory in core file
       -e: exit on unhandled I/O access
       -f: firmware
       -F: pidfile
       -g: gdb port
       -h: help
       -H: vmexit from the guest on hlt
       -l: LPC device configuration. Ex: -l com1,stdio -l com2,autopty -l com2,/dev/myownpty
       -m: memory size in MB, may be suffixed with one of K, M, G or T
       -M: print MAC address and exit if using vmnet
       -P: vmexit from the guest on pause
       -s: <slot,driver,configinfo> PCI slot config
       -u: RTC keeps UTC time
       -U: uuid
       -v: show build version
       -w: ignore unimplemented MSRs
       -W: force virtio to use single-vector MSI
       -x: local apic is in x2APIC mode
       -Y: disable MPtable generation

我不明白如何列出虚拟机。

4

1 回答 1

9

由于 hyperkit 只是“在应用程序中嵌入 hypervisor 功能的工具包”。它不提供直接管理虚拟机的工具。

您必须查看所有虚拟机的方式是:

$ ps -Af | grep hyperkit
0 35982     1   0  2:50PM ttys000    3:27.65 /usr/local/bin/hyperkit -A -u -F /Users/youruser/.minikube/machines/minikube/hyperkit.pid -c 2 -m 4000M -s 0:0,hostbridge -s 31,lpc -s 1:0,virtio-net -U 39c5590a-cdac-11ea-b300-acde48001122 -s 2:0,virtio-blk,/Users/youruser/.minikube/machines/minikube/minikube.rawdisk -s 3,ahci-cd,/Users/youruser/.minikube/machines/minikube/boot2docker.iso -s 4,virtio-rnd -l com1,autopty=/Users/youruser/.minikube/machines/minikube/tty,log=/Users/youruser/.minikube/machines/minikube/console-ring -f kexec,/Users/youruser/.minikube/machines/minikube/bzimage,/Users/youruser/.minikube/machines/minikube/initrd,earlyprintk=serial loglevel=3 console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 systemd.legacy_systemd_cgroup_controller=yes random.trust_cpu=on hw_rng_model=virtio base host=minikube

如果您在前面的命令中看到“-l”标志和可用的 tty 像这样“ -l com1,autopty=/Users/youruser/.minikube/machines/minikube/tty”,您可能可以打开一个串行 tty,如如何查看在 Docker 中运行的所有 minikube 集群的列表在我的 Mac 上?

$ sudo screen /Users/youruser/.minikube/machines/minikube/tty
Welcome to minikube
minikube login: root
                         _             _
            _         _ ( )           ( )
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

# docker ps
...  <== shows a bunch of K8s containers
于 2020-07-24T13:44:21.437 回答