[root@idca-vm02 ~]# virsh listhtml
Id 名稱 狀態node
----------------------------------------------------api
2 idca-bankccb-b2c-45 running網絡
4 idca-bankicbc-42-clone runningdom
6 idca_rhel5_con29_6.29 runningide
7 idca_w03_bkccb_b2b_101 running性能
10 idca_w03_bkicbc_b2b_102 runningui
16 idca-bankcncb-44 running.net
18 idca_w03_bkcmb_b2b_105 runningrest
20 idca_w03_bkpab_87 running
32 idca_w03_bkcomm_b2b_103 running
34 idca-bankhxb-43 running
38 idca_rhel5_con23_6.23_new running
43 idca_w03_bkpab_dk_6.88 running
[root@idca-vm02 ~]# virsh list --all
Id 名稱 狀態
----------------------------------------------------
2 idca-bankccb-b2c-45 running
4 idca-bankicbc-42-clone running
6 idca_rhel5_con29_6.29 running
7 idca_w03_bkccb_b2b_101 running
10 idca_w03_bkicbc_b2b_102 running
16 idca-bankcncb-44 running
18 idca_w03_bkcmb_b2b_105 running
20 idca_w03_bkpab_87 running
32 idca_w03_bkcomm_b2b_103 running
34 idca-bankhxb-43 running
38 idca_rhel5_con23_6.23_new running
43 idca_w03_bkpab_dk_6.88 running
- idca_rhel5_con23_6.23 關閉
- idca_w03_mod 關閉
virsh edit idca-bankcncb-44
xml文件內容以下:
[root@idca-vm02 ~]# virsh edit idca-bankcncb-44
<domain type='kvm'>
<name>idca-bankcncb-44</name>
<uuid>17d9c1a2-a34d-6b7a-88ff-e96412bbdda5</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='rhel6.5.0'>hvm</type>
<boot dev='hd'/>
</os>
<domain type='kvm'>
<name>idca-bankcncb-44</name>
<uuid>17d9c1a2-a34d-6b7a-88ff-e96412bbdda5</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='rhel6.5.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/kvmfs/vmfspool/idca-bankicbc-42_vd1-clone-clone-5.img'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/kvmfs/vmfspool/idca-bankicbc-42_vd2-clone-clone-5.img'/>
<target dev='hdb' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:38:b0:3b'/>
<source bridge='br0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
virsh start idca-bankhxb-43
virsh shutdown idca-bankhxb-43
virsh suspend idca-bankhxb-43
virsh destrory(stop) idca-bankhxb-43
qemu-img convert -O raw idca-bankcncb-62.qcow2 idca-bankcncb-62.img
virt-clone -o idca-bankccb-b2c-45 -n idca-bankccb-b2c-45_20170515bak -f ./idca-bankccb-b2c-45_20170515bak.img
參考:http://www.cnblogs.com/beanmoon/p/4673525.html
[root@idca-vm02 ~]# virsh help
Grouped commands:
Domain Management (help keyword 'domain'):
attach-device 從一個XML文件附加裝置
attach-disk 附加磁盤設備
attach-interface 得到網絡界面
autostart 自動開始一個域
blkdeviotune Set or query a block device I/O tuning parameters.
blkiotune Get or set blkio parameters
blockcommit Start a block commit operation.
blockcopy Start a block copy operation.
blockjob Manage active block operations
blockpull Populate a disk from its backing image.
blockresize Resize block device of domain.
change-media Change media of CD or floppy drive
console 鏈接到客戶會話
cpu-baseline compute baseline CPU
cpu-compare compare host CPU with a CPU described by an XML file
cpu-stats show domain cpu statistics
create 從一個 XML 文件建立一個域
define 從一個 XML 文件定義(但不開始)一個域
desc show or set domain's description or title
destroy destroy (stop) a domain
detach-device 從一個 XML 文件分離設備
detach-disk 分離磁盤設備
detach-interface 分離網絡界面
domdisplay domain display connection URI
domhostname print the domain's hostname
domid 把一個域名或 UUID 轉換爲域 id
domif-setlink set link state of a virtual interface
domiftune get/set parameters of a virtual interface
domjobabort abort active domain job
domjobinfo domain job information
domname 將域 id 或 UUID 轉換爲域名
dompmsuspend suspend a domain gracefully using power management functions
dompmwakeup wakeup a domain from pmsuspended state
domuuid 把一個域名或 id 轉換爲域 UUID
domxml-from-native Convert native config to domain XML
domxml-to-native Convert domain XML to native config
dump 把一個域的內核 dump 到一個文件中以方便分析
dumpxml XML 中的域信息
edit 編輯某個域的 XML 配置
inject-nmi Inject NMI to the guest
send-key Send keycodes to the guest
managedsave managed save of a domain state
managedsave-remove Remove managed save of a domain
maxvcpus connection vcpu maximum
memtune Get or set memory parameters
migrate 將域遷移到另外一個主機中
migrate-setmaxdowntime set maximum tolerable downtime
migrate-setspeed Set the maximum migration bandwidth
migrate-getspeed Get the maximum migration bandwidth
numatune Get or set numa parameters
reboot 從新啓動一個域
reset reset a domain
restore 從一個存在一個文件中的狀態恢復一個域
resume 從新恢復一個域
save 把一個域的狀態保存到一個文件
save-image-define redefine the XML for a domain's saved state file
save-image-dumpxml saved state domain information in XML
save-image-edit edit XML for a domain's saved state file
schedinfo 顯示/設置日程安排變量
screenshot take a screenshot of a current domain console and store it into a file
setmaxmem 改變最大內存限制值
setmem 改變內存的分配
setvcpus 改變虛擬 CPU 的號
shutdown 關閉一個域
start 開始一個(之前定義的)非活躍的域
suspend 掛起一個域
ttyconsole tty 控制檯
undefine undefine a domain
update-device update device from an XML file
vcpucount domain vcpu counts
vcpuinfo detailed domain vcpu information
vcpupin control or query domain vcpu affinity
emulatorpin control or query domain emulator affinity
vncdisplay vnc 顯示
Domain Monitoring (help keyword 'monitor'):
domblkerror Show errors on block devices
domblkinfo domain block device size information
domblklist list all domain blocks
domblkstat 得到域設備塊狀態
domcontrol domain control interface state
domif-getlink get link state of a virtual interface
domiflist list all domain virtual interfaces
domifstat 得到域網絡接口狀態
dominfo 域信息
dommemstat get memory statistics for a domain
domstate 域狀態
list 列出域
Host and Hypervisor (help keyword 'host'):
capabilities 性能
freecell NUMA可用內存
hostname 打印管理程序主機名
node-memory-tune Get or set node memory parameters
nodecpustats Prints cpu stats of the node.
nodeinfo 節點信息
nodememstats Prints memory stats of the node.
nodesuspend suspend the host node for a given time duration
qemu-attach QEMU Attach
qemu-monitor-command QEMU Monitor Command
qemu-agent-command QEMU Guest Agent Command
sysinfo print the hypervisor sysinfo
uri 打印管理程序典型的URI
version 顯示版本
Interface (help keyword 'interface'):
iface-begin create a snapshot of current interfaces settings, which can be later committed (iface-commit) or restored (iface-rollback)
iface-bridge create a bridge device and attach an existing network device to it
iface-commit commit changes made since iface-begin and free restore point
iface-define define (but don't start) a physical host interface from an XML file
iface-destroy destroy a physical host interface (disable it / "if-down")
iface-dumpxml interface information in XML
iface-edit edit XML configuration for a physical host interface
iface-list list physical host interfaces
iface-mac convert an interface name to interface MAC address
iface-name convert an interface MAC address to interface name
iface-rollback rollback to previous saved configuration created via iface-begin
iface-start start a physical host interface (enable it / "if-up")
iface-unbridge undefine a bridge device after detaching its slave device
iface-undefine undefine a physical host interface (remove it from configuration)
Network Filter (help keyword 'filter'):
nwfilter-define define or update a network filter from an XML file
nwfilter-dumpxml network filter information in XML
nwfilter-edit edit XML configuration for a network filter
nwfilter-list list network filters
nwfilter-undefine undefine a network filter
Networking (help keyword 'network'):
net-autostart 自動開始網絡
net-create 從一個 XML 文件建立一個網絡
net-define 從一個 XML 文件定義(但不開始)一個網絡
net-destroy destroy (stop) a network
net-dumpxml XML 中的網絡信息
net-edit 爲網絡編輯 XML 配置
net-info network information
net-list 列出網絡
net-name 把一個網絡UUID 轉換爲網絡名
net-start 開始一個(之前定義的)不活躍的網絡
net-undefine 取消定義一個非活躍的網絡
net-update update parts of an existing network's configuration
net-uuid 把一個網絡名轉換爲網絡UUID
Node Device (help keyword 'nodedev'):
nodedev-create create a device defined by an XML file on the node
nodedev-destroy destroy (stop) a device on the node
nodedev-detach detach node device from its device driver
nodedev-dumpxml XML 中的節點設備詳情
nodedev-list 這臺主機中中的枚舉設備
nodedev-reattach reattach node device to its device driver
nodedev-reset 重置節點設備
Secret (help keyword 'secret'):
secret-define define or modify a secret from an XML file
secret-dumpxml secret attributes in XML
secret-get-value Output a secret value
secret-list list secrets
secret-set-value set a secret value
secret-undefine undefine a secret
Snapshot (help keyword 'snapshot'):
snapshot-create Create a snapshot from XML
snapshot-create-as Create a snapshot from a set of args
snapshot-current Get or set the current snapshot
snapshot-delete Delete a domain snapshot
snapshot-dumpxml Dump XML for a domain snapshot
snapshot-edit edit XML for a snapshot
snapshot-info snapshot information
snapshot-list List snapshots for a domain
snapshot-parent Get the name of the parent of a snapshot
snapshot-revert Revert a domain to a snapshot
Storage Pool (help keyword 'pool'):
find-storage-pool-sources-as 找到潛在存儲池源
find-storage-pool-sources 發現潛在存儲池源
pool-autostart 自動啓動某個池
pool-build 創建池
pool-create-as 從一組變量中建立一個池
pool-create 從一個 XML 文件中建立一個池
pool-define-as 在一組變量中定義池
pool-define 在一個 XML 文件中定義(但不啓動)一個池
pool-delete 刪除池
pool-destroy destroy (stop) a pool
pool-dumpxml XML 中的池信息
pool-edit 爲存儲池編輯 XML 配置
pool-info 存儲池信息
pool-list 列出池
pool-name 將池 UUID 轉換爲池名稱
pool-refresh 刷新池
pool-start 啓動一個(之前定義的)非活躍的池
pool-undefine 取消定義一個不活躍的池
pool-uuid 把一個池名稱轉換爲池 UUID
Storage Volume (help keyword 'volume'):
vol-clone clone a volume.
vol-create-as 從一組變量中建立卷
vol-create 從一個 XML 文件建立一個卷
vol-create-from create a vol, using another volume as input
vol-delete 刪除卷
vol-download Download a volume to a file
vol-dumpxml XML 中的卷信息
vol-info 存儲卷信息
vol-key returns the volume key for a given volume name or path
vol-list 列出卷
vol-name returns the volume name for a given volume key or path
vol-path returns the volume path for a given volume name or key
vol-pool returns the storage pool for a given volume key or path
vol-resize resize a vol
vol-upload upload a file into a volume
vol-wipe wipe a vol
Virsh itself (help keyword 'virsh'):
cd change the current directory
connect 鏈接(從新鏈接)到 hypervisor
echo echo arguments
exit 退出這個非交互式終端
help 打印幫助
pwd print the current directory
quit 退出這個非交互式終端
# http://blog.csdn.net/bravezhe/article/details/8461386
#kvm搭建http://blog.csdn.net/bravezhe/article/details/8461700
#虛擬機修更名字http://blog.sina.com.cn/s/blog_5d867af10101c3by.html