inspector: Include <hostname> in output.
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 14 Apr 2011 16:58:51 +0000 (17:58 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 14 Apr 2011 17:20:26 +0000 (18:20 +0100)
inspector/example-debian.xml
inspector/example-fedora.xml
inspector/example-ubuntu.xml
inspector/example-windows.xml
inspector/virt-inspector.c
inspector/virt-inspector.rng

index c699d77..5b60092 100644 (file)
@@ -10,6 +10,7 @@
     <minor_version>0</minor_version>
     <package_format>deb</package_format>
     <package_management>apt</package_management>
+    <hostname>debian.invalid</hostname>
     <format>installed</format>
     <mountpoints>
       <mountpoint dev="/dev/debian/root">/</mountpoint>
index 1444bb7..4c01a20 100644 (file)
@@ -10,6 +10,7 @@
     <minor_version>0</minor_version>
     <package_format>rpm</package_format>
     <package_management>yum</package_management>
+    <hostname>fedora.invalid</hostname>
     <format>installed</format>
     <mountpoints>
       <mountpoint dev="/dev/VG/Root">/</mountpoint>
index 6169781..ab08b0c 100644 (file)
@@ -10,6 +10,7 @@
     <minor_version>10</minor_version>
     <package_format>deb</package_format>
     <package_management>apt</package_management>
+    <hostname>ubuntu.invalid</hostname>
     <format>installed</format>
     <mountpoints>
       <mountpoint dev="/dev/sda2">/</mountpoint>
index 8b3b8a7..55b11df 100644 (file)
@@ -11,6 +11,7 @@
     <minor_version>1</minor_version>
     <windows_systemroot>/Windows</windows_systemroot>
     <windows_current_control_set>ControlSet001</windows_current_control_set>
+    <hostname>windows.invalid</hostname>
     <format>installed</format>
     <mountpoints>
       <mountpoint dev="/dev/sda2">/</mountpoint>
index 69c4ea9..607e5ae 100644 (file)
@@ -428,6 +428,14 @@ output_root (xmlTextWriterPtr xo, char *root)
     free (str);
   );
 
+  str = guestfs_inspect_get_hostname (g, root);
+  if (!str) exit (EXIT_FAILURE);
+  if (STRNEQ (str, "unknown"))
+    XMLERROR (-1,
+      xmlTextWriterWriteElement (xo, BAD_CAST "hostname",
+                                 BAD_CAST str));
+  free (str);
+
   str = guestfs_inspect_get_format (g, root);
   if (!str) exit (EXIT_FAILURE);
   if (STRNEQ (str, "unknown"))
index 669e8bc..f59311c 100644 (file)
@@ -40,6 +40,7 @@
             <optional><element name="windows_current_control_set"><text/></element></optional>
             <optional><element name="package_format"><text/></element></optional>
             <optional><element name="package_management"><text/></element></optional>
+            <optional><element name="hostname"><text/></element></optional>
             <optional><element name="format"><text/></element></optional>
             <optional><element name="live"><empty/></element></optional>
             <optional><element name="netinst"><empty/></element></optional>