diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 91a046eb48..c4cafc47ee 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -407,6 +407,14 @@ + + + + yes + no + + + diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 954cdd2c8c..02fbf60b02 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -1244,6 +1244,8 @@ virCapabilitiesFormatGuestXML(virCapsGuestPtr *guests, virBufferAsprintf(buf, " canonical='%s'", machine->canonical); if (machine->maxCpus > 0) virBufferAsprintf(buf, " maxCpus='%d'", machine->maxCpus); + if (machine->deprecated) + virBufferAddLit(buf, " deprecated='yes'"); virBufferAsprintf(buf, ">%s\n", machine->name); } diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index e2581fac8b..5fd59efc05 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -56,6 +56,7 @@ struct _virCapsGuestMachine { char *name; char *canonical; unsigned int maxCpus; + bool deprecated; }; struct _virCapsGuestDomainInfo { diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ed3b34204e..1c95dc0d42 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -625,6 +625,7 @@ struct _virQEMUCapsMachineType { char *defaultCPU; bool numaMemSupported; char *defaultRAMid; + bool deprecated; }; typedef struct _virQEMUCapsHostCPUData virQEMUCapsHostCPUData; @@ -944,6 +945,7 @@ virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps, mach->name = g_strdup(accel->machineTypes[i].name); } mach->maxCpus = accel->machineTypes[i].maxCpus; + mach->deprecated = accel->machineTypes[i].deprecated; } /* Make sure all canonical machine types also have their own entry so that @@ -977,6 +979,7 @@ virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps, } mach->name = g_strdup(machine->canonical); mach->maxCpus = machine->maxCpus; + mach->deprecated = machine->deprecated; i++; } i++; @@ -1882,6 +1885,7 @@ virQEMUCapsAccelCopyMachineTypes(virQEMUCapsAccelPtr dst, dst->machineTypes[i].qemuDefault = src->machineTypes[i].qemuDefault; dst->machineTypes[i].numaMemSupported = src->machineTypes[i].numaMemSupported; dst->machineTypes[i].defaultRAMid = g_strdup(src->machineTypes[i].defaultRAMid); + dst->machineTypes[i].deprecated = src->machineTypes[i].deprecated; } } @@ -2716,7 +2720,8 @@ virQEMUCapsAddMachine(virQEMUCapsPtr qemuCaps, bool hotplugCpus, bool isDefault, bool numaMemSupported, - const char *defaultRAMid) + const char *defaultRAMid, + bool deprecated) { virQEMUCapsAccelPtr accel = virQEMUCapsGetAccel(qemuCaps, virtType); virQEMUCapsMachineTypePtr mach; @@ -2739,6 +2744,7 @@ virQEMUCapsAddMachine(virQEMUCapsPtr qemuCaps, mach->numaMemSupported = numaMemSupported; mach->defaultRAMid = g_strdup(defaultRAMid); + mach->deprecated = deprecated; } /** @@ -2786,7 +2792,8 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps, machines[i]->hotplugCpus, machines[i]->isDefault, machines[i]->numaMemSupported, - machines[i]->defaultRAMid); + machines[i]->defaultRAMid, + machines[i]->deprecated); if (preferredMachine && (STREQ_NULLABLE(machines[i]->alias, preferredMachine) || @@ -4018,6 +4025,7 @@ virQEMUCapsLoadMachines(virQEMUCapsAccelPtr caps, caps->machineTypes[i].defaultCPU = virXMLPropString(nodes[i], "defaultCPU"); caps->machineTypes[i].defaultRAMid = virXMLPropString(nodes[i], "defaultRAMid"); + caps->machineTypes[i].deprecated = virXMLPropString(nodes[i], "deprecated"); } return 0; @@ -4508,6 +4516,8 @@ virQEMUCapsFormatMachines(virQEMUCapsAccelPtr caps, virBufferAddLit(buf, " numaMemSupported='yes'"); virBufferEscapeString(buf, " defaultRAMid='%s'", caps->machineTypes[i].defaultRAMid); + if (caps->machineTypes[i].deprecated) + virBufferAddLit(buf, " deprecated='yes'"); virBufferAddLit(buf, "/>\n"); } } @@ -6332,7 +6342,8 @@ virQEMUCapsStripMachineAliasesForVirtType(virQEMUCapsPtr qemuCaps, if (name) { virQEMUCapsAddMachine(qemuCaps, virtType, name, NULL, mach->defaultCPU, mach->maxCpus, mach->hotplugCpus, mach->qemuDefault, - mach->numaMemSupported, mach->defaultRAMid); + mach->numaMemSupported, mach->defaultRAMid, + mach->deprecated); } } } diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h index 15fc79e88b..90ce35fa5d 100644 --- a/src/qemu/qemu_capspriv.h +++ b/src/qemu/qemu_capspriv.h @@ -120,4 +120,5 @@ virQEMUCapsAddMachine(virQEMUCapsPtr qemuCaps, bool hotplugCpus, bool isDefault, bool numaMemSupported, - const char *defaultRAMid); + const char *defaultRAMid, + bool deprecated); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 67f149ebde..b0068f2a82 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1178,6 +1178,7 @@ struct _qemuMonitorMachineInfo { char *defaultCPU; bool numaMemSupported; char *defaultRAMid; + bool deprecated; }; int qemuMonitorGetMachines(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6534878d45..97c5e5b36c 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5814,6 +5814,10 @@ int qemuMonitorJSONGetMachines(qemuMonitorPtr mon, info->defaultRAMid = g_strdup(tmp); } + + if (virJSONValueObjectHasKey(child, "deprecated") && + virJSONValueObjectGetBoolean(child, "deprecated", &info->deprecated) < 0) + goto cleanup; } ret = n; diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml index 28a4b0ede0..b4f2092e7a 100644 --- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml @@ -859,20 +859,20 @@ - + - + - + @@ -890,7 +890,7 @@ - + @@ -1963,20 +1963,20 @@ - + - + - + @@ -1994,7 +1994,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index 15eaac77a6..c6c05c5383 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -649,7 +649,7 @@ - + @@ -1117,7 +1117,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index e150741f11..836255f80b 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -1114,13 +1114,13 @@ - + - + @@ -1128,7 +1128,7 @@ - + @@ -1147,7 +1147,7 @@ - + @@ -2577,13 +2577,13 @@ - + - + @@ -2591,7 +2591,7 @@ - + @@ -2610,7 +2610,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml index 7c56d110f4..c6dcbf1329 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -1248,7 +1248,7 @@ - + @@ -1258,7 +1258,7 @@ - + @@ -1267,7 +1267,7 @@ - + @@ -1278,7 +1278,7 @@ - + @@ -2890,7 +2890,7 @@ - + @@ -2900,7 +2900,7 @@ - + @@ -2909,7 +2909,7 @@ - + @@ -2920,7 +2920,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml index 07466093c9..cded14a96a 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml @@ -1421,7 +1421,7 @@ - + @@ -1432,7 +1432,7 @@ - + @@ -1441,7 +1441,7 @@ - + @@ -1452,7 +1452,7 @@ - + @@ -3156,7 +3156,7 @@ - + @@ -3167,7 +3167,7 @@ - + @@ -3176,7 +3176,7 @@ - + @@ -3187,7 +3187,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml index 7f15bcda09..69b1484d8b 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml @@ -1424,7 +1424,7 @@ - + @@ -1435,7 +1435,7 @@ - + @@ -1445,7 +1445,7 @@ - + @@ -1456,7 +1456,7 @@ - + @@ -3162,7 +3162,7 @@ - + @@ -3173,7 +3173,7 @@ - + @@ -3183,7 +3183,7 @@ - + @@ -3194,7 +3194,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml index 9198d85b7e..83d635177d 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml @@ -1429,7 +1429,7 @@ - + @@ -1440,7 +1440,7 @@ - + @@ -1450,7 +1450,7 @@ - + @@ -1462,7 +1462,7 @@ - + @@ -3172,7 +3172,7 @@ - + @@ -3183,7 +3183,7 @@ - + @@ -3193,7 +3193,7 @@ - + @@ -3205,7 +3205,7 @@ - + diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index cea4f84b14..c2cf3be9ac 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -373,7 +373,8 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache, false, false, true, - defaultRAMid); + defaultRAMid, + false); virQEMUCapsSet(tmpCaps, QEMU_CAPS_TCG); } if (kvm_machines[i] != NULL) { @@ -385,9 +386,10 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache, NULL, 0, false, - false, + false, true, - defaultRAMid); + defaultRAMid, + false); virQEMUCapsSet(tmpCaps, QEMU_CAPS_KVM); } }