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. Robert says:

    Dear Florian,
    I discovered drbd only a couple of months ago and I’m doing my tests on citrix xenserver free.

    Why don’t you update o renew this blog post at nowadays maybe giving it this title

    “DRBD 8.3.8.1 brings full live migration for XenServer 5.6 on DRBD”

    I also noticed that XenMotion is available on XenServer free edition (and I’ll do my testings, at least, as soon I well understand how to export and import VMs’s metadata the correct way).

    Thank you

    R.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: