OpenStack: Perform Consistent Snapshots With Qemu Guest Agent
http://www.sebastien-han.fr/blog/2015/02/09/openstack-perform-consistent-snapshots-with-qemu-guest-agent/A while back, I wrotean article about taking consistent snapshots of your virtual mach
http://www.sebastien-han.fr/blog/2015/02/09/openstack-perform-consistent-snapshots-with-qemu-guest-agent/
A while back, I wrote an article about taking consistent snapshots of your virtual machines in your OpenStack environment. However this method was really intrusive since it required to be inside the virtual machine and to manually summon a filesystem freeze. In this article, I will use a different approach to achieve the same goal without the need to be inside the virtual machine. The only requirement is to have a virtual machine running the qemu-guest-agent.
OpenStack Nova and QEMU guest agent
The QEMU guest support landed in Nova during the Havana cycle, so basically we are two release ahead. This functionality is based on Glance properties.
But how does that work?
The principle is quite easy. A virtual machine boots with a new virtio device attached pointing to unix socket on the hypervisor. Inside the virtual machine this socket will appear as a new character device, commonly under /dev/virtio-ports/
.
A picture is always better:
Configure the QEMU agent
For Ubuntu, you need to apply this fix since AppArmor will not allow the creation of the socket:
Configure your Glance image:
Boot your virtual machine:
Verify that the agent is in the virtual machine:
Install the QEMU agent inside your VM:
Now go back on the hypervisor and check that the socket file is present (it must here since we have the character device inside the virtual machine):
Test if the QEMU agent responds:
Iced that guy!
Full reference of the image available here :D.
Setup the fsfreeze hook mechanism, on Red Hat systems the file already exists:
Configure a basic hook, it will be executed either during the freeze or thaw operation:
Now let’s freeze ad thaw the filesystem:
Did the hook work as expected? Yes!
For a more concrete example, have a look at this work for a database from Chromium.
OpenStack Nova and Snapshots
Several patches have been submitted to quiesce the filesystem prior to run the snapshot. The initial work to support fs-freeze while performing a snapshot of an instance was introduced in Juno with a spec. However the commit only got merged in December… This will be available in Kilo. Another effort to support this feature while booting from a volume is currently under review.
The original blueprint can be found here. Ultimately this option will be available via a Glance property:
When this option will be set and the virtual machine running the QEMU guest agent, when a user will snapshot an instance, the filesystem will get frozen and thawed after the operation.
更多推荐
所有评论(0)