系统版本
[root@desktop2 ~]# cat /proc/version
Linux version 2.6.32-220.el6.x86_64 ([email protected]) (gcc version 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC) ) #1 SMP Wed Nov 9 08:03:13 EST 2011
[root@desktop2 ~]#
为虚拟机创建快照
生成新的uuid
[root@desktop2 ~]# uuidgen
1440f78a-3f93-4a84-be09-bef93c3188e3
导出vserver虚拟机的配置信息,并修改4处客户化信息
[root@desktop2 ~]# virsh dumpxml vserver > /tmp/vserver2.xml
[root@desktop2 ~]# vim /tmp/vserver2.xml
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit vserver2
or other application using the libvirt API.
-->
<domain type='kvm'>
<name>vserver2</name>
<uuid>1440f78a-3f93-4a84-be09-bef93c3188e3</uuid>
<memory>2097152</memory>
<currentMemory>1048576</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='x86_64' machine='rhel6.2.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='block' device='disk'>
<driver name='qemu' type='raw' cache='none' io='native'/>
<source dev='/dev/vol0/vserver2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:00:00:02'/>
<source bridge='br0'/>
<model type='virtio'/>
<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'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
</devices>
</domain>
[root@desktop2 ~]#
生成克隆虚拟机
[root@desktop2 ~]# virsh define /tmp/vserver2.xml
Domain vserver2 defined from /tmp/vserver2.xml
启动克隆虚拟机
[root@desktop2 ~]# virsh start vserver2
Domain vserver2 started
[root@desktop2 ~]# virsh list
Id Name State
----------------------------------
3 vserver2 running