Other Software > Developer's Corner
Automated Snapshots with VirtualBox
ewemoa:
Thanks for the link -- I'd just come across:
http://www.virtualbox.org/manual/ch11.html
where I saw COM, XPCOM, and other things of potential interest mentioned. This triggered some poking around the VirtualBox site's documentation section, where I noticed the SDK Programming Guide, but haven't really looked at it in any detail yet.
I'm not sure how nasty taking a snapshot becomes, so some real-world experience via a prototype using easy-to-develop scripts and some scheduling code as you suggested is a path that seems reasonable. FWIW, it looks like the tool on the guest end, vboxcontrol, is headed in the direction of being able to initiate a snapshot. In my locally installed version, I get some message about not implemented yet, so ATM it's looking like a host+guest idea.
On a related note, I started to use Workrave recently and got to thinking that if I was going to be taking breaks so frequently, may be snapshotting could happen during some of those times :)
This idea seems pretty obvious in retrospect though, so I'm wondering if someone hasn't already done something similar.
Ath:
The scripts should be fairly easy, I guess, haven't any VM's available in VBox to test ATM, but if needed I could create one (on Windows).
I've been using Workrave for some time a couple of years back (I stopped using any of those softwares, to annoying), but can't recall if it does support running some kind of user actions on a break/pause. You could ask on the Bugzilla e-mail group if you can't find this feature, they seem rather responsive.
ewemoa:
Thanks for the ideas and suggestions :)
Am trying to digest the SDK Programming Guide ATM. It looks pretty clear so far that using Python would make certain things easier than using some other alternatives.
ewemoa:
To give a taste of what it might be like to use Python to work with VirtualBox, below is a modified example from the SDK docs to start a virtual machine. The code runs on a host and starts up an already configured guest. It seemed to work ok with a locally installed VirtualBox 4.0.8.
--- Code: Python ---from vboxapi import VirtualBoxManagervirtualBoxManager = VirtualBoxManager(None, None) vbox = virtualBoxManager.vboxmgr = virtualBoxManager.mgrprint "Version is", vbox.version def machById(id): mach = None for m in virtualBoxManager.getArray(vbox, 'machines'): if m.name == id or mach.id == id: mach = m break return mach name = "Windows XP SP3"mach = machById(name) if mach is None: print "cannot find machine", nameelse: session = mgr.getSessionObject(vbox) progress = mach.launchVMProcess(session, "gui", mach.id) progress.waitForCompletion(-1) session.close()
Navigation
[0] Message Index
[*] Previous page
Go to full version