VMware Cloud Community
manfriday
Enthusiast
Enthusiast

Unable to convert object, no sdk type defined for class

So, this USED to work to return all of the snapshots of all the VM's in a folder (and subfolder):

if (subfolders == true)
    var virtualMachines = System.getModule("com.vmware.library.vc.folder").getAllVirtualMachinesByFolderIncludingSubFolders(vmFolder);
else
    var virtualMachines = System.getModule("com.vmware.library.vc.folder").getAllVirtualMachinesByFolder(vmFolder);
   
var snapshot = new VcVirtualMachineSnapshotInfo();
var allSnaps = new Array();
for (var i in virtualMachines)
{   
    var snapshot = virtualMachines[i].snapshot;
    if (snapshot != null)
        {
            var rootSnaps = snapshot.rootSnapshotList;
            for (var ii in rootSnaps)
                {
                    allSnaps.push(rootSnaps[ii]);
                    GetChildSnapList(rootSnaps[ii]);
                }
        }
}

return allSnaps;

function GetChildSnapList(snap)
{
    var childSnapshotList = snap.childSnapshotList;
    for (var ss in childSnapshotList)
        {
            allSnaps.push(childSnapshotList[ss])
            GetChildSnapList(childSnapshotList[ss])
        }
}

Since the update to 5.1, I get the following error when it returns allSnaps to an array of type VC:VirtualMachineSnapshot

ch.dunes.model.type.ConvertorException: Unable to convert object, no sdk type defined for class : com.vmware.vim.vi4.VirtualMachineSnapshotTree@2f68fe27

Has something changed, and I need to modify the way I am doing this, or is it another bug?

Reply
0 Kudos
1 Reply
manfriday
Enthusiast
Enthusiast

It looks like VMware's included workflow "Remove old snapshots" fails with the same message, so I am going to assume this is another bug.

Reply
0 Kudos