[PATCH] Show also short-ids when calling --list-{os, platform}

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

 



As the short-id can be used to set the os/platform in the example
program, let's expose them to the user.
---
 examples/virt-designer.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/examples/virt-designer.c b/examples/virt-designer.c
index 7628449..12faf04 100644
--- a/examples/virt-designer.c
+++ b/examples/virt-designer.c
@@ -107,8 +107,8 @@ print_oses(const gchar *option_name,
     if (!db && !load_osinfo())
         goto cleanup;
 
-    printf("  Operating System ID\n"
-           "-----------------------\n");
+    printf("  Operating System ID (short ID)\n"
+           "--------------------------------\n");
 
     list = osinfo_db_get_os_list(db);
     if (!list)
@@ -119,6 +119,8 @@ print_oses(const gchar *option_name,
         OsinfoOs *os = OSINFO_OS(os_iter->data);
         const char *id = osinfo_entity_get_param_value(OSINFO_ENTITY(os),
                                                        OSINFO_ENTITY_PROP_ID);
+        const char *short_id = osinfo_entity_get_param_value(OSINFO_ENTITY(os),
+                                                             OSINFO_PRODUCT_PROP_SHORT_ID);
 
         printf("%s\n", id);
     }
@@ -148,8 +150,8 @@ print_platforms(const gchar *option_name,
     if (!db && !load_osinfo())
         goto cleanup;
 
-    printf("  Platform ID\n"
-           "---------------\n");
+    printf("  Platform ID (short ID)\n"
+           "------------------------\n");
 
     list = osinfo_db_get_platform_list(db);
     if (!list)
@@ -160,6 +162,8 @@ print_platforms(const gchar *option_name,
         OsinfoPlatform *platform = OSINFO_PLATFORM(platform_iter->data);
         const char *id = osinfo_entity_get_param_value(OSINFO_ENTITY(platform),
                                                        OSINFO_ENTITY_PROP_ID);
+        const char *short_id = osinfo_entity_get_param_value(OSINFO_ENTITY(platform),
+                                                             OSINFO_PRODUCT_PROP_SHORT_ID);
 
         printf("%s\n", id);
     }
@@ -577,9 +581,9 @@ main(int argc, char *argv[])
         {"connect", 'c', 0, G_OPTION_ARG_STRING, &connect_uri,
             "libvirt connection URI used for querying capabilities", "URI"},
         {"list-os", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, print_oses,
-            "list IDs of known OSes", NULL},
+            "list IDs and short IDs of known OSes", NULL},
         {"list-platform", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, print_platforms,
-            "list IDs of known hypervisors", NULL},
+            "list IDs and short IDs of known hypervisors", NULL},
         {"os", 'o', 0, G_OPTION_ARG_STRING, &os_str,
             "set domain OS", "OS"},
         {"platform", 'p', 0, G_OPTION_ARG_STRING, &platform_str,
-- 
2.1.0

--
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]