Does anyone knows about an example on how to handle snapshots with the java API. It is not very well documented and there seems to be some sort of circular references there or something like that. I am using the platform independent method of communicating with virtualbox.
This is the sample of what i am trying but doesn't works fails to lock the session.
Code: Select all
mgr.connect(url, user, passwd);
IVirtualBox vbox = mgr.getVBox();
List<IMachine> machs = vbox.getMachines();
for (IMachine m : machs)
{
System.out.println("VM name: " + m.getName());// + ", RAM size: " +
// m.getMemorySize()
// + "MB");
System.out.println(" HWVirt: "
+ m.getHWVirtExProperty(HWVirtExPropertyType.Enabled)
+ ", Nested Paging: "
+ m.getHWVirtExProperty(HWVirtExPropertyType.NestedPaging)
+ ", PAE: " + m.getCPUProperty(CPUPropertyType.PAE));
session = mgr.getSessionObject();
IProgress p = m.launchVMProcess(session, "gui", "");
p.waitForCompletion(-1);
m.lockMachine(session, LockType.Shared);
IConsole console = session.getConsole();
console.takeSnapshot("testsnap", "test description");
}