VMware Cloud Community
rszymczak
Hot Shot
Hot Shot
Jump to solution

Where to find the IaaS __Clone_SnapshotId used on linked-clone Blueprints in vRA?

Hi guys,

when creating IaaS linked-clone blueprints IaaS will create a entity VirtualMachineTemplateProperties with the PropertyName __Clone_SnapshotId and a PropertyValue of let's say 6.

This id is used to identify which snapshot to use for the linked-clone an can be found in the IaaS database. However: I can't tell where that number (6) can be found in vSphere.

If looking at the id of the snapshot in vCenter then it is for example snapshot-7380. Is there some kind of mapping happening in vRA IaaS between the vSphere snapshot ID and the IaaS snapshot ID? How to get the correct snapshot ID for IaaS?

0 Kudos
1 Solution

Accepted Solutions
rszymczak
Hot Shot
Hot Shot
Jump to solution

Okay so i finally tracked it down. Seems like vRA IAAS is using the snapshotTree id for linked-clone references. If you have access to the VC:VirtualMachineSnapshot you can find the id like this:

//snap is the provided VC:VirtualMachineSnapshot you want to use as linked clone reference

var vm = snap.vm;

var id = snap.id;

function findSnap(snapTrees, snapId)

{

  System.log("Searching SnapshotTree for id '" + snapId + "'...");

  for each(snapTree in snapTrees)

  {

  System.log("Checking snapTree '" + snapTree.id + "' with id '" + snapTree.snapshot.id + "'...");

  if(snapTree.snapshot.id == snapId)

  {

  System.log("Found matching snapshot! SnapTree id is: '" + snapTree.id + "'.")

  return snapTree.id;

  }

  else

  {

  var childSnaps = snapTree.childSnapshotList;

  if(childSnaps.length > 0)

  {

  System.log("Checking children...");

  return findSnap(childSnaps, snapId);

  }

  }

  }

  return null;

}

// Get the id like this

var snapTreeId = findSnap(vm.snapshot.rootSnapshotList, id);

Hope this saves somebody some time.

View solution in original post

0 Kudos
1 Reply
rszymczak
Hot Shot
Hot Shot
Jump to solution

Okay so i finally tracked it down. Seems like vRA IAAS is using the snapshotTree id for linked-clone references. If you have access to the VC:VirtualMachineSnapshot you can find the id like this:

//snap is the provided VC:VirtualMachineSnapshot you want to use as linked clone reference

var vm = snap.vm;

var id = snap.id;

function findSnap(snapTrees, snapId)

{

  System.log("Searching SnapshotTree for id '" + snapId + "'...");

  for each(snapTree in snapTrees)

  {

  System.log("Checking snapTree '" + snapTree.id + "' with id '" + snapTree.snapshot.id + "'...");

  if(snapTree.snapshot.id == snapId)

  {

  System.log("Found matching snapshot! SnapTree id is: '" + snapTree.id + "'.")

  return snapTree.id;

  }

  else

  {

  var childSnaps = snapTree.childSnapshotList;

  if(childSnaps.length > 0)

  {

  System.log("Checking children...");

  return findSnap(childSnaps, snapId);

  }

  }

  }

  return null;

}

// Get the id like this

var snapTreeId = findSnap(vm.snapshot.rootSnapshotList, id);

Hope this saves somebody some time.

0 Kudos