Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | About

166.5. libvirt

166.5.1. virsh

$ 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]
		

例 166.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
			

166.5.1.1. console

			
# virsh list
 Id    Name                           State
----------------------------------------------------
 2     monitor                        running
			
# virsh console monitor
Connected to domain monitor
Escape character is ^]
			
			

Ctrl + ] 推出 console

166.5.1.2. dumpxml

dump 虛擬機配置檔案

virsh dumpxml Test
			

166.5.2. Virtual Machine Manager