一、虚拟机配置文件:/etc/libvirt/qemu/
每个KVM虚拟主机都有自己的配置文件,都是以虚拟主机名命名;KVM虚拟机的配置文件在/etc/libvirt/qemu/下,以xml文件形式存在;
[root@node3 qemu]# virsh list --all #显示虚拟主机列表Id Name State
----------------------------------------------------3 centos7.0 running[root@node3 qemu]# ls #查看KVM虚拟机配置文件信息
centos7.0.xml networks [root@node3 qemu]# virsh dominfo centos7.0 #查看centos7.0信息
Id: 3
Name: centos7.0
UUID: 7e704227-6c82-4963-8b38-6c7065d0c722
OS Type: hvm
State: running
CPU(s): 1
CPU time: 260.9s
Max memory: 1048576 KiB
Used memory: 1048576 KiB
Persistent: yes
Autostart: enable
Managed save: no
Security model: none
Security DOI: 0[root@node3 qemu]# virsh autostart centos7.0 #设置centos7.0开机自启
Domain centos7.0 marked as autostarted
[root@node3 qemu]# ls
autostart centos7.0.xml networks #autostart 开机自启目录
[root@node3 qemu]# virsh edit centos7.0 #编辑虚拟机centos7.0配置文件,调用vi
[root@node3 qemu]# export EDITOR=vim #设置virsh edit 高亮显示
[root@node3 qemu]virsh dumpxml centos7.0 > centos7.0.bak #备份centos7.0虚拟主机配置文件。
二、虚拟机网络配置文件:/etc/libvirt/qemu/networks
[root@node3 qemu]# virsh net-list --all #查看网络信息Name State Autostart Persistent
----------------------------------------------------------default active yes yes[root@node3 qemu]# virsh --help |grep list #相关list列表domblklist list all domain blocksdomiflist list all domain virtual interfaceslist list domainsiface-list list physical host interfacesnwfilter-list list network filtersnet-list list networksnodedev-list enumerate devices on this hostsecret-list list secretssnapshot-list List snapshots for a domainpool-list list poolsvol-list list vols[root@node3 networks]# virsh net-edit default #编辑网络文件
<network><name>default</name><uuid>8e7a52c9-2051-4cad-bc50-93c13008ec0e</uuid><forward mode='nat'/><bridge name='virbr0' stp='on' delay='0'/><mac address='52:54:00:d2:7f:67'/><ip address='192.168.122.1' netmask='255.255.255.0'><dhcp><range start='192.168.122.2' end='192.168.122.254'/></dhcp></ip>
</network>
~
三、虚拟机存储配置文件:/etc/libvirt/storage/
[root@node3 networks]# ll /etc/libvirt/storage/
total 12
drwxr-xr-x 2 root root 52 Aug 16 21:12 autostart
-rw------- 1 root root 531 Aug 16 21:11 dd.xml
-rw------- 1 root root 538 Aug 16 02:29 default.xml
-rw------- 1 root root 514 Aug 16 21:12 root.xml[root@node3 networks]# virsh pool-list --all #显示存储列表Name State Autostart
-------------------------------------------dd active yes default active yes root active yes [root@node3 networks]# virsh pool-edit default #编辑存储配置文件
四、 镜像文件[磁盘文件]:/var/lib/libvirt/images/