我有一个虚拟机启动了TripleOOpenStack 的安装脚本。我可以使用 vncviewer 连接到 VM 控制台。问题是 VM 未列出virsh
。
$ sudo virsh list --all
Id Name State
----------------------------------------------------
$ ps -edf |grep qemu
stack 6451 1 30 Sep24 ? 04:29:15 /usr/libexec/qemu-kvm -name undercloud -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off,dump-guest-core=off -cpu Opteron_G3,+vme,+ht,+mmxext,+fxsr_opt,+pdpe1gb,+3dnowext,+3dnow,+cmp_legacy,+extapic,+cr8legacy,+3dnowprefetch,+osvw,+ibs,+skinit,+wdt,+nodeid_msr,-avx,-avx2 -m 12288 -realtime mlock=off -smp 6,sockets=6,cores=1,threads=1 -uuid 7c9db9d9-846f-480a-aefd-608eb257c379 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/home/stack/.config/libvirt/qemu/lib/domain-1-undercloud/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -boot menu=off,strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/home/stack/pool/undercloud.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=24,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:04:31:27:f2:40,bus=pci.0,addr=0x3 -netdev tap,fd=25,id=hostnet1 -device virtio-net-pci,netdev=hostnet1,id=net1,mac=00:04:31:27:f2:3e,bus=pci.0,addr=0x4 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -vnc 127.0.0.1:0 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -msg timestamp=on
root 10232 20111 0 10:32 pts/0 00:00:00 grep --color=auto qemu
$
答案1
journalctl -b
我在ansible写入的日志中发现ansible virt 模块是通过 调用的uri=qemu:///session
。这意味着 VM 以stack
用户身份启动,并且仅由该用户可见和管理。
以下链接解释了qemu:///system
和qemu:///session
URI 之间的区别:http://blog.wikichoon.com/2016/01/qemusystem-vs-qemusession.html
要查看我的虚拟机,我需要运行:
$ sudo -u stack -i virsh list --all
Id Name State
----------------------------------------------------
1 undercloud running
8 control_0 running
9 compute_0 running
$