Listing all CPU models supported by QEMU in domain capabilities makes
little sense when libvirt will refuse any model it doesn't know about.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/conf/domain_capabilities.c | 27 ++
src/conf/domain_capabilities.h | 2 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 10 +-
tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml | 428 ----------------------
5 files changed, 39 insertions(+), 429 deletions(-)
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index c07f995..6f9f7e7 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -169,6 +169,33 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old)
}
+virDomainCapsCPUModelsPtr
+virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
+ char **models)
+{
+ virDomainCapsCPUModelsPtr cpuModels;
+ size_t i;
+
+ if (!(cpuModels = virDomainCapsCPUModelsNew(0)))
+ return NULL;
+
+ for (i = 0; i < old->count; i++) {
+ if (models && !virStringArrayHasString(models, old->models[i].name))
+ continue;
+
+ if (virDomainCapsCPUModelsAdd(cpuModels,
+ old->models[i].name, -1) < 0)
+ goto error;
+ }
+
+ return cpuModels;
+
+ error:
+ virObjectUnref(cpuModels);
+ return NULL;
+}
+
+
int
virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
char **name)
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index 509c306..29b18bb 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -156,6 +156,8 @@ virDomainCapsPtr virDomainCapsNew(const char *path,
virDomainCapsCPUModelsPtr virDomainCapsCPUModelsNew(size_t nmodels);
virDomainCapsCPUModelsPtr virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old);
+virDomainCapsCPUModelsPtr virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
+ char **models);
int virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
char **name);
int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index f91ce17..80c112a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -155,6 +155,7 @@ virDomainAuditVcpu;
virDomainCapsCPUModelsAdd;
virDomainCapsCPUModelsAddSteal;
virDomainCapsCPUModelsCopy;
+virDomainCapsCPUModelsFilter;
virDomainCapsCPUModelsNew;
virDomainCapsEnumClear;
virDomainCapsEnumSet;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 7a7ddb8..123aae5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4198,6 +4198,8 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
virQEMUCapsPtr qemuCaps,
virDomainCapsPtr domCaps)
{
+ virDomainCapsCPUModelsPtr filtered = NULL;
+ char **models = NULL;
if (domCaps->virttype == VIR_DOMAIN_VIRT_KVM &&
virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch))
@@ -4207,7 +4209,13 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
domCaps->cpu.hostModel = virQEMUCapsGuestIsNative(caps->host.arch,
qemuCaps->arch);
- domCaps->cpu.custom = virObjectRef(qemuCaps->cpuDefinitions);
+ if (qemuCaps->cpuDefinitions &&
+ cpuGetModels(domCaps->arch, &models) >= 0) {
+ filtered = virDomainCapsCPUModelsFilter(qemuCaps->cpuDefinitions,
+ models);
+ virStringFreeList(models);
+ }
+ domCaps->cpu.custom = filtered;
return 0;
}
diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml
b/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml
index a0aa811..d969274 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml
@@ -22,436 +22,8 @@
<mode name='host-passthrough' supported='yes'/>
<mode name='host-model' supported='yes'/>
<mode name='custom' supported='yes'>
- <model>default</model>
- <model>ppc</model>
- <model>ppc32</model>
- <model>ppc64</model>
- <model>970mp</model>
- <model>970fx</model>
- <model>970</model>
- <model>POWER8NVL</model>
<model>POWER8</model>
- <model>POWER8E</model>
- <model>POWER7+</model>
<model>POWER7</model>
- <model>POWER5gs</model>
- <model>POWER5+</model>
- <model>Apollo7PM</model>
- <model>7457A</model>
- <model>7447A</model>
- <model>Apollo7</model>
- <model>7457</model>
- <model>Apollo6</model>
- <model>7455</model>
- <model>7445</model>
- <model>7451</model>
- <model>7441</model>
- <model>Vger</model>
- <model>7450</model>
- <model>7448</model>
- <model>Nitro</model>
- <model>7410</model>
- <model>G4</model>
- <model>Max</model>
- <model>7400</model>
- <model>Goldfinger</model>
- <model>755</model>
- <model>745</model>
- <model>LoneStar</model>
- <model>750l</model>
- <model>750gx</model>
- <model>750fx</model>
- <model>750cxe</model>
- <model>750cx</model>
- <model>750cl</model>
- <model>Conan/Doyle</model>
- <model>G3</model>
- <model>Typhoon</model>
- <model>750</model>
- <model>Arthur</model>
- <model>740</model>
- <model>Mach5</model>
- <model>Sirocco</model>
- <model>604e</model>
- <model>Goldeneye</model>
- <model>603r</model>
- <model>Vaillant</model>
- <model>Stretch</model>
- <model>603e</model>
- <model>Vanilla</model>
- <model>601v</model>
- <model>601</model>
- <model>MPC8560</model>
- <model>MPC8555E</model>
- <model>MPC8555</model>
- <model>MPC8548E</model>
- <model>MPC8548</model>
- <model>MPC8547E</model>
- <model>MPC8545E</model>
- <model>MPC8545</model>
- <model>MPC8544E</model>
- <model>MPC8544</model>
- <model>MPC8543E</model>
- <model>MPC8543</model>
- <model>MPC8541E</model>
- <model>MPC8541</model>
- <model>MPC8540</model>
- <model>MPC8533E</model>
- <model>MPC8533</model>
- <model>e500v2</model>
- <model>e500v1</model>
- <model>e500</model>
- <model>MPC8347EA</model>
- <model>MPC8347E</model>
- <model>MPC8347A</model>
- <model>MPC8347</model>
- <model>e300</model>
- <model>e200</model>
- <model>MPC8280</model>
- <model>MPC8275</model>
- <model>MPC8272</model>
- <model>MPC8271</model>
- <model>MPC8270</model>
- <model>MPC8266_HiP4</model>
- <model>MPC8266_HiP3</model>
- <model>MPC8266</model>
- <model>MPC8265_HiP4</model>
- <model>MPC8265_HiP3</model>
- <model>MPC8265</model>
- <model>MPC8264_HiP4</model>
- <model>MPC8264_HiP3</model>
- <model>MPC8264</model>
- <model>MPC8260_HiP4</model>
- <model>MPC8260_HiP3</model>
- <model>MPC8260</model>
- <model>MPC8255_HiP4</model>
- <model>MPC8255_HiP3</model>
- <model>MPC8255</model>
- <model>MPC8250_HiP4</model>
- <model>MPC8250_HiP3</model>
- <model>MPC8250</model>
- <model>MPC8248</model>
- <model>MPC8247</model>
- <model>MPC8245</model>
- <model>MPC8241</model>
- <model>PowerQUICC-II</model>
- <model>MPC82xx</model>
- <model>MPC5200B</model>
- <model>MPC5200</model>
- <model>MPC52xx</model>
- <model>MPC8240</model>
- <model>440EP</model>
- <model>x2vp50</model>
- <model>x2vp7</model>
- <model>405GPe</model>
- <model>405GP</model>
- <model>405CR</model>
- <model>405</model>
- <model>403</model>
- <model>750cl_v1.0</model>
- <model>750cxe_v2.1</model>
- <model>7457A_v1.2</model>
- <model>755_v2.7</model>
- <model>MPC8347ET</model>
- <model>MPC8545E_v20</model>
- <model>750_v2.1</model>
- <model>755_v2.2</model>
- <model>745_v2.0</model>
- <model>7455_v1.0</model>
- <model>MPC8547E_v21</model>
- <model>STB25</model>
- <model>POWER8_v2.0</model>
- <model>401G2</model>
- <model>MPC8349A</model>
- <model>750e</model>
- <model>MPC8545_v21</model>
- <model>MPC8548_v11</model>
- <model>970fx_v2.0</model>
- <model>750fx_v2.0</model>
- <model>POWER8E_v2.1</model>
- <model>Cobra</model>
- <model>603p</model>
- <model>7400_v2.7</model>
- <model>MPC8378E</model>
- <model>e500v2_v10</model>
- <model>e500mc</model>
- <model>603e7v1</model>
- <model>970mp_v1.0</model>
- <model>MPC8555E_v11</model>
- <model>440-Xilinx-w-dfpu</model>
- <model>740e</model>
- <model>405CRc</model>
- <model>7447A_v1.1</model>
- <model>MPC8543_v11</model>
- <model>MPC8533E_v10</model>
- <model>MPC8540_v21</model>
- <model>e500v2_v21</model>
- <model>e300c1</model>
- <model>7400_v2.2</model>
- <model>970fx_v1.0</model>
- <model>750gx_v1.2</model>
- <model>750fx_v1.0</model>
- <model>MPC8641</model>
- <model>MPC8544E_v10</model>
- <model>405D4</model>
- <model>7457_v1.1</model>
- <model>970fx_v3.0</model>
- <model>604e_v2.2</model>
- <model>755_v2.6</model>
- <model>7410_v1.4</model>
- <model>Npe4GS3</model>
- <model>745_v2.4</model>
- <model>750_v2.0</model>
- <model>7445_v3.2</model>
- <model>750l_v3.2</model>
- <model>MPC8540_v10</model>
- <model>750_v1.0</model>
- <model>MPC8343A</model>
- <model>MPC8378</model>
- <model>G2HiP3</model>
- <model>750cxe_v3.0</model>
- <model>e500_v10</model>
- <model>STB03</model>
- <model>MPC8567</model>
- <model>MPC8545_v20</model>
- <model>MPC8548_v10</model>
- <model>755_v1.1</model>
- <model>603e7v</model>
- <model>Npe405H2</model>
- <model>750_v3.0</model>
- <model>Npe405H</model>
- <model>7400_v2.6</model>
- <model>405GPa</model>
- <model>MPC8548_v21</model>
- <model>MPC8541E_v10</model>
- <model>750l_v2.2</model>
- <model>MPC8555E_v10</model>
- <model>7457A_v1.1</model>
- <model>e200z6</model>
- <model>MPC8379E</model>
- <model>e500v2_v20</model>
- <model>MPC8347AP</model>
- <model>401B2</model>
- <model>MPC8349E</model>
- <model>755_v2.1</model>
- <model>MPC8543_v21</model>
- <model>MPC8547E_v20</model>
- <model>745_v2.8</model>
- <model>7455_v3.4</model>
- <model>7448_v1.1</model>
- <model>740_v2.2</model>
- <model>7400_v1.1</model>
- <model>MPC8567E</model>
- <model>7441_v2.10</model>
- <model>603e_v1.4</model>
- <model>G2leGP1</model>
- <model>7451_v2.10</model>
- <model>MPC8343E</model>
- <model>750cx_v2.2</model>
- <model>Npe405L</model>
- <model>603e7</model>
- <model>401A1</model>
- <model>MPC8377</model>
- <model>7448_v2.1</model>
- <model>7441_v2.3</model>
- <model>7400_v2.1</model>
- <model>405CRb</model>
- <model>604</model>
- <model>MPC8540_v20</model>
- <model>MPC8543_v10</model>
- <model>7447A_v1.0</model>
- <model>7445_v2.1</model>
- <model>e500_v20</model>
- <model>750gx_v1.1</model>
- <model>MPC8543E_v11</model>
- <model>750cxe_v2.4</model>
- <model>MPC8548_v20</model>
- <model>MPC8347AT</model>
- <model>POWER8NVL_v1.0</model>
- <model>7457A_v1.0</model>
- <model>7457_v1.0</model>
- <model>7450_v1.2</model>
- <model>MPC8572</model>
- <model>755_v2.5</model>
- <model>7410_v1.3</model>
- <model>745_v2.3</model>
- <model>750l_v2.1</model>
- <model>405GPR</model>
- <model>755_v2.0</model>
- <model>MPC8541_v11</model>
- <model>401C2</model>
- <model>e500v2_v30</model>
- <model>7455_v3.3</model>
- <model>405EZ</model>
- <model>MPC8568E</model>
- <model>755_v1.0</model>
- <model>603e_v1.3</model>
- <model>MPC8560_v10</model>
- <model>MPC8560_v21</model>
- <model>G2H4</model>
- <model>MPC8533_v11</model>
- <model>740_v3.1</model>
- <model>e200z5</model>
- <model>MPC8349</model>
- <model>7400_v2.0</model>
- <model>405CRa</model>
- <model>MPC8543E_v10</model>
- <model>MPC8543E_v21</model>
- <model>750cxe_v2.3</model>
- <model>MPC8543_v20</model>
- <model>745_v2.7</model>
- <model>403GC</model>
- <model>e5500</model>
- <model>7448_v1.0</model>
- <model>MPC5200_v12</model>
- <model>740_v2.1</model>
- <model>745_v2.2</model>
- <model>7400_v1.0</model>
- <model>7410_v1.2</model>
- <model>x2vp4</model>
- <model>MPC8555_v11</model>
- <model>MPC8541_v10</model>
- <model>405LP</model>
- <model>750fx_v2.3</model>
- <model>405EP</model>
- <model>601_v2</model>
- <model>MPC8544_v11</model>
- <model>401D2</model>
- <model>MPC8572E</model>
- <model>604e_v1.0</model>
- <model>750cx_v2.1</model>
- <model>MPC5200B_v21</model>
- <model>750l_v3.0</model>
- <model>e300c4</model>
- <model>7448_v2.0</model>
- <model>7450_v2.1</model>
- <model>G2leGP</model>
- <model>750cxe_v3.1b</model>
- <model>7400_v2.9</model>
- <model>G2GP</model>
- <model>603</model>
- <model>405GPd</model>
- <model>MPC8548E_v11</model>
- <model>603e7t</model>
- <model>IOP480</model>
- <model>750gx_v1.0</model>
- <model>MPC8560_v20</model>
- <model>405D2</model>
- <model>750fl</model>
- <model>750l_v2.0</model>
- <model>x2vp20</model>
- <model>e600</model>
- <model>7450_v1.1</model>
- <model>755_v2.4</model>
- <model>7445_v1.0</model>
- <model>G2LS</model>
- <model>MPC8543E_v20</model>
- <model>7447_v1.1</model>
- <model>603e_v2.2</model>
- <model>603e_v4</model>
- <model>7455_v3.2</model>
- <model>740_v2.0</model>
- <model>MPC8347P</model>
- <model>440EPb</model>
- <model>MPC603</model>
- <model>603e_v1.2</model>
- <model>750fx_v2.2</model>
- <model>740_v1.0</model>
- <model>MPC8544_v10</model>
- <model>601_v1</model>
- <model>745_v1.1</model>
- <model>POWER7+_v2.1</model>
- <model>750cx_v2.0</model>
- <model>MPC8347EAP</model>
- <model>401E2</model>
- <model>MPC8641D</model>
- <model>e300c3</model>
- <model>MPC8533_v10</model>
- <model>7441_v2.1</model>
- <model>740_v3.0</model>
- <model>POWER5+_v2.1</model>
- <model>602</model>
- <model>MPC8548E_v10</model>
- <model>G2leLS</model>
- <model>MPC8343</model>
- <model>750cx_v1.0</model>
- <model>750cxe_v2.2</model>
- <model>604e_v2.4</model>
- <model>755_v2.8</model>
- <model>MPC8548E_v21</model>
- <model>745_v2.6</model>
- <model>G2le</model>
- <model>403GB</model>
- <model>MPC8545E_v21</model>
- <model>POWER7_v2.3</model>
- <model>750_v2.2</model>
- <model>7450_v1.0</model>
- <model>MPC5200_v11</model>
- <model>755_v2.3</model>
- <model>MPC8347EP</model>
- <model>7410_v1.1</model>
- <model>750gl</model>
- <model>403GCX</model>
- <model>750p</model>
- <model>745_v2.1</model>
- <model>7445_v3.4</model>
- <model>G2</model>
- <model>MPC8555_v10</model>
- <model>MPC8347T</model>
- <model>603e_v3</model>
- <model>970_v2.2</model>
- <model>440-Xilinx</model>
- <model>740p</model>
- <model>MPC5200B_v20</model>
- <model>440EPX</model>
- <model>603e_v1.1</model>
- <model>7451_v2.3</model>
- <model>7450_v2.0</model>
- <model>7400_v2.8</model>
- <model>7455_v2.1</model>
- <model>405GPc</model>
- <model>MPC8347EAT</model>
- <model>970mp_v1.1</model>
- <model>603e7v2</model>
- <model>604r</model>
- <model>7447A_v1.2</model>
- <model>MPC8533E_v11</model>
- <model>e500v2_v22</model>
- <model>401F2</model>
- <model>MPC8343EA</model>
- <model>7457_v1.2</model>
- <model>970fx_v3.1</model>
- <model>7447_v1.0</model>
- <model>745_v2.5</model>
- <model>MPC8548E_v20</model>
- <model>MPC8610</model>
- <model>403GA</model>
- <model>750cxe_v2.4b</model>
- <model>MPC5200_v10</model>
- <model>7410_v1.0</model>
- <model>G2leGP3</model>
- <model>603e_v4.1</model>
- <model>7445_v3.3</model>
- <model>440EPa</model>
- <model>970fx_v2.1</model>
- <model>MPC8377E</model>
- <model>750fx_v2.1</model>
- <model>601_v0</model>
- <model>STB04</model>
- <model>745_v1.0</model>
- <model>G2HiP4</model>
- <model>750cl_v2.0</model>
- <model>750cxr</model>
- <model>MPC8349EA</model>
- <model>750cxe_v3.1</model>
- <model>401</model>
- <model>MPC8379</model>
- <model>MPC8568</model>
- <model>e300c2</model>
- <model>750_v3.1</model>
- <model>MPC8544E_v11</model>
- <model>405GPb</model>
- <model>MPC8541E_v11</model>
</mode>
</cpu>
<devices>
--
2.9.2