mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: cache host arch separately from virCapsPtr
As part of a goal to eliminate the need to use virCapsPtr for anything other than the virConnectGetCapabilies() API impl, cache the host arch against the QEMU driver struct and use that field directly. In the tests we move virArchFromHost() globally in testutils.c so that every test runs with a fixed default architecture reported. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -576,13 +576,16 @@ virCapsPtr testQemuCapsInit(void)
|
||||
|
||||
|
||||
void
|
||||
qemuTestSetHostArch(virCapsPtr caps,
|
||||
qemuTestSetHostArch(virQEMUDriverPtr driver,
|
||||
virArch arch)
|
||||
{
|
||||
if (arch == VIR_ARCH_NONE)
|
||||
arch = VIR_ARCH_X86_64;
|
||||
caps->host.arch = arch;
|
||||
qemuTestSetHostCPU(caps, NULL);
|
||||
|
||||
virTestHostArch = arch;
|
||||
driver->hostarch = virArchFromHost();
|
||||
driver->caps->host.arch = virArchFromHost();
|
||||
qemuTestSetHostCPU(driver->caps, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -694,6 +697,8 @@ int qemuTestDriverInit(virQEMUDriver *driver)
|
||||
if (virMutexInit(&driver->lock) < 0)
|
||||
return -1;
|
||||
|
||||
driver->hostarch = virArchFromHost();
|
||||
|
||||
driver->config = virQEMUDriverConfigNew(false);
|
||||
if (!driver->config)
|
||||
goto error;
|
||||
|
||||
Reference in New Issue
Block a user