http://rwmj.wordpress.com/2013/03/12/accessing-ceph-rbd-sheepdog-etc-using-l... I came across this link and and i was able to retrieve the rbd image. $ guestfish
<fs> set-attach-method appliance <fs> add-drive /dev/null <fs> config -set drive.hd0.file=rbd:pool/volume <fs> run I was able to retrieve file from rbd image using the above method.
Would you please let know how to do this in a single command line. I am getting the following error guestfish add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/fullclone.img : run : list-partitions guestfish: invalid option -- 's' Try `guestfish -help' for more information. anything I m doing wrong here. I am using CentOS 6.4 2.6.32-358.6.2.el6.x86_64 qemu: qemu-kvm-0.12.1.2-2.415.el6.3ceph.x86_64 qemu-kvm-tools-0.12.1.2-2.415.el6.3ceph.x86_64 guestfs: libguestfs-tools-c-1.20.11-2.el6.x86_64 libguestfs-tools-1.20.11-2.el6.x86_64 libguestfs-1.20.11-2.el6.x86_64 libguestfs-winsupport-1.0-7.el6.x86_64
On Thu, Mar 13, 2014 at 03:06:17PM +0500, Shumaila Naeem wrote:
http://rwmj.wordpress.com/2013/03/12/accessing-ceph-rbd-sheepdog-etc-using-l... I came across this link and and i was able to retrieve the rbd image.
$ guestfish
<fs> set-attach-method appliance <fs> add-drive /dev/null <fs> config -set drive.hd0.file=rbd:pool/volume <fs> run I was able to retrieve file from rbd image using the above method.
Would you please let know how to do this in a single command line. I am getting the following error
guestfish add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/fullclone.img : run : list-partitions guestfish: invalid option -- 's' Try `guestfish -help' for more information.
Use 'guestfish --', ie: guestfish -- add /dev/null [etc]
anything I m doing wrong here.
I am using CentOS 6.4 2.6.32-358.6.2.el6.x86_64 qemu:
qemu-kvm-0.12.1.2-2.415.el6.3ceph.x86_64 qemu-kvm-tools-0.12.1.2-2.415.el6.3ceph.x86_64
guestfs:
libguestfs-tools-c-1.20.11-2.el6.x86_64 libguestfs-tools-1.20.11-2.el6.x86_64 libguestfs-1.20.11-2.el6.x86_64 libguestfs-winsupport-1.0-7.el6.x86_64
However I'd definitely recommend trying newer versions of libguestfs, since they support rbd transparently. Rich. -- 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#)
i will test it out and will update you.. Thankyou so much for your reply kind regards Shumaila Naeem Software Engineer , Ovex Technologies On Thu, Mar 13, 2014 at 5:15 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Thu, Mar 13, 2014 at 03:06:17PM +0500, Shumaila Naeem wrote:
I came across this link and and i was able to retrieve the rbd image.
$ guestfish
<fs> set-attach-method appliance <fs> add-drive /dev/null <fs> config -set drive.hd0.file=rbd:pool/volume <fs> run I was able to retrieve file from rbd image using the above method.
Would you please let know how to do this in a single command line. I am getting the following error
guestfish add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/fullclone.img : run :
http://rwmj.wordpress.com/2013/03/12/accessing-ceph-rbd-sheepdog-etc-using-l... list-partitions
guestfish: invalid option -- 's' Try `guestfish -help' for more information.
Use 'guestfish --', ie:
guestfish -- add /dev/null [etc]
anything I m doing wrong here.
I am using CentOS 6.4 2.6.32-358.6.2.el6.x86_64 qemu:
qemu-kvm-0.12.1.2-2.415.el6.3ceph.x86_64 qemu-kvm-tools-0.12.1.2-2.415.el6.3ceph.x86_64
guestfs:
libguestfs-tools-c-1.20.11-2.el6.x86_64 libguestfs-tools-1.20.11-2.el6.x86_64 libguestfs-1.20.11-2.el6.x86_64 libguestfs-winsupport-1.0-7.el6.x86_64
However I'd definitely recommend trying newer versions of libguestfs, since they support rbd transparently.
Rich.
-- 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#)
Use 'guestfish --', ie:
guestfish -- add /dev/null [etc]
i tried this method this worked for me in case of listing partitions [root@EQkvm0101 ~]# guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/fullclone.img : run : list-partitions /dev/sda1 /dev/sda2 [root@EQkvm0101 ~]# thankyou so much for the reply Also i can't use the newest version of libguestfs as im on a production system and i could not use the newest version due to some limitations. Also the new version is not available in repo. Im getting antother problem : while running these commands im getting error : guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : run : inspect-os /dev/ubuntu-1204-vg/root [root@EQkvm0101 ~]# guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : inspect-get-distro /dev/ubuntu-1204-vg/root libguestfs: error: no inspection data: call guestfs_inspect_os first can you please help me. Regards Shumaila Naeem On Thu, Mar 13, 2014 at 5:54 PM, Shumaila Naeem <shum.naeem@gmail.com>wrote:
i will test it out and will update you..
Thankyou so much for your reply
kind regards Shumaila Naeem Software Engineer , Ovex Technologies
On Thu, Mar 13, 2014 at 5:15 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Thu, Mar 13, 2014 at 03:06:17PM +0500, Shumaila Naeem wrote:
I came across this link and and i was able to retrieve the rbd image.
$ guestfish
<fs> set-attach-method appliance <fs> add-drive /dev/null <fs> config -set drive.hd0.file=rbd:pool/volume <fs> run I was able to retrieve file from rbd image using the above method.
Would you please let know how to do this in a single command line. I am getting the following error
guestfish add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/fullclone.img : run :
http://rwmj.wordpress.com/2013/03/12/accessing-ceph-rbd-sheepdog-etc-using-l... list-partitions
guestfish: invalid option -- 's' Try `guestfish -help' for more information.
Use 'guestfish --', ie:
guestfish -- add /dev/null [etc]
anything I m doing wrong here.
I am using CentOS 6.4 2.6.32-358.6.2.el6.x86_64 qemu:
qemu-kvm-0.12.1.2-2.415.el6.3ceph.x86_64 qemu-kvm-tools-0.12.1.2-2.415.el6.3ceph.x86_64
guestfs:
libguestfs-tools-c-1.20.11-2.el6.x86_64 libguestfs-tools-1.20.11-2.el6.x86_64 libguestfs-1.20.11-2.el6.x86_64 libguestfs-winsupport-1.0-7.el6.x86_64
However I'd definitely recommend trying newer versions of libguestfs, since they support rbd transparently.
Rich.
-- 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#)
On Fri, Mar 14, 2014 at 12:47:08PM +0500, Shumaila Naeem wrote:
Also i can't use the newest version of libguestfs as im on a production system and i could not use the newest version due to some limitations.
You can use the new version without installing it. However you would need to be able to install a compiler and other dependencies, which may not be possible on a production system.
Also the new version is not available in repo.
Im getting antother problem :
while running these commands im getting error : guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : run : inspect-os /dev/ubuntu-1204-vg/root [root@EQkvm0101 ~]# guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : inspect-get-distro /dev/ubuntu-1204-vg/root libguestfs: error: no inspection data: call guestfs_inspect_os first
You have to call inspect-os, and pass the returned value back to inspect-get-distro. This is (to say the least) awkward in guestfish, but much easier if you use a real programming language (libguestfs has many language bindings, see http://libguestfs.org). Also you are missing a call to 'run'. Here's how you could do it in Perl: ------------------------------------------------------------ #!/usr/bin/perl -w use strict; use Sys::Guestfs; my $g = Sys::Guestfs->new (); $g->add_drive_opts ("/dev/null", readonly => 1); # RHEL 6 hack for adding Ceph drives: $g->config ("-set", "drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img"); $g->launch (); my @roots = $g->inspect_os (); if (@roots == 0) { die "no operating systems found"; } my $root = $roots[0]; my $distro = $g->inspect_get_distro ($root); print "distro = $distro\n"; ------------------------------------------------------------ Rich. -- 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#)
i want to do it remotely through command : although if i use python language the thing works for me you can see the python code
import guestfs g = guestfs.GuestFS (python_return_dict=True) g.add_drive_opts ("/dev/null", readonly=1) g.config('-set', "drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img")
g.launch() g.inspect_os() ['/dev/ubuntu-1204-vg/root'] g.inspect_get_distro('/dev/ubuntu-1204-vg/root') 'ubuntu'
but when i try to do the same from command line it failed: firstly i run command guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : run : inspect-os this is returning me : /dev/ubuntu-1204-vg/root when i pass this output to get-distro , it failed 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 libguestfs: error: no inspection data: call guestfs_inspect_os first this time i have called run Regards Shumaila Naeem On Fri, Mar 14, 2014 at 12:59 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Fri, Mar 14, 2014 at 12:47:08PM +0500, Shumaila Naeem wrote:
Also i can't use the newest version of libguestfs as im on a production system and i could not use the newest version due to some limitations.
You can use the new version without installing it. However you would need to be able to install a compiler and other dependencies, which may not be possible on a production system.
Also the new version is not available in repo.
Im getting antother problem :
while running these commands im getting error : guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : run : inspect-os /dev/ubuntu-1204-vg/root [root@EQkvm0101 ~]# guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : inspect-get-distro /dev/ubuntu-1204-vg/root libguestfs: error: no inspection data: call guestfs_inspect_os first
You have to call inspect-os, and pass the returned value back to inspect-get-distro. This is (to say the least) awkward in guestfish, but much easier if you use a real programming language (libguestfs has many language bindings, see http://libguestfs.org). Also you are missing a call to 'run'.
Here's how you could do it in Perl:
------------------------------------------------------------ #!/usr/bin/perl -w
use strict; use Sys::Guestfs;
my $g = Sys::Guestfs->new (); $g->add_drive_opts ("/dev/null", readonly => 1); # RHEL 6 hack for adding Ceph drives: $g->config ("-set",
"drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img"); $g->launch ();
my @roots = $g->inspect_os (); if (@roots == 0) { die "no operating systems found"; } my $root = $roots[0]; my $distro = $g->inspect_get_distro ($root); print "distro = $distro\n"; ------------------------------------------------------------
Rich.
-- 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#)
On Fri, Mar 14, 2014 at 02:14:48PM +0500, Shumaila Naeem wrote:
but when i try to do the same from command line it failed:
firstly i run command
guestfish -- add /dev/null : config -set drive.hd0.file=rbd:ssd-clonetest-rule5/ubuntu-12.04--1.raw.img : run : inspect-os
this is returning me : /dev/ubuntu-1204-vg/root
when i pass this output to get-distro , it failed
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 libguestfs: error: no inspection data: call guestfs_inspect_os first
this time i have called run
You're starting a new guestfish process. This creates a completely new handle. Any state in the old handle and old process is lost, so the fact you called inspect-os previously is not relevant. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
See also: http://libguestfs.org/guestfs.3.html#inspection "The call "guestfs_inspect_os" performs inspection and caches the results in the guest handle. Subsequent calls to guestfs_inspect_get_* return this cached information, but do not re-read the disks. If you change the content of the guest disks, you can redo inspection by calling "guestfs_inspect_os" again." 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://people.redhat.com/~rjones/virt-df/
participants (2)
-
Richard W.M. Jones -
Shumaila Naeem