mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Split up qemudGetOldMachines()
We need to look at all the domain infos in guest capabilities, not just the defaults. In order to allow that, split out a qemudGetOldMachinesFromInfo() from qemudGetOldMachines(). We'll make more use of it in the next patch. * src/qemu_conf.c: split out qemudGetOldMachinesFromInfo() from qemudGetOldMachines()
This commit is contained in:
parent
aa67241bde
commit
44646747a7
@ -496,27 +496,17 @@ rewait:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemudGetOldMachines(const char *ostype,
|
qemudGetOldMachinesFromInfo(virCapsGuestDomainInfoPtr info,
|
||||||
const char *arch,
|
|
||||||
int wordsize,
|
|
||||||
const char *emulator,
|
const char *emulator,
|
||||||
time_t emulator_mtime,
|
time_t emulator_mtime,
|
||||||
virCapsPtr old_caps,
|
|
||||||
virCapsGuestMachinePtr **machines,
|
virCapsGuestMachinePtr **machines,
|
||||||
int *nmachines)
|
int *nmachines)
|
||||||
{
|
{
|
||||||
|
virCapsGuestMachinePtr *list;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < old_caps->nguests; i++) {
|
if (!info->emulator || !STREQ(emulator, info->emulator))
|
||||||
virCapsGuestPtr guest = old_caps->guests[i];
|
return 0;
|
||||||
virCapsGuestDomainInfoPtr info = &guest->arch.defaultInfo;
|
|
||||||
virCapsGuestMachinePtr *list;
|
|
||||||
|
|
||||||
if (!STREQ(ostype, guest->ostype) ||
|
|
||||||
!STREQ(arch, guest->arch.name) ||
|
|
||||||
wordsize != guest->arch.wordsize ||
|
|
||||||
!STREQ(emulator, info->emulator))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (emulator_mtime != info->emulator_mtime) {
|
if (emulator_mtime != info->emulator_mtime) {
|
||||||
VIR_DEBUG("mtime on %s has changed, refreshing machine types",
|
VIR_DEBUG("mtime on %s has changed, refreshing machine types",
|
||||||
@ -524,12 +514,6 @@ qemudGetOldMachines(const char *ostype,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It sucks to have to dup these, when we're most likely going
|
|
||||||
* to free the old caps anyway - except if an error occurs, we'll
|
|
||||||
* stick with the old caps.
|
|
||||||
* Also, if we get OOM here, just let the caller try and probe
|
|
||||||
* the binary directly, which will probably fail too.
|
|
||||||
*/
|
|
||||||
if (VIR_ALLOC_N(list, info->nmachines) < 0)
|
if (VIR_ALLOC_N(list, info->nmachines) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -554,6 +538,32 @@ qemudGetOldMachines(const char *ostype,
|
|||||||
*nmachines = info->nmachines;
|
*nmachines = info->nmachines;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemudGetOldMachines(const char *ostype,
|
||||||
|
const char *arch,
|
||||||
|
int wordsize,
|
||||||
|
const char *emulator,
|
||||||
|
time_t emulator_mtime,
|
||||||
|
virCapsPtr old_caps,
|
||||||
|
virCapsGuestMachinePtr **machines,
|
||||||
|
int *nmachines)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < old_caps->nguests; i++) {
|
||||||
|
virCapsGuestPtr guest = old_caps->guests[i];
|
||||||
|
|
||||||
|
if (!STREQ(ostype, guest->ostype) ||
|
||||||
|
!STREQ(arch, guest->arch.name) ||
|
||||||
|
wordsize != guest->arch.wordsize)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (qemudGetOldMachinesFromInfo(&guest->arch.defaultInfo,
|
||||||
|
emulator, emulator_mtime,
|
||||||
|
machines, nmachines))
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user