I used libguestfs for transferring files from host OS to guest VM. It worked successfully. But since the tool being very huge and has many more functionalities, which my project doesn't need. I just want to use the functionality provided by virt-copy-in. Can you please tell where will I get the code which virt-copy-in uses internally? I have libguestfs folder. In that which files are used for the same functionality? Or else if u have code for the same, please do provide it.

Regards,
Priyanka Naik.

On Wed, Dec 31, 2014 at 5:31 PM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Tue, Dec 30, 2014 at 01:58:20PM +0530, Priyanka Naik wrote:
> I want to transfer files between host and guest. What are the ways to
> transfer these files? Is libguestfs the only way to transfer files between
> host and guest?

The question is under-specified.  If you provide details of your
requirements, we can answer better.

- What host?
- What guest?
- Which direction?
- Is the guest running?
- Continuous sharing or one-off transfer?

If the guest is running, then the problem is how do you transfer files
between networked machines, and the usual solutions apply, eg. scp,
NFS, SMB, ...

ONLY if the guest is NOT running, then you can use libguestfs to copy
files into the guest, eg.  virt-copy-in.

libguestfs can be used to extract files even from running guests, but
if the guest is running you MUST only use read-only commands.

Rich.


--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v