Initialize qemuImageBinary path at startup

This commit is contained in:
Daniel P. Berrange 2013-01-23 12:19:15 +00:00
parent 34589575bd
commit 0f5e3f136f
3 changed files with 7 additions and 9 deletions

View File

@ -177,7 +177,7 @@ struct _virQEMUDriver {
/* Immutable pointer, self-locking APIs */ /* Immutable pointer, self-locking APIs */
virDomainObjListPtr domains; virDomainObjListPtr domains;
/* Lazy-load on first use. Unsafe. XXX */ /* Immutable pointer */
char *qemuImgBinary; char *qemuImgBinary;
/* Immutable pointer, lockless APIs. Pointless abstraction */ /* Immutable pointer, lockless APIs. Pointless abstraction */

View File

@ -1612,14 +1612,9 @@ cleanup:
const char * const char *
qemuFindQemuImgBinary(virQEMUDriverPtr driver) qemuFindQemuImgBinary(virQEMUDriverPtr driver)
{ {
if (!driver->qemuImgBinary) { if (!driver->qemuImgBinary)
driver->qemuImgBinary = virFindFileInPath("kvm-img"); virReportError(VIR_ERR_INTERNAL_ERROR,
if (!driver->qemuImgBinary) "%s", _("unable to find kvm-img or qemu-img"));
driver->qemuImgBinary = virFindFileInPath("qemu-img");
if (!driver->qemuImgBinary)
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unable to find kvm-img or qemu-img"));
}
return driver->qemuImgBinary; return driver->qemuImgBinary;
} }

View File

@ -738,6 +738,9 @@ qemuStartup(bool privileged,
virStrerror(-rc, ebuf, sizeof(ebuf))); virStrerror(-rc, ebuf, sizeof(ebuf)));
} }
qemu_driver->qemuImgBinary = virFindFileInPath("kvm-img");
if (!qemu_driver->qemuImgBinary)
qemu_driver->qemuImgBinary = virFindFileInPath("qemu-img");
if (!(qemu_driver->lockManager = if (!(qemu_driver->lockManager =
virLockManagerPluginNew(cfg->lockManagerName ? virLockManagerPluginNew(cfg->lockManagerName ?