mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-20 11:48:28 -06:00
Probe machine types from kvm binary too
Currently we only probe the main qemu binary for machine types, but we should also probe the kvm binary. * src/qemu_conf.c: probe kvm binary machines in qemudCapsInitGuest()
This commit is contained in:
parent
f5dd3bcde9
commit
3e14a8dc80
@ -710,14 +710,48 @@ qemudCapsInitGuest(virCapsPtr caps,
|
||||
NULL) == NULL)
|
||||
return -1;
|
||||
|
||||
if (haskvm &&
|
||||
virCapabilitiesAddGuestDomain(guest,
|
||||
if (haskvm) {
|
||||
virCapsGuestDomainPtr dom;
|
||||
|
||||
if (stat(kvmbin, &st) == 0) {
|
||||
binary_mtime = st.st_mtime;
|
||||
} else {
|
||||
char ebuf[1024];
|
||||
VIR_WARN(_("Failed to stat %s, most peculiar : %s"),
|
||||
binary, virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||
binary_mtime = 0;
|
||||
}
|
||||
|
||||
machines = NULL;
|
||||
nmachines = 0;
|
||||
|
||||
if (!STREQ(binary, kvmbin)) {
|
||||
int probe = 1;
|
||||
if (old_caps && binary_mtime)
|
||||
probe = !qemudGetOldMachines("hvm", info->arch, info->wordsize,
|
||||
kvmbin, binary_mtime,
|
||||
old_caps, &machines, &nmachines);
|
||||
if (probe &&
|
||||
qemudProbeMachineTypes(kvmbin, &machines, &nmachines) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((dom = virCapabilitiesAddGuestDomain(guest,
|
||||
"kvm",
|
||||
kvmbin,
|
||||
NULL,
|
||||
0,
|
||||
NULL) == NULL)
|
||||
nmachines,
|
||||
machines)) == NULL) {
|
||||
for (i = 0; i < nmachines; i++) {
|
||||
VIR_FREE(machines[i]->name);
|
||||
VIR_FREE(machines[i]);
|
||||
}
|
||||
VIR_FREE(machines);
|
||||
return -1;
|
||||
}
|
||||
|
||||
dom->info.emulator_mtime = binary_mtime;
|
||||
}
|
||||
} else {
|
||||
if (virCapabilitiesAddGuestDomain(guest,
|
||||
"kvm",
|
||||
|
Loading…
Reference in New Issue
Block a user