<div dir="ltr"><div>i want to do it remotely through command : </div><div><br></div><div>although if i use python language the thing works for me you can see the python code </div><div>>>> import guestfs</div><div>
>>> g = guestfs.GuestFS (python_return_dict=True)</div><div>>>> g.add_drive_opts ("/dev/null", readonly=1)</div><div>>>> g.config('-set', "drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img")</div>
<div>>>></div><div>>>> g.launch()</div><div>>>> g.inspect_os()</div><div>['/dev/ubuntu-1204-vg/root']</div><div>>>> g.inspect_get_distro('/dev/ubuntu-1204-vg/root')</div>
<div>'ubuntu'</div><div><br></div><div>but when i try to do the same from command line it failed:</div><div><br></div><div>firstly i run command </div><div><br></div><div><div>guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : run : inspect-os</div>
<div><br></div><div>this is returning me :</div><div>/dev/ubuntu-1204-vg/root</div></div><div><br></div><div>when i pass this output to get-distro , it failed </div><div><br></div><div>guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : run : inspect-get-distro /dev/ubuntu-1204-vg/root</div>
<div>libguestfs: error: no inspection data: call guestfs_inspect_os first<br></div><div><br></div><div>this time i have called run </div><div><br></div><div>Regards</div><div>Shumaila Naeem</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Mar 14, 2014 at 12:59 PM, Richard W.M. Jones <span dir="ltr"><<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">On Fri, Mar 14, 2014 at 12:47:08PM +0500, Shumaila Naeem wrote:<br>
> Also i can't use the newest version of libguestfs as im on a production<br>
> system and i could not use the newest version due to some limitations.<br>
<br>
</div>You can use the new version without installing it.  However you would<br>
need to be able to install a compiler and other dependencies, which<br>
may not be possible on a production system.<br>
<div class=""><br>
> Also the new version is not available in repo.<br>
><br>
><br>
><br>
> Im getting antother problem :<br>
><br>
> while running these commands im getting error :<br>
> guestfish -- add /dev/null : config -set<br>
> drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : run :<br>
> inspect-os<br>
> /dev/ubuntu-1204-vg/root<br>
> [root@EQkvm0101 ~]# guestfish -- add /dev/null : config -set<br>
> drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img :<br>
>  inspect-get-distro /dev/ubuntu-1204-vg/root<br>
> libguestfs: error: no inspection data: call guestfs_inspect_os first<br>
<br>
</div>You have to call inspect-os, and pass the returned value back to<br>
inspect-get-distro.  This is (to say the least) awkward in guestfish,<br>
but much easier if you use a real programming language (libguestfs has<br>
many language bindings, see <a href="http://libguestfs.org" target="_blank">http://libguestfs.org</a>).  Also you are<br>
missing a call to 'run'.<br>
<br>
Here's how you could do it in Perl:<br>
<br>
------------------------------------------------------------<br>
#!/usr/bin/perl -w<br>
<br>
use strict;<br>
use Sys::Guestfs;<br>
<br>
my $g = Sys::Guestfs->new ();<br>
$g->add_drive_opts ("/dev/null", readonly => 1);<br>
# RHEL 6 hack for adding Ceph drives:<br>
$g->config ("-set",<br>
            "drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img");<br>
$g->launch ();<br>
<br>
my @roots = $g->inspect_os ();<br>
if (@roots == 0) {<br>
    die "no operating systems found";<br>
}<br>
my $root = $roots[0];<br>
my $distro = $g->inspect_get_distro ($root);<br>
print "distro = $distro\n";<br>
------------------------------------------------------------<br>
<div class="HOEnZb"><div class="h5"><br>
Rich.<br>
<br>
--<br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" target="_blank">http://people.redhat.com/~rjones</a><br>
Read my programming blog: <a href="http://rwmj.wordpress.com" target="_blank">http://rwmj.wordpress.com</a><br>
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)<br>
</div></div></blockquote></div><br></div>