[libvirt] [PATCH v2] qemu driver: use lseek64 for setting position in logfile

V2: - removed replacements of lseek() to lseek64() from patch While doing some testing with Qemu and creating huge logfiles I encountered the case where the VM could not start anymore due to the lseek() to the end of the Qemu VM's log file failing. The patch below fixes the problem by replacing the previously used 'int' with 'off_t'. To reproduce this error, you could do the following: dd if=/dev/zero of=/var/log/libvirt/qemu/<name of VM>.log bs=1024 count=$((1024*2048)) and you should get an error like this: error: Failed to start domain <name of VM> error: Unable to seek to -2147482651 in /var/log/libvirt/qemu/<name of VM>.log: Success Signed-off-by: Stefan Berger <stefanb@us.ibm.com> --- src/qemu/qemu_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: libvirt-acl/src/qemu/qemu_driver.c =================================================================== --- libvirt-acl.orig/src/qemu/qemu_driver.c +++ libvirt-acl/src/qemu/qemu_driver.c @@ -2624,7 +2624,7 @@ static int qemudStartVMDaemon(virConnect enum virVMOperationType vmop) { int ret; unsigned long long qemuCmdFlags; - int pos = -1; + off_t pos = -1; char ebuf[1024]; char *pidfile = NULL; int logfile = -1;

On 01/04/2011 09:43 AM, Stefan Berger wrote:
V2: - removed replacements of lseek() to lseek64() from patch
While doing some testing with Qemu and creating huge logfiles I encountered the case where the VM could not start anymore due to the lseek() to the end of the Qemu VM's log file failing. The patch below fixes the problem by replacing the previously used 'int' with 'off_t'.
ACK; please push :) -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Tue, Jan 04, 2011 at 10:16:54AM -0700, Eric Blake wrote:
On 01/04/2011 09:43 AM, Stefan Berger wrote:
V2: - removed replacements of lseek() to lseek64() from patch
While doing some testing with Qemu and creating huge logfiles I encountered the case where the VM could not start anymore due to the lseek() to the end of the Qemu VM's log file failing. The patch below fixes the problem by replacing the previously used 'int' with 'off_t'.
ACK; please push :)
With a more accurate commit message now that its not using lseek64.... Daniel

On 01/04/2011 10:22 AM, Daniel P. Berrange wrote:
On Tue, Jan 04, 2011 at 10:16:54AM -0700, Eric Blake wrote:
On 01/04/2011 09:43 AM, Stefan Berger wrote:
V2: - removed replacements of lseek() to lseek64() from patch
While doing some testing with Qemu and creating huge logfiles I encountered the case where the VM could not start anymore due to the lseek() to the end of the Qemu VM's log file failing. The patch below fixes the problem by replacing the previously used 'int' with 'off_t'.
ACK; please push :)
With a more accurate commit message now that its not using lseek64....
Oops - I was blinded to the inaccurate first line of the commit message, since it's in the subject rather than the body of the mail :) -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 01/04/2011 12:16 PM, Eric Blake wrote:
On 01/04/2011 09:43 AM, Stefan Berger wrote:
V2: - removed replacements of lseek() to lseek64() from patch
While doing some testing with Qemu and creating huge logfiles I encountered the case where the VM could not start anymore due to the lseek() to the end of the Qemu VM's log file failing. The patch below fixes the problem by replacing the previously used 'int' with 'off_t'. ACK; please push :)
Done. I fixed the header on the way to a more accurate description. Stefan
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Stefan Berger