mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
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:
parent
a55fdc3f25
commit
729aa67db7
@ -3015,7 +3015,6 @@ int
|
|||||||
virQEMUCapsLoadCache(virCapsPtr caps,
|
virQEMUCapsLoadCache(virCapsPtr caps,
|
||||||
virQEMUCapsPtr qemuCaps,
|
virQEMUCapsPtr qemuCaps,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
time_t *qemuctime,
|
|
||||||
time_t *selfctime,
|
time_t *selfctime,
|
||||||
unsigned long *selfvers)
|
unsigned long *selfvers)
|
||||||
{
|
{
|
||||||
@ -3052,7 +3051,7 @@ virQEMUCapsLoadCache(virCapsPtr caps,
|
|||||||
_("missing qemuctime in QEMU capabilities XML"));
|
_("missing qemuctime in QEMU capabilities XML"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
*qemuctime = (time_t)l;
|
qemuCaps->ctime = (time_t)l;
|
||||||
|
|
||||||
if (virXPathLongLong("string(./selfctime)", ctxt, &l) < 0) {
|
if (virXPathLongLong("string(./selfctime)", ctxt, &l) < 0) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
@ -3453,7 +3452,7 @@ virQEMUCapsInitCached(virCapsPtr caps,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *binaryhash = NULL;
|
char *binaryhash = NULL;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
time_t qemuctime;
|
time_t qemuctime = qemuCaps->ctime;
|
||||||
time_t selfctime;
|
time_t selfctime;
|
||||||
unsigned long selfvers;
|
unsigned long selfvers;
|
||||||
|
|
||||||
@ -3489,7 +3488,7 @@ virQEMUCapsInitCached(virCapsPtr caps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virQEMUCapsLoadCache(caps, qemuCaps, capsfile,
|
if (virQEMUCapsLoadCache(caps, qemuCaps, capsfile,
|
||||||
&qemuctime, &selfctime, &selfvers) < 0) {
|
&selfctime, &selfvers) < 0) {
|
||||||
VIR_WARN("Failed to load cached caps from '%s' for '%s': %s",
|
VIR_WARN("Failed to load cached caps from '%s' for '%s': %s",
|
||||||
capsfile, qemuCaps->binary, virGetLastErrorMessage());
|
capsfile, qemuCaps->binary, virGetLastErrorMessage());
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
@ -3505,7 +3504,7 @@ virQEMUCapsInitCached(virCapsPtr caps,
|
|||||||
VIR_DEBUG("Outdated cached capabilities '%s' for '%s' "
|
VIR_DEBUG("Outdated cached capabilities '%s' for '%s' "
|
||||||
"(%lld vs %lld, %lld vs %lld, %lu vs %lu)",
|
"(%lld vs %lld, %lld vs %lld, %lu vs %lu)",
|
||||||
capsfile, qemuCaps->binary,
|
capsfile, qemuCaps->binary,
|
||||||
(long long)qemuctime, (long long)qemuCaps->ctime,
|
(long long)qemuCaps->ctime, (long long)qemuctime,
|
||||||
(long long)selfctime, (long long)virGetSelfLastChanged(),
|
(long long)selfctime, (long long)virGetSelfLastChanged(),
|
||||||
selfvers, (unsigned long)LIBVIR_VERSION_NUMBER);
|
selfvers, (unsigned long)LIBVIR_VERSION_NUMBER);
|
||||||
ignore_value(unlink(capsfile));
|
ignore_value(unlink(capsfile));
|
||||||
@ -3520,6 +3519,7 @@ virQEMUCapsInitCached(virCapsPtr caps,
|
|||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
cleanup:
|
cleanup:
|
||||||
|
qemuCaps->ctime = qemuctime;
|
||||||
VIR_FREE(binaryhash);
|
VIR_FREE(binaryhash);
|
||||||
VIR_FREE(capsfile);
|
VIR_FREE(capsfile);
|
||||||
VIR_FREE(capsdir);
|
VIR_FREE(capsdir);
|
||||||
|
@ -51,7 +51,6 @@ virQEMUCapsNewForBinaryInternal(virCapsPtr caps,
|
|||||||
int virQEMUCapsLoadCache(virCapsPtr caps,
|
int virQEMUCapsLoadCache(virCapsPtr caps,
|
||||||
virQEMUCapsPtr qemuCaps,
|
virQEMUCapsPtr qemuCaps,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
time_t *qemuctime,
|
|
||||||
time_t *selfctime,
|
time_t *selfctime,
|
||||||
unsigned long *selfvers);
|
unsigned long *selfvers);
|
||||||
char *virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps,
|
char *virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps,
|
||||||
|
@ -495,13 +495,12 @@ qemuTestParseCapabilities(virCapsPtr caps,
|
|||||||
const char *capsFile)
|
const char *capsFile)
|
||||||
{
|
{
|
||||||
virQEMUCapsPtr qemuCaps = NULL;
|
virQEMUCapsPtr qemuCaps = NULL;
|
||||||
time_t qemuctime;
|
|
||||||
time_t selfctime;
|
time_t selfctime;
|
||||||
unsigned long version;
|
unsigned long version;
|
||||||
|
|
||||||
if (!(qemuCaps = virQEMUCapsNew()) ||
|
if (!(qemuCaps = virQEMUCapsNew()) ||
|
||||||
virQEMUCapsLoadCache(caps, qemuCaps, capsFile,
|
virQEMUCapsLoadCache(caps, qemuCaps, capsFile,
|
||||||
&qemuctime, &selfctime, &version) < 0)
|
&selfctime, &version) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return qemuCaps;
|
return qemuCaps;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user