check availbility of emulators before reporting them in capabilities

* src/qemu_conf.c: patch from Cole Robinson to report in the
  capabilities only the ones where the emulators is actually found
* po/libvirt.pot: regenerated
* src/libvirt.c: small typo fix
Daniel
This commit is contained in:
Daniel Veillard 2008-09-02 15:00:09 +00:00
parent 41ce15a586
commit b8f2610280
4 changed files with 1018 additions and 772 deletions

View File

@ -1,3 +1,10 @@
Tue Sep 2 16:55:01 CEST 2008 Daniel Veillard <veillard@redhat.com>
* src/qemu_conf.c: patch from Cole Robinson to report in the
capabilities only the ones where the emulators is actually found
* po/libvirt.pot: regenerated
* src/libvirt.c: small typo fix
Tue Sep 2 16:12:20 CEST 2008 Daniel Veillard <veillard@redhat.com>
* src/storage_backend.h src/storage_backend_logical.c

File diff suppressed because it is too large Load Diff

View File

@ -848,7 +848,7 @@ failed:
if (ret->driver) ret->driver->close (ret);
if (uri) xmlFreeURI(uri);
/* If not global error was set, copy any error set
/* If no global error was set, copy any error set
in the connection object we're about to dispose of */
if (__lastErr.code == VIR_ERR_OK) {
memcpy(&__lastErr, &ret->err, sizeof(ret->err));

View File

@ -226,7 +226,29 @@ qemudCapsInitGuest(virCapsPtr caps,
const struct qemu_arch_info *info,
int hvm) {
virCapsGuestPtr guest;
int i;
int i, haskvm, hasbase, samearch;
const char *kvmbin = NULL;
/* Check for existance of base emulator */
hasbase = (access(info->binary, X_OK) == 0);
samearch = STREQ(info->arch, hostmachine);
if (samearch) {
const char *const kvmbins[] = { "/usr/bin/qemu-kvm", /* Fedora */
"/usr/bin/kvm" }; /* Upstream .spec */
for (i = 0; i < ARRAY_CARDINALITY(kvmbins); ++i) {
if ((haskvm = (access(kvmbins[i], X_OK) == 0))) {
kvmbin = kvmbins[i];
break;
}
}
} else {
haskvm = 0;
}
if (!hasbase && !haskvm)
return 0;
if ((guest = virCapabilitiesAddGuest(caps,
hvm ? "hvm" : "xen",
@ -239,8 +261,7 @@ qemudCapsInitGuest(virCapsPtr caps,
return -1;
if (hvm) {
/* Check for existance of base emulator */
if (access(info->binary, X_OK) == 0 &&
if (hasbase &&
virCapabilitiesAddGuestDomain(guest,
"qemu",
NULL,
@ -250,7 +271,7 @@ qemudCapsInitGuest(virCapsPtr caps,
return -1;
/* If guest & host match, then we can accelerate */
if (STREQ(info->arch, hostmachine)) {
if (samearch) {
if (access("/dev/kqemu", F_OK) == 0 &&
virCapabilitiesAddGuestDomain(guest,
"kqemu",
@ -261,9 +282,10 @@ qemudCapsInitGuest(virCapsPtr caps,
return -1;
if (access("/dev/kvm", F_OK) == 0 &&
haskvm &&
virCapabilitiesAddGuestDomain(guest,
"kvm",
"/usr/bin/qemu-kvm",
kvmbin,
NULL,
0,
NULL) == NULL)