DRBD 8.0.6 brings full live migration for Xen on DRBD

Please note: since I first posted this entry, documentation on this subject has evolved considerably. Please check out the corresponding section in the DRBD User’s Guide for more details.

Undoubtedly, many of you out there are using Xen as the virtualization platform of your choice. Many of you have asked us about doing Xen live migration for DRBD-backed domU’s. Ask no longer, we’ve heard your call.

DRBD 8.0.6, released today, contains a block-drbd device helper script for use with Xen. This greatly simplifies the task of integrating Xen with DRBD.

Xen integration with DRBD: the old way

Previously, if you wanted to use DRBD as a Xen virtual block device (VBD), you would have added entry like this to your domU config file:

disk = [ 'phy:/dev/drbd0,xvda,w',
         'phy:/dev/drbd1,xvdb,w' ]

… and you would have had to make sure by yourself that those devices were in the Primary role on the node where you were starting your domain. Heartbeat could assist you with managing your DRBD, but Xen couldn’t do it on its own. It was all just a wee bit clumsy.

Xen integration with DRBD: the new way

With the new helper script, you do just this:

disk = [ 'drbd:myresource,xvda,w',
         'drbd:myotherresource,xvdb,w']

Now, when you fire up your domain, the helper script will put your DRBD resources named myresource and myotherresource in the Primary role, and hand the corresponding device nodes over to the Xen daemon for use as VBDs for the newly started domain. Likewise, when you issue a domain shutdown or destroy command, Xen will restore your DRBDs to the Secondary role.

The extra plus: Xen live migration with DRBD

And, what’s even better, with this DRBD directly hooks into Xen’s live migration capabilities. Just include these entries in your DRBD resource configuration:

net {
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
}

Add a resource configured like that to your Xen disk configuration, and voilà, you’ll be able to do xm migrate and even xm migrate --live with that domU.

The added bonus: simplified Xen clustering

Use a Xen domain as a Heartbeat cluster service? No problem, just add it to your Heartbeat V2 CRM configuration. The Xen OCF Resource Agent is your friend. Configure DRBD for Heartbeat? Not necessary, Xen will take care of everything all by itself!

12 Responses to DRBD 8.0.6 brings full live migration for Xen on DRBD

  1. Florian Haas says:

    Marco,

    yes you can use LVM snapshots with DRBD, however it’s advisable to make sure that the file system is “frozen” at the time the snapshot is created. That’s not too easily feasible when using DRBD as Xen VBDs. YMMV.

  2. […] DRBD 8.0.6 ist es möglich auf einer DRBD Ressource das Live Migration Feature von Xen zu verwenden. Dazu […]

  3. Maxim Doucet says:

    Hi Florian,
    I was wondering if there’s this kind of facilities for KVM ?
    I stumbled upon http://www.mail-archive.com/kvm@vger.kernel.org/msg02105.html that’s why I’m asking.
    At least KVM live migration works on DRBD according to http://www.mail-archive.com/kvm@vger.kernel.org/msg02112.html

  4. andrea ferraris says:

    Some questions.

    In drbd active/active mode configuration, is it possible to use drbd to grant either HA either manual load balancing and computing load sharing assigning different active VMs to different physical hosts in the cluster?

    What could be a good solution for backup? It is, I was thinking to lvm over drbd snapshotting, but you stated that for this to work is needed that the overlying file system is freezed and that such condition is hard to reach. But is it a filesystem needed? It is not possible to use logical volumes only containing VM images? And if it is possible, are there yet problem in lvm snapshot backups?

    • Florian Haas says:

      Andrea,

      yes of course you can utilize load balancing/load sharing in this configuration mode. Please drop us an email at sales@linbit.com if interested in obtaining details on how to set this up.
      The same goes for backup; there are several options. LVM snapshots being one of them, obviously.

Leave a comment