Created
April 13, 2012 09:23
-
-
Save lundvall/2375388 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ManagedObjectReference currentSnapshot; | |
public void printCurrentSnapshotName() { | |
VirtualMachineSnapshotInfo snapshotInfo = vm.getSnapshot(); | |
if (snapshotInfo != null) { | |
currentSnapshot = snapshotInfo.currentSnapshot; | |
walkSnapshotTree(snapshotInfo.rootSnapshotList); | |
} | |
} | |
private void walkSnapshotTree(VirtualMachineSnapshotTree[] snapshotTree) { | |
for (VirtualMachineSnapshotTree snapshot : snapshotTree) { | |
if (snapshot.snapshot.equals(currentSnapshot)) { | |
System.out.println("Name: " + snapshot.name); | |
} else if (snapshot.childSnapshotList != null) { | |
walkSnapshotTree(snapshot.childSnapshotList); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment