$ sudo virsh -c qemu:///system list Id Name State ---------------------------------- 1 Ubuntu running 2 Ubuntu-Server running # virsh list Id Name State ---------------------------------------------------- 1 Ubuntu running 2 CentOS6.4 running
# virsh 顯示虛擬機列表: virsh # list --all 啟動虛擬機: virsh # start [name] 關閉虛擬機: virsh # shutdown [name] 重啟虛擬機: virsh # reboot [name] 指定虛擬機開機自動啟動: virsh # autostart [name]
例 29.1. virsh
virsh # list --all Id Name State ---------------------------------------------------- - CentOS6.4 shut off - FreeBSD shut off - Test shut off - Ubuntu shut off - www shut off virsh # start Ubuntu Domain Ubuntu started virsh # list --all Id Name State ---------------------------------------------------- 1 Ubuntu running - CentOS6.4 shut off - FreeBSD shut off - Test shut off - www shut off virsh # quit
# virsh list Id Name State ---------------------------------------------------- 2 monitor running # virsh console monitor Connected to domain monitor Escape character is ^]
Ctrl + ] 推出 console