mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
Cleanup qemu binary detection logic in qemudCapsInitGuest()
There's no need for the hasbase/hasaltbase confusion, just store the first binary path found in a variable. * src/qemu_conf.c: kill hasbase/hasaltbase logic in qemudCapsInitGuest()
This commit is contained in:
parent
84255632cb
commit
7803e6f3ed
@ -370,17 +370,18 @@ qemudCapsInitGuest(virCapsPtr caps,
|
|||||||
int hvm) {
|
int hvm) {
|
||||||
virCapsGuestPtr guest;
|
virCapsGuestPtr guest;
|
||||||
int i;
|
int i;
|
||||||
int hasbase = 0;
|
|
||||||
int hasaltbase = 0;
|
|
||||||
int haskvm = 0;
|
int haskvm = 0;
|
||||||
int haskqemu = 0;
|
int haskqemu = 0;
|
||||||
const char *kvmbin = NULL;
|
const char *kvmbin = NULL;
|
||||||
|
const char *binary = NULL;
|
||||||
|
|
||||||
/* Check for existance of base emulator, or alternate base
|
/* Check for existance of base emulator, or alternate base
|
||||||
* which can be used with magic cpu choice
|
* which can be used with magic cpu choice
|
||||||
*/
|
*/
|
||||||
hasbase = (access(info->binary, X_OK) == 0);
|
if (access(info->binary, X_OK) == 0)
|
||||||
hasaltbase = (info->altbinary && access(info->altbinary, X_OK) == 0);
|
binary = info->binary;
|
||||||
|
else if (info->altbinary && access(info->altbinary, X_OK) == 0)
|
||||||
|
binary = info->altbinary;
|
||||||
|
|
||||||
/* Can use acceleration for KVM/KQEMU if
|
/* Can use acceleration for KVM/KQEMU if
|
||||||
* - host & guest arches match
|
* - host & guest arches match
|
||||||
@ -398,6 +399,8 @@ qemudCapsInitGuest(virCapsPtr caps,
|
|||||||
access("/dev/kvm", F_OK) == 0) {
|
access("/dev/kvm", F_OK) == 0) {
|
||||||
haskvm = 1;
|
haskvm = 1;
|
||||||
kvmbin = kvmbins[i];
|
kvmbin = kvmbins[i];
|
||||||
|
if (!binary)
|
||||||
|
binary = kvmbin;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,8 +409,7 @@ qemudCapsInitGuest(virCapsPtr caps,
|
|||||||
haskqemu = 1;
|
haskqemu = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!binary)
|
||||||
if (!hasbase && !hasaltbase && !haskvm)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* We register kvm as the base emulator too, since we can
|
/* We register kvm as the base emulator too, since we can
|
||||||
@ -416,8 +418,7 @@ qemudCapsInitGuest(virCapsPtr caps,
|
|||||||
hvm ? "hvm" : "xen",
|
hvm ? "hvm" : "xen",
|
||||||
info->arch,
|
info->arch,
|
||||||
info->wordsize,
|
info->wordsize,
|
||||||
(hasbase ? info->binary :
|
binary,
|
||||||
(hasaltbase ? info->altbinary : kvmbin)),
|
|
||||||
NULL,
|
NULL,
|
||||||
info->nmachines,
|
info->nmachines,
|
||||||
info->machines)) == NULL)
|
info->machines)) == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user