[libvirt] [PATCH 6/6] Add canonical machine name to capabilities output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

* src/capabilities.c: output the canonical machine names in the
  capabilities output, if available
---
 src/capabilities.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/capabilities.c b/src/capabilities.c
index afe4d38..d186961 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -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");
         }
-- 
1.6.2.5

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]