FYI, I just pushed this fix (with blessing from DV):
commit d62f4c36c2c28b96952143247a1360e8c18f64c7
Author: Chris Lalancette <clalance(a)redhat.com>
Date: Tue Mar 23 09:11:29 2010 -0400
Don't use virFileReadLimFD in qemuDomainRestore.
virFileReadLimFD is a poor fit for reading the header
of the restore file. The problem is that virFileReadLimFD
returns an error when there is more data after the amount
you ask to read, but that is *expected* in this case.
This patch is essentially a revert of
1a4d5c9543641c444dccd682f6256ee3faf22a80, but I don't think
that commit does what it says anyway. It purports to prevent
an unwarranted OOM error, but since virFileReadLimFD will
allocate memory up to the maximum anyway, the upper limit
on the total amount of memory allocated is the same for either
the old version or the new version. Since the old saferead
actually works and virFileReadLimFD does not, revert to
using saferead.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4291bc7..70d2781 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5547,7 +5547,12 @@ static int qemudDomainRestore(virConnectPtr conn,
goto cleanup;
}
- if (virFileReadLimFD(fd, header.xml_len, &xml) != header.xml_len) {
+ if (VIR_ALLOC_N(xml, header.xml_len) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if (saferead(fd, xml, header.xml_len) != header.xml_len) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("failed to read XML"));
goto cleanup;
--
Chris Lalancette
Show replies by date
On Fri, Apr 02, 2010 at 09:28:15AM -0400, Chris Lalancette wrote:
FYI, I just pushed this fix (with blessing from DV):
confirmed it fixed the restore failure problem with qemu I saw
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/