I was recently asked what happens to a VMs snapshot if that VM is removed to a new Protection Domain. I actually hadn’t come across this question before so thought I should lab it and figure out exactly what happens to those snaps once you move a VM to another Protection Domain.

Setting up the Lab

For this lab I’m using an old Nutanix NX cluster running Community Edition (If you’d like to learn more about Nutanix CE you can click here).

I already had a VM on my lab to test with so I went to the Protection Domain menu and created two Async DR Protection Domains called Test01 and Tes02 (inventive, right?). I don’t have a remote site for this cluster so no remote site was configured and I created a basic once a week schedule for each PD. I also added my test VM to the Test01 PD and created two snapshots.

The Test

Now that the lab is configured for what I want to test, it’s time to get into it.

The first thing I want to do is use ncli to list the VM snapshots. I can see the snapshots in Prism, but I want to see how they look in acli.
In order to get the snapshot of the individual VM I need to get the VM ID.

So first, I run:
ncli vm ls

This command will give me a list of all the VMs on my cluster and print some info about that VM.
The info I’m interested in is the VM ID as we will need this later.
You can also see that from this command we can confirm the VM is part of the Protection Domain Test01.

Now that we have the required info we can run:
ncli vm ls-snaps vm-id=032eadee-3456-4a08-a2cd-9d563dc8a8dc
This command will return all snapshots that are associated with my test Server.

As you can see from the output, this VM has two snapshots associated with it. We can confirm this in Prism by looking at the “Local Snapshots” tab (which is in the gallery above).
Another thing to note here is that the ls-snaps command also lists the Disk Uuids associated with the snapshot (we will need this for later).

So now we have proven that the VM has snapshots and we can see them both in Prism and via ncli, let’s remove the VM from the PD and see what happens.

With the VM now removed from the PD Prism still shows the Local Snapshots and they can still be recovered (which is great) .

However ncli is a little different now.

Immediately you notice that ncli says the VM is no longer protected (which is true) and looks like there is no snapshots associated with that VM (which again, is true).

Remember how I said we’d need the Disk Uuid earlier – Here’s why.
While the VM may not have any associated snapshots, the disk does. we can verify that the snapshot still exists by running the following command:
ncli snap ls

So you can see that the snapshots are still very much there but the association is on the Disk Uuid rather than the VM object itself.

So we know that the snapshots stick around after you remove the VM from a Protection Domain, but what about when we add the VM to another Protection Domain? Let’s find out.

I’ve now added the test VM to m Test02 PD, you can see this if I run the ncli vm ls command again.

As you can see, this VM is now part of the Test02 PD.

Let’s take a snapshot of the PD and see what we notice in Prism this time.

If you look closely you’ll notice this snapshot has a different ID to the ones above and the previous snapshots aren’t listed. However they still look like they are listed in the Test01 PD.

Let’s take a look at ncli.
ncli vm ls-snaps vm-id=032eadee-3456-4a08-a2cd-9d563dc8a8dc

Only one snapshot is listed. the previous snapshots from the other PD aren’t listed.

Now, let’s see what happens if we look at the ncli snap ls command.

From the output above we can see there is three snapshots listed against the Disk Uuid of my test VM.

What has happened here? Why are we seeing these results?

So what we see here is that a VM snapshot isn’t bound to the VM object, but rather the VMs disk (which makes sense seeing as Nutanix uses redirect on write snapshots). So when you list the snapshots of the cluster rather than the individual VM you can see all of the snapshots regardless of whether the VM is part of a PD or not.

If we were to add the test VM back to the original Test01 PD and ran ncle vm ls-snaps we’d see the original two snapshots via ncli again.

So, what is the answer?

When writing this post I set out to answer what happens to a VMs snapshots when the VM is removed from a Protection Domain. From what I have discovered when I labbed this I found that the snapshots will remain as long as the Protection Domain remains (and the snapshot doesn’t expire).

It’s also worth noting that you can’t remove a Protection Domain while it still has snapshots associated to it. Which confirms that the snapshots will remain as long as the PD remains on the cluster.

Leave A Comment

Your email address will not be published. Required fields are marked *