Add canonical machine name to capabilities output

e.g. <machine canonical='pc'>pc-0.11</machine>

* src/capabilities.c: output the canonical machine names in the
  capabilities output, if available

* docs/schemas/capabilities.rng: add the new attribute
This commit is contained in:
Mark McLoughlin 2009-07-23 18:31:35 +01:00
parent c14c6b083e
commit 0f15d0344d
2 changed files with 15 additions and 4 deletions

View File

@ -196,6 +196,11 @@
<define name='machine'>
<element name='machine'>
<optional>
<attribute name='canonical'>
<text/>
</attribute>
</optional>
<text/>
</element>
</define>

View File

@ -692,8 +692,11 @@ virCapabilitiesFormatXML(virCapsPtr caps)
caps->guests[i]->arch.defaultInfo.loader);
for (j = 0 ; j < caps->guests[i]->arch.defaultInfo.nmachines ; j++) {
virBufferVSprintf(&xml, " <machine>%s</machine>\n",
caps->guests[i]->arch.defaultInfo.machines[j]->name);
virCapsGuestMachinePtr machine = caps->guests[i]->arch.defaultInfo.machines[j];
virBufferAddLit(&xml, " <machine");
if (machine->canonical)
virBufferVSprintf(&xml, " canonical='%s'", machine->canonical);
virBufferVSprintf(&xml, ">%s</machine>\n", machine->name);
}
for (j = 0 ; j < caps->guests[i]->arch.ndomains ; j++) {
@ -707,8 +710,11 @@ virCapabilitiesFormatXML(virCapsPtr caps)
caps->guests[i]->arch.domains[j]->info.loader);
for (k = 0 ; k < caps->guests[i]->arch.domains[j]->info.nmachines ; k++) {
virBufferVSprintf(&xml, " <machine>%s</machine>\n",
caps->guests[i]->arch.domains[j]->info.machines[k]->name);
virCapsGuestMachinePtr machine = caps->guests[i]->arch.domains[j]->info.machines[k];
virBufferAddLit(&xml, " <machine");
if (machine->canonical)
virBufferVSprintf(&xml, " canonical='%s'", machine->canonical);
virBufferVSprintf(&xml, ">%s</machine>\n", machine->name);
}
virBufferAddLit(&xml, " </domain>\n");
}