Table of Contents

KVM/Qemu recipes

I'm just copying and pasting stuffs I want to keep around. Maybe sometime I will write an article on this.

sources:

- Do a snapshot of a VM

$ virsh -c qemu:///system
Welcome to virsh, the virtualization interactive terminal.
 
Type:  'help' for help with commands
       'quit' to quit
 
virsh # list
 Id Name                 State
----------------------------------
  1 centos_gln           running
 
virsh # save 1 /home/jvehent/Documents/GLN/kvm/centos_gln.img.snapshot.1300806811
Domain 1 saved to /home/jvehent/Documents/GLN/kvm/centos_gln.img.snapshot.1300806811

- Create a new network

Fedora doesn't come with a predefined network. Virsh can be used to create one prior to creating new virtual machines.

First, create the following file in /etc/libvirt/qemu/networks/default.xml:

<network>
  <name>default</name>
  <uuid>a9378609-10a3-400c-a0fd-6bea10567db6</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <mac address='52:54:00:7c:4d:e8'/>
  <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>

Then define this network using the virsh command line.

virsh net-define /etc/libvirt/qemu/networks/default.xml