Linux KVM storage domain import

In my PowerFlex KVM paper I discuss local replication (snapshots) of storage domains (~ VMware datastores) and the possibilities for using them in backups or testing. I thought it might be worthwhile to give a practical example. As you, my readers, are generally familiar with VMware, I will reference datastore cloning for comparison and clarity.

Currently I’m testing KVM disaster recovery in my PowerMax setup. Replication is much more common on PowerMax than PowerFlex so it made more sense to use that platform. The DR scripting (Ansible) which is used in KVM setups, automates the importation of storage domains, as well as registration of virtual machines (if it ever works…). This prompted me to consider the more common, manual process of importation. I decided to use PowerFlex here, but other than the storage snaps/presentation to hosts, everything here holds true for PowerMax.

Prerequisites

OK, so overkill here but best to be thorough.

  • Active storage domain on the source KVM environment – I will use block (SDC), presented as FC
  • Licensed local replication on the array (technically you could also replicate a volume and split it so remote replication also)
  • A second KVM environment with access to the same array as the source – yes, we need another setup. You cannot import a copied storage domain into the same environment as the source. Certainly you can present the volume to it, but it will not be recognized as a copy. In other words, unlike VMware, you can’t simply resignature the volume. Kind of a bummer since I certainly don’t have extra hosts (in fact I had to peel off two from the source)

Environments

Source has three hosts, target has two hosts. Each host has SDC installed on it.

Source

Target

Source volume

We’ll start by identifying one of the storage domains to use in the example. Here I will use SDC_KVM_Storage which is a 504 GB volume.

I’m using a single virtual machine – we really don’t need multiples for the test – it’s an Ubuntu OS, not that it matters. One VM will demonstrate what we need to.

And there’s only three disks in here, the OVF_STOREs which hold all the metadata, and the one VM disk:

Snapshot

In the PowerFlex UI, we need to start by taking a snapshot. Navigate to Block -> Volumes and check the box next to the source volume. Then from the drop-down More Actions -> Create Snapshot.

Provide a name for the snapshot (or leave default) and uncheck the box next to Read Only. We can’t activate a read only volume.

Next map the volume to the hosts in the target environment. Navigate to Protection -> Snapshots. Use the checkbox to select the snapshot, then Mapping -> Map.

Select the hosts in the target environment and click Map.

The hosts will immediately see the new volume if you run a multipath -ll:

Import storage domain

Finally we can import the copied volume/storage domain. In the target environment Open Virtualization Manager (OVM), navigate to Storage -> Storage Domains -> Import Domain.

This task brings up the same dialog box that is used to add a new storage domain to the environment. The only difference is the title at the top which is now Import Pre-Configured Domain. Use the drop-down box next to Storage Type to select FC, in this example. A search is executed against all FC devices to see if there is an existing storage domain on any volume. The wizard finds our snapshot and lists it.

Use the checkbox to select the storage domain, enter in a Name and Description (if desired), and expand the Advanced Parameters so you can check the box Activate Domain in Data Center (this will save a step after).

OVM is first going to warn the user that this storage domain (or its state anyway) is active because it sees existing locks. This is expected because we took the snapshot while the storage domain was active at the source site. We could, of course, have stuck it in maintenance and deactivated it before the snapshot, but it was unnecessary. You’ll need to check the box acknowledging you know what you are doing.

OVM will then go through the same type of operations it does for a new storage domain – locking the domain and then activating it.

Register VM

It is now possible to register the VM snapshot_vm_test. Use the hyperlink of the Domain Name above to drill into it. Navigate from the General tab to the VM Import tab. Here you will see any VMs in the storage domain. Highlight the VM and click Import.

When you execute the import, OVM will bring up another dialog. I have included more than the dialog below because you may experience the pink box and the MAC address out of range errors. The pink box can be ignored as it seems to be a common issue with OVM and has no bearing on the import. The MAC address, however, requires that the user select the Reassign box in red.

Once you check the box, the MAC address error will drop and you can click OK to import the VM successfully.

Go under the Virtual Machines tab to see the imported VM.

You can now test, backup, or use it for whatever purpose you wish. When you are done, or want to refresh, you can delete the VMs, stick the storage domain in maintenance, and then detach and remove.

One thought on “Linux KVM storage domain import

Add yours

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Website Powered by WordPress.com.

Up ↑