libvirt build snapshot and basic usage


If you use qemu's snapshot method to operate
in the monitor
(qemu)savevm my_tag


Scp both bzImage and hda.qcow2 to 83
Start the qemu command as above,
in the monitor
(qemu)loadvm my_tag


View all and few snapshots
(qemu) info snapshots

######################################################################################################################################################################################################################################################################################################################################################################
_

One disk
qemu-img create -f qcow2 sarge.img 100G
qemu-img amend -f qcow2 -o compat=0.10 sarge.img

Create a virtual machine:
virt-install --name=sarge --ram 1024 --vcpus=2 -f /home/hao/sarge.img --cdrom /home/debian-31r8-i386-netinst.iso  --graphics vnc,listen=0.0.0.0,port=5980,password='123456',keymap='en-us' --network bridge=br0  --force  --autostart


virsh capabilities
to see the network card
virsh domiflist sarge
network card status
virsh domifstat sarge vnet9
to see the disk
virsh domblklist sarge

raw format to qcow2 format, qcow2 can create a snapshot
qemu-img convert -f raw -O qcow2 sarge.img sarge.qcow2

qemu-img info sarge. img view snapshot list virsh snapshot-list sarge create snapshot virsh snapshot-create-as --domain sarge kuaizhao1 --description "URL:sarge" restore snapshot virsh snapshot-revert sarge kuaizhao1 delete snapshot virsh snapshot-delete sarge kuaizhao1 view snapshot configuration File cat /var/lib/libvirt/qemu/snapshot/sarge/kuaizhao1.xml Basic command: start virsh start sarge close




















virsh shutdown sarge
restart
virsh reboot sarge
power off
virsh destroy sarge
suspend
virsh suspend sarge
resume suspend
virsh resume sarge

refer to
http://card.weibo.com/article/h5/s#cid=2304184b97332d0102x2u8&from=1063193010&wm=3333_2001&ip=59.172. 141.195

qemu-system-i386 -kernel bzImage -drive file=hda.img,if=ide,cache=none -append "console=ttyS0 root=/dev/sda rw rdinit=/sbin/init notsc=1"  -boot order=dc,menu=on -net nic,vlan=0,macaddr=52:54:00:12:34:22,model=e1000,addr=08 -net tap,name=haha,ifname=tap1,script=no,downscript=no -vnc 0.0.0.0:1


Decompressing
Linux... Parsing ELF... No relocation needed... done. Booting
the kernel. Monitor ctrol+alt 3 displayed by

ctrol+alt 2 on the vnc interface and linux ctrol+alt 4  displayed after startup






Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326667062&siteId=291194637