Re: [Libguestfs] mounting using guestfish
On Fri, Mar 09, 2012 at 01:11:23AM -0800, THO HUYNH wrote:
Do you have any documentation about the implementation of mounting using guestfish. I want to know how it works inside then write the script.
Libguestfs live access works slightly differently from ordinary use of libguestfs, and all the examples only explain the ordinary way. The main documentation is here: http://libguestfs.org/guestfs.3.html#api_overview Once you've decided what language you want to use, you'll need to follow one of these pages: http://libguestfs.org/guestfs-perl.3.html http://libguestfs.org/guestfs-python.3.html http://libguestfs.org/guestfs-ocaml.3.html http://libguestfs.org/guestfs-ruby.3.html http://libguestfs.org/guestfs-java.3.html Because it's live, you need to add the domain using the 'live' option, see: http://libguestfs.org/guestfs.3.html#guestfs_add_domain To download and upload between handles, you'll need to use two threads, a pipe between them, and the regular download/upload APIs: http://libguestfs.org/guestfs.3.html#guestfs_download http://libguestfs.org/guestfs.3.html#guestfs_upload http://libguestfs.org/guestfs.3.html#guestfs_tar_out http://libguestfs.org/guestfs.3.html#guestfs_tar_in (etc) I suggest writing some code and reading the many programs in the source of libguestfs, and if you get stuck, posting specific questions on the mailing list. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
thanks :) ________________________________ From: Richard W.M. Jones <rjones@redhat.com> To: THO HUYNH <feeliwood@yahoo.com> Cc: libguestfs@redhat.com Sent: Friday, 9 March 2012, 16:52 Subject: Re: mounting using guestfish On Fri, Mar 09, 2012 at 01:11:23AM -0800, THO HUYNH wrote:
Do you have any documentation about the implementation of mounting using guestfish. I want to know how it works inside then write the script.
Libguestfs live access works slightly differently from ordinary use of libguestfs, and all the examples only explain the ordinary way. The main documentation is here: http://libguestfs.org/guestfs.3.html#api_overview Once you've decided what language you want to use, you'll need to follow one of these pages: http://libguestfs.org/guestfs-perl.3.html http://libguestfs.org/guestfs-python.3.html http://libguestfs.org/guestfs-ocaml.3.html http://libguestfs.org/guestfs-ruby.3.html http://libguestfs.org/guestfs-java.3.html Because it's live, you need to add the domain using the 'live' option, see: http://libguestfs.org/guestfs.3.html#guestfs_add_domain To download and upload between handles, you'll need to use two threads, a pipe between them, and the regular download/upload APIs: http://libguestfs.org/guestfs.3.html#guestfs_download http://libguestfs.org/guestfs.3.html#guestfs_upload http://libguestfs.org/guestfs.3.html#guestfs_tar_out http://libguestfs.org/guestfs.3.html#guestfs_tar_in (etc) I suggest writing some code and reading the many programs in the source of libguestfs, and if you get stuck, posting specific questions on the mailing list. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
Try this program. You will need both patches ... https://www.redhat.com/archives/libguestfs/2012-March/msg00044.html https://www.redhat.com/archives/libguestfs/2012-March/msg00045.html For libguestfs live you will have to modify the open_guest function, to add 'GUESTFS_ADD_DOMAIN_LIVE, 1', and to remove all of the inspect_os and mount code. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
I`m reading, thank you Mr.Rich :) ________________________________ From: Richard W.M. Jones <rjones@redhat.com> To: THO HUYNH <feeliwood@yahoo.com>; libguestfs@redhat.com Cc: "libguestfs@redhat.com" <libguestfs@redhat.com> Sent: Friday, 9 March 2012, 20:19 Subject: Re: [Libguestfs] mounting using guestfish Try this program. You will need both patches ... https://www.redhat.com/archives/libguestfs/2012-March/msg00044.html https://www.redhat.com/archives/libguestfs/2012-March/msg00045.html For libguestfs live you will have to modify the open_guest function, to add 'GUESTFS_ADD_DOMAIN_LIVE, 1', and to remove all of the inspect_os and mount code. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
hi Mr.Rich, I read the two patches you sent me. But I don`t understand what exactly I can do with them yet. Make reference to them or I can use them directly? Comment if you have time. Thank you :) ________________________________ From: Richard W.M. Jones <rjones@redhat.com> To: THO HUYNH <feeliwood@yahoo.com>; libguestfs@redhat.com Cc: "libguestfs@redhat.com" <libguestfs@redhat.com> Sent: Friday, 9 March 2012, 20:19 Subject: Re: [Libguestfs] mounting using guestfish Try this program. You will need both patches ... https://www.redhat.com/archives/libguestfs/2012-March/msg00044.html https://www.redhat.com/archives/libguestfs/2012-March/msg00045.html For libguestfs live you will have to modify the open_guest function, to add 'GUESTFS_ADD_DOMAIN_LIVE, 1', and to remove all of the inspect_os and mount code. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
Hi Mr.Rich, I downloaded libguestfs-.1.16.5.tar.gz package on www.libguestfs.org I tried to patch this package with the two patches you gave me. Here is the result I got: [root@Fedora16 Downloads]# tar -xvf libguestfs-1.16.5.tar.gz [root@Fedora16 Downloads]# patch -Np1 --ignore-whitespace -d libguestfs-1.16.5 < p1.patch patching file src/launch.c Hunk #1 succeeded at 833 (offset -11 lines). [root@Fedora16 Downloads]# patch -Np1 --ignore-whitespace -d libguestfs-1.16.5 < p2.patch patching file .gitignore Hunk #1 succeeded at 73 with fuzz 2. patching file examples/Makefile.am Hunk #1 FAILED at 27. 1 out of 1 hunk FAILED -- saving rejects to file examples/Makefile.am.rej patching file examples/copy_over.c p1.patch and p2.patch are the 2 patches respectively. I tried --ignore-whitespace flag and dos2unix on p2.patch but still failed. I can get into examples/Makefile.am and patch it manually but I want something automatically. Can you take a look at the patch please. Thanks. ________________________________ From: Richard W.M. Jones <rjones@redhat.com> To: THO HUYNH <feeliwood@yahoo.com>; libguestfs@redhat.com Cc: "libguestfs@redhat.com" <libguestfs@redhat.com> Sent: Friday, 9 March 2012, 20:19 Subject: Re: [Libguestfs] mounting using guestfish Try this program. You will need both patches ... https://www.redhat.com/archives/libguestfs/2012-March/msg00044.html https://www.redhat.com/archives/libguestfs/2012-March/msg00045.html For libguestfs live you will have to modify the open_guest function, to add 'GUESTFS_ADD_DOMAIN_LIVE, 1', and to remove all of the inspect_os and mount code. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
On Tue, Mar 20, 2012 at 04:17:09AM -0700, THO HUYNH wrote:
Hi Mr.Rich,
I downloaded libguestfs-.1.16.5.tar.gz package on www.libguestfs.org
I tried to patch this package with the two patches you gave me. Here is the result I got:
[root@Fedora16 Downloads]# tar -xvf libguestfs-1.16.5.tar.gz
[root@Fedora16 Downloads]# patch -Np1 --ignore-whitespace -d libguestfs-1.16.5 < p1.patch patching file src/launch.c Hunk #1 succeeded at 833 (offset -11 lines).
[root@Fedora16 Downloads]# patch -Np1 --ignore-whitespace -d libguestfs-1.16.5 < p2.patch patching file .gitignore Hunk #1 succeeded at 73 with fuzz 2. patching file examples/Makefile.am Hunk #1 FAILED at 27. 1 out of 1 hunk FAILED -- saving rejects to file examples/Makefile.am.rej patching file examples/copy_over.c
p1.patch and p2.patch are the 2 patches respectively. I tried --ignore-whitespace flag and dos2unix on p2.patch but still failed. I can get into examples/Makefile.am and patch it manually but I want something automatically. Can you take a look at the patch please.
The patches are fine, they simply need to be "rebased" on top of the stable branch. If you're set on downloading and compiling from the source, you may as well just use libguestfs from git which includes this program already. As I suggested before, get someone local to you who can help you with tasks like patching and compiling. 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#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
participants (2)
-
Richard W.M. Jones -
THO HUYNH