Enable Snapshot with KVM on CloudStack

How to enable Snapshot with KVM on CloudStack

If you have chosen KVM as your hypervisor in CloudStack then you probably know that Snapshot is not supported by KVM, only VMware and XenServer. This is refering to Snapshots which capture state of the machine much like a VMware Snapshot.

What is supported is Volume Snapshot which is basically a snapshot of individual volumes. A copy of your volume is backed up to secondary storage. It does have some limitations of course, you can not just roll back to this backup.

But before you can use Volume Snapshot you will have to do a couple of things.

Logon to CloudStack and from Global settings select kvm.snapshot.enabled set it to true and restart the management server (kvm.snapshot.enabled = true)

Enable Snapshot with KVM on CloudStack

This alone won’t do it. Because i am running CentOS 6.6 i have to install an older version of qemu-img, qemu-img-0.12.1.2-2.355.e16_4_4.1.x86_64.rpm. I found a great article on http://www.nux.ro/archive/2014/01/Taking_KVM_volume_snapshots_with_Cloudstack_4_2_on_CentOS_6_5.html

I had to install wget by:
yum install wget


yum install wget

Then:
mkdir cloud-qemu-img
cd cloud-qemu-img
wget http://vault.centos.org/6.4/updates/x86_64/Packages/qemu-img-0.12.1.2-2.355.el6_4_4.1.x86_64.rpm
rpm2cpio qemu-img-0.12.1.2-2.355.el6_4_4.1.x86_64.rpm |cpio -idmv
cp ./usr/bin/qemu-img /usr/bin/cloud-qemu-img

mkdir cloud-qemu-img
Once you have copied down the older version of qemu-img to all your KVM nodes you might want to tweak a few of the Snapshot settings available within the CloudStack console. In Global Settings throttle the number of volume snapshots on each host by modifying the global setting: concurrent.snapshots.threshold.perhost. You can also set snapshot timeout periods and maximum number of snapshots per account, per project or limit snapshots by the hour, day, week or month.
max.account.snapshots
max.project.snapshots
snapshot.max.hourly
snapshot.max.daily
snapshot.max.weekly
snapshot.max.monthly

Limiting snapshot settings will enable you to manage your secondary storage usage and help with performance of your storage as running multiple snapshots concurrently have cause performance problems on your storage arrays.

You might also want to set job.expire.minutes so jobs wont stayed queued and will error out.

 

References:

http://www.nux.ro/archive/2014/01/Taking_KVM_volume_snapshots_with_Cloudstack_4_2_on_CentOS_6_5.html

 

Stuart Nelson

My name is Stuart Nelson and I’m a veteran IT Professional. And by that I mean I feel old with the pace of change in IT over the last few years. My background in IT is in Wintel, Virtualisation, Infrastructure and more recently Cloud.

2 thoughts on “Enable Snapshot with KVM on CloudStack

  1. Thank you, but what can I do with KVM snapshots? I tried to define them as a new ROOT disk for a new instance to restore previous VM state in a new VM, but there seems to be no option in Cloudstack to do that, or am I missing something? New volumes from snapshots appear as DATA disks and not ROOT disks. I understand that there is no roll back functionality in CS and I have read that you can only create a clone of a VM which will have a different MAC and a new IP address and possibly a new hostname.. I am using CS 4.5 and can’t find even how to use at least this cloning option..

  2. I think I got it now, you have to create snapshot of the volume and then from it create template and then new instance..

Comments are closed.