On Wed, Jan 25, 2012 at 12:02:41AM +0100, Hilko Bengen wrote:
I tried using Javascript (gjs) with GObject-Introspection and did a
port
of the create_disk example which is attached below.
Quite a bit of time was spent looking up stuff in the GLib reference and
guessing how certain idioms translate to gjs.
I used the traditional add_drive_opts method since I haven't been able
to find how to specify the optional arguments to add_drive_opts. How
does that work?
var optargs = new Guestfs.AddDriveOpts ({readonly: true});
g.add_drive_opts (filename, optargs);
This awkward style is required because GObject Introspection doesn't
support optional arguments.
Here is my program, which uses add_drive_opts and performs inspection,
similar to the 'inspect_vm' example:
https://rwmj.wordpress.com/2012/01/25/calling-libguestfs-from-javascript/
[...]
g.add_drive (file.get_path (), Guestfs.AddDriveOpts.OPTS_FORMAT,
"raw");
I think Javascript is simply ignoring the second and third arguments.
I'm a bit surprised there is no error ...
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/