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 */
virDomainObjListPtr domains;
/* Lazy-load on first use. Unsafe. XXX */
/* Immutable pointer */
char *qemuImgBinary;
/* Immutable pointer, lockless APIs. Pointless abstraction */

View File

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

View File

@ -738,6 +738,9 @@ qemuStartup(bool privileged,
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 =
virLockManagerPluginNew(cfg->lockManagerName ?