[virt-tools-list] guestfish question

Richard W.M. Jones rjones at redhat.com
Fri Nov 5 13:55:08 UTC 2010


On Thu, Nov 04, 2010 at 11:55:28AM -0400, Kenneth Armstrong wrote:
> rootdisk=$(guestfish --ro -a $diskimage -i inspect-os)
> distribution=$(guestfish --ro -a $diskimage -i inspect-get-distro $rootdisk)
> echo $distribution

By the way it's quicker to do:

  eval $(guestfish --ro -a $diskimage -i --listen)
  rootdisk="$(guestfish --remote inspect-os)"
  distro="$(guestfish --remote inspect-get-distro $rootdisk)"
  guestfish --remote exit

This launches libguestfs once (instead of twice).

http://libguestfs.org/guestfish.1.html#remote_control_guestfish_over_a_socket

Also: Running the 'inspect-os' command is fine, but it does redo the
inspection process that was already done by the '-i' option[*].  In
libguestfs 1.7.3 there is a call 'inspect-get-roots' which returns the
root(s) from the previous inspection, thus avoiding this duplicate
work.

http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=7d8807ec3bc0b772d65e2ca1196f0980a037504e

Rich.

[*] To see how different guestfish command line options translate to
libguestfs API calls, use the guestfish -x option.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora




More information about the virt-tools-list mailing list