New API: inspect-get-windows-current-control-set
[libguestfs.git] / inspector / virt-inspector.c
index fda9787..d016b2d 100644 (file)
@@ -1,5 +1,5 @@
 /* virt-inspector
- * Copyright (C) 2010 Red Hat Inc.
+ * Copyright (C) 2010-2011 Red Hat Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
 #include <inttypes.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <locale.h>
 #include <assert.h>
 
 #include <libxml/xmlIO.h>
@@ -372,6 +373,13 @@ output_root (xmlTextWriterPtr xo, char *root)
       xmlTextWriterWriteElement (xo, BAD_CAST "product_name", BAD_CAST str));
   free (str);
 
+  str = guestfs_inspect_get_product_variant (g, root);
+  if (!str) exit (EXIT_FAILURE);
+  if (STRNEQ (str, "unknown"))
+    XMLERROR (-1,
+      xmlTextWriterWriteElement (xo, BAD_CAST "product_variant", BAD_CAST str));
+  free (str);
+
   i = guestfs_inspect_get_major_version (g, root);
   snprintf (buf, sizeof buf, "%d", i);
   XMLERROR (-1,
@@ -408,6 +416,14 @@ output_root (xmlTextWriterPtr xo, char *root)
                                            BAD_CAST str));
     free (str);
   );
+  DISABLE_GUESTFS_ERRORS_FOR (
+    str = guestfs_inspect_get_windows_current_control_set (g, root);
+    if (str)
+      XMLERROR (-1,
+                xmlTextWriterWriteElement (xo, BAD_CAST "windows_current_control_set",
+                                           BAD_CAST str));
+    free (str);
+  );
 
   str = guestfs_inspect_get_format (g, root);
   if (!str) exit (EXIT_FAILURE);