Open icnocop opened 8 years ago
I think the same is happening to me. I get "No snapshot found on virtual machine" error even though, snapshot exists and the tools finds the snapshot, but it still returns an error. It could be because snapshot is buried deep in the snapshot hierarchy. Please advise.
@icnocop Thanks for reporting the issue and pinning the root cause in source code. you can raise a PR with the fix. here are the steps to build and run tests.
I'm not a Java guy, so there is not much I can do to help. @icnocop can you help? Or perhaps, any of the contributors can take a look at it.
private ManagedObjectReference findSnapshotInTree(List<VirtualMachineSnapshotTree> vmSnapshotList,
String snapshotName) {
ManagedObjectReference snapshotMor = null;
for (VirtualMachineSnapshotTree vmSnapshot : vmSnapshotList) {
if (vmSnapshot.getName().equalsIgnoreCase(snapshotName)) {
System.out.println(String.format("Found snapshot [ %s ] for virtual machine.", snapshotName));
**snapshotMor = vmSnapshot.getSnapshot();
break;**
} else {
List<VirtualMachineSnapshotTree> childTree = vmSnapshot.getChildSnapshotList();
snapshotMor = findSnapshotInTree(childTree, snapshotName);
}
}
return snapshotMor;
}
@yermax created a PR with the fix https://github.com/Microsoft/vsts-vmware/pull/72
Hello, I see that this is merged into master, but the version in the marketplace is still 1.0.0 from 5/24/2016. Are you planning to push out this fix?
I did notice that in the commit, the patch number in task.json (1.0.2) is different from the one in vss-extension.json (1.0.1); not sure if the two have anything to do with each other. This requirement could also be related: https://devblogs.microsoft.com/devops/new-requirement-when-updating-team-services-extensions-on-the-marketplace
Visual Studio Team Foundation Server 2015 Update 3 (on premise) VMware Resource Deployment 1.0.0 (ms-vscs-rm.vmwareapp)
The loop to find a snapshot on the virtual machine doesn't return when it actually finds a snapshot.
https://github.com/Microsoft/vsts-vmware/blob/master/src/Tools/vmOpsTool/VMWareImpl.java#L614
Right after that line, there should be a check to see if
snapshotMor
is not null and if so,break
out of the loop orreturn snapshotMor
.The problematic behavior is observed when there's a snapshot hierarchy similar to the following:
When trying to revert to "Grandchild Snapshot 1", the output log is similar to the follow:
Ideally, I would like to be able to specify the specific snapshot hierarchy in the case where there's more than one snapshot with the same name.
For example, I want to explicitly specify the snapshot name "Root Snapshot\Child Snapshot B\Grandchild Snapshot 1", in the case where there's already a snapshot named "Grandchild Snapshot 1" higher up in the hierarchy, i.e. "Root Snapshot\Child Snapshot A\Grandchild Snapshot 1". Currently, there isn't a way to specify which snapshot I want to revert to.
Thank you!