qemu: Store loaded QEMU binary ctime in qemuCaps

virQEMUCapsLoadCache loads QEMU capabilities from a file, but strangely
enough it returns the loaded QEMU binary ctime in qemuctime parameter
instead of storing it in qemuCaps.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-10-27 10:54:13 +02:00
parent a55fdc3f25
commit 729aa67db7
3 changed files with 6 additions and 8 deletions

View File

@ -3015,7 +3015,6 @@ int
virQEMUCapsLoadCache(virCapsPtr caps,
virQEMUCapsPtr qemuCaps,
const char *filename,
time_t *qemuctime,
time_t *selfctime,
unsigned long *selfvers)
{
@ -3052,7 +3051,7 @@ virQEMUCapsLoadCache(virCapsPtr caps,
_("missing qemuctime in QEMU capabilities XML"));
goto cleanup;
}
*qemuctime = (time_t)l;
qemuCaps->ctime = (time_t)l;
if (virXPathLongLong("string(./selfctime)", ctxt, &l) < 0) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@ -3453,7 +3452,7 @@ virQEMUCapsInitCached(virCapsPtr caps,
int ret = -1;
char *binaryhash = NULL;
struct stat sb;
time_t qemuctime;
time_t qemuctime = qemuCaps->ctime;
time_t selfctime;
unsigned long selfvers;
@ -3489,7 +3488,7 @@ virQEMUCapsInitCached(virCapsPtr caps,
}
if (virQEMUCapsLoadCache(caps, qemuCaps, capsfile,
&qemuctime, &selfctime, &selfvers) < 0) {
&selfctime, &selfvers) < 0) {
VIR_WARN("Failed to load cached caps from '%s' for '%s': %s",
capsfile, qemuCaps->binary, virGetLastErrorMessage());
virResetLastError();
@ -3505,7 +3504,7 @@ virQEMUCapsInitCached(virCapsPtr caps,
VIR_DEBUG("Outdated cached capabilities '%s' for '%s' "
"(%lld vs %lld, %lld vs %lld, %lu vs %lu)",
capsfile, qemuCaps->binary,
(long long)qemuctime, (long long)qemuCaps->ctime,
(long long)qemuCaps->ctime, (long long)qemuctime,
(long long)selfctime, (long long)virGetSelfLastChanged(),
selfvers, (unsigned long)LIBVIR_VERSION_NUMBER);
ignore_value(unlink(capsfile));
@ -3520,6 +3519,7 @@ virQEMUCapsInitCached(virCapsPtr caps,
ret = 1;
cleanup:
qemuCaps->ctime = qemuctime;
VIR_FREE(binaryhash);
VIR_FREE(capsfile);
VIR_FREE(capsdir);

View File

@ -51,7 +51,6 @@ virQEMUCapsNewForBinaryInternal(virCapsPtr caps,
int virQEMUCapsLoadCache(virCapsPtr caps,
virQEMUCapsPtr qemuCaps,
const char *filename,
time_t *qemuctime,
time_t *selfctime,
unsigned long *selfvers);
char *virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps,

View File

@ -495,13 +495,12 @@ qemuTestParseCapabilities(virCapsPtr caps,
const char *capsFile)
{
virQEMUCapsPtr qemuCaps = NULL;
time_t qemuctime;
time_t selfctime;
unsigned long version;
if (!(qemuCaps = virQEMUCapsNew()) ||
virQEMUCapsLoadCache(caps, qemuCaps, capsFile,
&qemuctime, &selfctime, &version) < 0)
&selfctime, &version) < 0)
goto error;
return qemuCaps;