RE: Unable to start VM using COWed image

2010-11-11 Thread Prasad Joshi
 From: Prasad Joshi
 Sent: 10 November 2010 13:01
 To: Stefan Hajnoczi
 Cc: Keqin Hong; kvm@vger.kernel.org
 Subject: RE: Unable to start VM using COWed image

 From: Stefan Hajnoczi [stefa...@gmail.com]
 Sent: 10 November 2010 12:47
 To: Prasad Joshi
 Cc: Keqin Hong; kvm@vger.kernel.org
 Subject: Re: Unable to start VM using COWed image

 On Wed, Nov 10, 2010 at 12:40 PM, Prasad Joshi
p.g.jo...@student.reading.ac.uk wrote:
 From: Stefan Hajnoczi [stefa...@gmail.com]
 Sent: 10 November 2010 11:12
 To: Prasad Joshi
 Cc: Keqin Hong; kvm@vger.kernel.org
 Subject: Re: Unable to start VM using COWed image

 On Wed, Nov 10, 2010 at 10:08 AM, Prasad Joshi
 p.g.jo...@student.reading.ac.uk wrote:
 Where can I get the code of the qemu-kvm program?
 I cloned the qemu-lvm git repository and compiled the code. But it looks 
 like qemu-kvm program is not part of this code.--

 qemu-kvm.git contains the qemu-kvm codebase but the binary is built in
 x86_64-softmmu/qemu-system-x86_64.  Distro packages typically rename
 it to qemu-kvm.

 Thanks Stefan for your reply.

 I guess you pointed out the problem in the first mail. QEMU places a 
 restriction on location of the COWed file. The source image and COWed image 
 should be in the same drectory.

 In my case the source image was in directory /var/lib/libvirt/images/ and the 
 COWed image was in /home/prasad/Virtual directory.
 While debuging the source code using gdb I realized this limitation. It would 
 be good to fix this problem. I will see if I can solve this problem.

 This behavior is a feature.  You chose to use a relative backing file
 path when you used qemu-img create -b relative-path.

 If you want an absolute path you need to use qemu-img create -b
 /home/prasad/Virtual/... (i.e. specify an absolute path instead of a
 relative path).

 Oh I  see. I am such a stupid. ha ha ha ha
 Thanks a lot for letting me know.
 It worked after using absolute paths. Gr8 Thanks a lot.

Though specifying the absolute path for source image worked for me. 
Can any one please let me know the situation in which one would not want to 
specify the absolute path? 
How does relative path help? 
Advantage of using relative path rather than absolute path.

I think using the absolute path would always work.

 One more question on the same lines,
 How does QEMU detect the file is COWed and the name of the file (not whole 
 path) from it is COWed?

 COW support comes from the image file format that you choose.  A qcow
 file is not just a raw image file like the kind you can dd from a real
 disk.  Instead it has its own file format including a header and
 metadata for tracking allocated space.  The header contains the name
 of the backing file.

 Stefan
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Unable to start VM using COWed image

2010-11-11 Thread Stefan Hajnoczi
On Thu, Nov 11, 2010 at 12:17 PM, Prasad Joshi
p.g.jo...@student.reading.ac.uk wrote:
 Though specifying the absolute path for source image worked for me.
 Can any one please let me know the situation in which one would not want to 
 specify the absolute path?
 How does relative path help?
 Advantage of using relative path rather than absolute path.

 I think using the absolute path would always work.

Relative paths are useful when sharing images with other people.  An
absolute path won't work on another machine unless you use the same
parent directory structure.  If you send me an image file with an
absolute path in your home directory, I won't be able to use it easily
on my machine.

(Actually the new qemu-img rebase -u command can be used to fix up the
image file on the destination machine but it's an extra step and not
user-friendly.)

Stefan
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Unable to start VM using COWed image

2010-11-10 Thread Prasad Joshi
 From: Stefan Hajnoczi [stefa...@gmail.com]
 Sent: 10 November 2010 11:12
 To: Prasad Joshi
 Cc: Keqin Hong; kvm@vger.kernel.org
 Subject: Re: Unable to start VM using COWed image

On Wed, Nov 10, 2010 at 10:08 AM, Prasad Joshi
p.g.jo...@student.reading.ac.uk wrote:
 Where can I get the code of the qemu-kvm program?
 I cloned the qemu-lvm git repository and compiled the code. But it looks like 
 qemu-kvm program is not part of this code.--

 qemu-kvm.git contains the qemu-kvm codebase but the binary is built in
 x86_64-softmmu/qemu-system-x86_64.  Distro packages typically rename
 it to qemu-kvm.

Thanks Stefan for your reply.

I guess you pointed out the problem in the first mail. QEMU places a 
restriction on location of the COWed file. The source image and COWed image 
should be in the same drectory.

In my case the source image was in directory /var/lib/libvirt/images/ and the 
COWed image was in /home/prasad/Virtual directory.
While debuging the source code using gdb I realized this limitation. It would 
be good to fix this problem. I will see if I can solve this problem.

One more question on the same lines,
How does QEMU detect the file is COWed and the name of the file (not whole 
path) from it is COWed?

Once again thank a lot Stefan and Kegin

 Stefan
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Unable to start VM using COWed image

2010-11-10 Thread Prasad Joshi
Thanks a lot for your reply.

 From: Keqin Hong [kh...@redhat.com]
 Sent: 10 November 2010 01:56
 To: Prasad Joshi
 Subject: Re: Unable to start VM using COWed image

 - Prasad Joshi p.g.jo...@student.reading.ac.uk wrote:

 Hello,

 I am trying to run KVM machine from the image created as COW from the
 original image. But it not working.

 Screenshot that shows the KVM works with the original image

  [r...@prasad images]# qemu-kvm /var/lib/libvirt/images/Ubuntu.img -m
 512
 ^Z
 [1]+  Stopped qemu-kvm
 /var/lib/libvirt/images/Ubuntu.img -m 512
 [r...@prasad images]# bg
 [1]+ qemu-kvm /var/lib/libvirt/images/Ubuntu.img -m 512 
 [r...@prasad images]# pwd
 /var/lib/libvirt/images
 [r...@prasad images]# lsmod | grep -i kvm
 kvm_intel  42122  3
 kvm   257132  1 kvm_intel

 1. Created COW copy of the image after stoping the VM that was
 running

 [r...@prasad images]# pwd
 /var/lib/libvirt/images

 [r...@prasad images]# qemu-img create -b Ubuntu.img -f qcow
 /home/prasad/Virtual/Ubuntu_copy.ovl

 try adding -F base-fmt. Also qcow is obsolete, you'd better use qcow2
 e.g. qemu-img create -b Ubuntu.img -F raw -f qcow2 
 /home/prasad/Virtual/Ubuntu_copy.ovl

[r...@prasad images]# pwd
/var/lib/libvirt/images

[r...@prasad images]# date; qemu-img create -b Ubuntu.img -F raw -f qcow2 
/home/prasad/Virtual/Ubuntu_copy.ovl
Wed Nov 10 09:44:31 GMT 2010
Formatting '/home/prasad/Virtual/Ubuntu_copy.ovl', fmt=qcow2 size=8589934592 
backing_file='Ubuntu.img' backing_fmt='raw' encryption=off cluster_size=0 

[pra...@prasad Virtual]$ ls -l 
total 136
-rw-r--r--. 1 root root 262144 Nov 10 09:44 Ubuntu_copy.ovl

[pra...@prasad Virtual]$ sudo qemu-kvm ${PWD}/Ubuntu_copy.ovl -m 512
qemu: could not open disk image /home/prasad/Virtual/Ubuntu_copy.ovl: No such 
file or directory

[pra...@prasad Virtual]$ sudo qemu-kvm Ubuntu_copy.ovl -m 512
qemu: could not open disk image Ubuntu_copy.ovl: No such file or directory

[pra...@prasad Virtual]$ sudo qemu-kvm ./Ubuntu_copy.ovl -m 512
qemu: could not open disk image ./Ubuntu_copy.ovl: No such file or directory


 2. Trying to run VM using the copy created

 [pra...@prasad Virtual]$ ls -l
 total 36
 -rw-r--r--. 1 root root 32832 Nov  9 15:33 Ubuntu_copy.ovl

 [pra...@prasad Virtual]$ qemu-kvm Ubuntu_copy.ovl -m 512
 qemu: could not open disk image Ubuntu_copy.ovl: Permission denied

 [pra...@prasad Virtual]$ sudo qemu-kvm Ubuntu_copy.ovl -m 512
 qemu: could not open disk image Ubuntu_copy.ovl: No such file or
 directory
something like this may help:
qemu -drive file=$file,index=0,media=disk,format=qcow2


 [pra...@prasad Virtual]$ sudo qemu-kvm ./Ubuntu_copy.ovl -m 512
 qemu: could not open disk image ./Ubuntu_copy.ovl: No such file or
 directory

 [pra...@prasad Virtual]$ qemu-kvm ${PWD}/Ubuntu_copy.ovl -m 512
 qemu: could not open disk image /home/prasad/Virtual/Ubuntu_copy.ovl:
 Permission denied

 [pra...@prasad Virtual]$ sudo qemu-kvm ${PWD}/Ubuntu_copy.ovl -m 512
 qemu: could not open disk image /home/prasad/Virtual/Ubuntu_copy.ovl:
 No such file or directory

 Why is it failing?

 Thanks and Regards,
 Prasad Joshi
 --
 To unsubscribe from this list: send the line unsubscribe kvm in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Unable to start VM using COWed image

2010-11-10 Thread Prasad Joshi

 try adding -F base-fmt. Also qcow is obsolete, you'd better use qcow2
 e.g. qemu-img create -b Ubuntu.img -F raw -f qcow2 
 /home/prasad/Virtual/Ubuntu_copy.ovl

[r...@prasad images]# pwd
/var/lib/libvirt/images

[r...@prasad images]# date; qemu-img create -b Ubuntu.img -F raw -f qcow2 
/home/prasad/Virtual/Ubuntu_copy.ovl
Wed Nov 10 09:44:31 GMT 2010
Formatting '/home/prasad/Virtual/Ubuntu_copy.ovl', fmt=qcow2 size=8589934592 
backing_file='Ubuntu.img' backing_fmt='raw' encryption=off cluster_size=0

[pra...@prasad Virtual]$ ls -l
total 136
-rw-r--r--. 1 root root 262144 Nov 10 09:44 Ubuntu_copy.ovl

[pra...@prasad Virtual]$ sudo qemu-kvm ${PWD}/Ubuntu_copy.ovl -m 512
qemu: could not open disk image /home/prasad/Virtual/Ubuntu_copy.ovl: No such 
file or directory

[pra...@prasad Virtual]$ sudo qemu-kvm Ubuntu_copy.ovl -m 512
qemu: could not open disk image Ubuntu_copy.ovl: No such file or directory

[pra...@prasad Virtual]$ sudo qemu-kvm ./Ubuntu_copy.ovl -m 512
qemu: could not open disk image ./Ubuntu_copy.ovl: No such file or directory



Where can I get the code of the qemu-kvm program?
I cloned the qemu-lvm git repository and compiled the code. But it looks like 
qemu-kvm program is not part of this code.--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Unable to start VM using COWed image

2010-11-10 Thread Stefan Hajnoczi
On Wed, Nov 10, 2010 at 10:08 AM, Prasad Joshi
p.g.jo...@student.reading.ac.uk wrote:
 Where can I get the code of the qemu-kvm program?
 I cloned the qemu-lvm git repository and compiled the code. But it looks like 
 qemu-kvm program is not part of this code.--

qemu-kvm.git contains the qemu-kvm codebase but the binary is built in
x86_64-softmmu/qemu-system-x86_64.  Distro packages typically rename
it to qemu-kvm.

Stefan
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Unable to start VM using COWed image

2010-11-10 Thread Stefan Hajnoczi
On Wed, Nov 10, 2010 at 12:40 PM, Prasad Joshi
p.g.jo...@student.reading.ac.uk wrote:
 From: Stefan Hajnoczi [stefa...@gmail.com]
 Sent: 10 November 2010 11:12
 To: Prasad Joshi
 Cc: Keqin Hong; kvm@vger.kernel.org
 Subject: Re: Unable to start VM using COWed image

 On Wed, Nov 10, 2010 at 10:08 AM, Prasad Joshi
 p.g.jo...@student.reading.ac.uk wrote:
 Where can I get the code of the qemu-kvm program?
 I cloned the qemu-lvm git repository and compiled the code. But it looks 
 like qemu-kvm program is not part of this code.--

 qemu-kvm.git contains the qemu-kvm codebase but the binary is built in
 x86_64-softmmu/qemu-system-x86_64.  Distro packages typically rename
 it to qemu-kvm.

 Thanks Stefan for your reply.

 I guess you pointed out the problem in the first mail. QEMU places a 
 restriction on location of the COWed file. The source image and COWed image 
 should be in the same drectory.

 In my case the source image was in directory /var/lib/libvirt/images/ and the 
 COWed image was in /home/prasad/Virtual directory.
 While debuging the source code using gdb I realized this limitation. It would 
 be good to fix this problem. I will see if I can solve this problem.

This behavior is a feature.  You chose to use a relative backing file
path when you used qemu-img create -b relative-path.

If you want an absolute path you need to use qemu-img create -b
/home/prasad/Virtual/... (i.e. specify an absolute path instead of a
relative path).

 One more question on the same lines,
 How does QEMU detect the file is COWed and the name of the file (not whole 
 path) from it is COWed?

COW support comes from the image file format that you choose.  A qcow
file is not just a raw image file like the kind you can dd from a real
disk.  Instead it has its own file format including a header and
metadata for tracking allocated space.  The header contains the name
of the backing file.

Stefan
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Unable to start VM using COWed image

2010-11-10 Thread Prasad Joshi
 From: Stefan Hajnoczi [stefa...@gmail.com]
 Sent: 10 November 2010 12:47
 To: Prasad Joshi
 Cc: Keqin Hong; kvm@vger.kernel.org
 Subject: Re: Unable to start VM using COWed image

 On Wed, Nov 10, 2010 at 12:40 PM, Prasad Joshi
p.g.jo...@student.reading.ac.uk wrote:
 From: Stefan Hajnoczi [stefa...@gmail.com]
 Sent: 10 November 2010 11:12
 To: Prasad Joshi
 Cc: Keqin Hong; kvm@vger.kernel.org
 Subject: Re: Unable to start VM using COWed image

 On Wed, Nov 10, 2010 at 10:08 AM, Prasad Joshi
 p.g.jo...@student.reading.ac.uk wrote:
 Where can I get the code of the qemu-kvm program?
 I cloned the qemu-lvm git repository and compiled the code. But it looks 
 like qemu-kvm program is not part of this code.--

 qemu-kvm.git contains the qemu-kvm codebase but the binary is built in
 x86_64-softmmu/qemu-system-x86_64.  Distro packages typically rename
 it to qemu-kvm.

 Thanks Stefan for your reply.

 I guess you pointed out the problem in the first mail. QEMU places a 
 restriction on location of the COWed file. The source image and COWed image 
 should be in the same drectory.

 In my case the source image was in directory /var/lib/libvirt/images/ and the 
 COWed image was in /home/prasad/Virtual directory.
 While debuging the source code using gdb I realized this limitation. It would 
 be good to fix this problem. I will see if I can solve this problem.

 This behavior is a feature.  You chose to use a relative backing file
 path when you used qemu-img create -b relative-path.

 If you want an absolute path you need to use qemu-img create -b
 /home/prasad/Virtual/... (i.e. specify an absolute path instead of a
 relative path).

Oh I  see. I am such a stupid. ha ha ha ha
Thanks a lot for letting me know.
It worked after using absolute paths. Gr8 Thanks a lot.

 One more question on the same lines,
 How does QEMU detect the file is COWed and the name of the file (not whole 
 path) from it is COWed?

 COW support comes from the image file format that you choose.  A qcow
 file is not just a raw image file like the kind you can dd from a real
 disk.  Instead it has its own file format including a header and
 metadata for tracking allocated space.  The header contains the name
 of the backing file.

 Stefan
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Unable to start VM using COWed image

2010-11-09 Thread Prasad Joshi
Hello,

I am trying to run KVM machine from the image created as COW from the original 
image. But it not working.

Screenshot that shows the KVM works with the original image

 [r...@prasad images]# qemu-kvm /var/lib/libvirt/images/Ubuntu.img -m 512
^Z
[1]+  Stopped qemu-kvm /var/lib/libvirt/images/Ubuntu.img -m 512
[r...@prasad images]# bg
[1]+ qemu-kvm /var/lib/libvirt/images/Ubuntu.img -m 512 
[r...@prasad images]# pwd
/var/lib/libvirt/images
[r...@prasad images]# lsmod | grep -i kvm
kvm_intel  42122  3 
kvm   257132  1 kvm_intel

1. Created COW copy of the image after stoping the VM that was running

[r...@prasad images]# pwd
/var/lib/libvirt/images

[r...@prasad images]# qemu-img create -b Ubuntu.img -f qcow 
/home/prasad/Virtual/Ubuntu_copy.ovl

2. Trying to run VM using the copy created

[pra...@prasad Virtual]$ ls -l
total 36
-rw-r--r--. 1 root root 32832 Nov  9 15:33 Ubuntu_copy.ovl

[pra...@prasad Virtual]$ qemu-kvm Ubuntu_copy.ovl -m 512
qemu: could not open disk image Ubuntu_copy.ovl: Permission denied

[pra...@prasad Virtual]$ sudo qemu-kvm Ubuntu_copy.ovl -m 512
qemu: could not open disk image Ubuntu_copy.ovl: No such file or directory

[pra...@prasad Virtual]$ sudo qemu-kvm ./Ubuntu_copy.ovl -m 512
qemu: could not open disk image ./Ubuntu_copy.ovl: No such file or directory

[pra...@prasad Virtual]$ qemu-kvm ${PWD}/Ubuntu_copy.ovl -m 512
qemu: could not open disk image /home/prasad/Virtual/Ubuntu_copy.ovl: 
Permission denied

[pra...@prasad Virtual]$ sudo qemu-kvm ${PWD}/Ubuntu_copy.ovl -m 512
qemu: could not open disk image /home/prasad/Virtual/Ubuntu_copy.ovl: No such 
file or directory

Why is it failing?

Thanks and Regards,
Prasad Joshi
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Unable to start VM using COWed image

2010-11-09 Thread Stefan Hajnoczi
On Tue, Nov 9, 2010 at 3:36 PM, Prasad Joshi
p.g.jo...@student.reading.ac.uk wrote:
 Hello,

 I am trying to run KVM machine from the image created as COW from the 
 original image. But it not working.

 Screenshot that shows the KVM works with the original image

  [r...@prasad images]# qemu-kvm /var/lib/libvirt/images/Ubuntu.img -m 512
 ^Z
 [1]+  Stopped                 qemu-kvm /var/lib/libvirt/images/Ubuntu.img -m 
 512
 [r...@prasad images]# bg
 [1]+ qemu-kvm /var/lib/libvirt/images/Ubuntu.img -m 512 
 [r...@prasad images]# pwd
 /var/lib/libvirt/images
 [r...@prasad images]# lsmod | grep -i kvm
 kvm_intel              42122  3
 kvm                   257132  1 kvm_intel

 1. Created COW copy of the image after stoping the VM that was running

 [r...@prasad images]# pwd
 /var/lib/libvirt/images

 [r...@prasad images]# qemu-img create -b Ubuntu.img -f qcow 
 /home/prasad/Virtual/Ubuntu_copy.ovl

 2. Trying to run VM using the copy created

 [pra...@prasad Virtual]$ ls -l
 total 36
 -rw-r--r--. 1 root root 32832 Nov  9 15:33 Ubuntu_copy.ovl

Why is Ubuntu.img not visible in the ls output?

Ubuntu.img is a relative path to the backing file.  It looks like QEMU
will not be able to open the backing file.

Also, is there a reason you're using qcow and not qcow2?

Stefan
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html