X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=contrib%2Fintro%2Flibguestfs-intro.html;fp=contrib%2Fintro%2Flibguestfs-intro.html;h=adbe572bd467c70b2569c9756e78bcdfba93e33b;hp=cfc7b8b6533d4ca80c6f4032b5247f3d33fe4c8a;hb=acd06dbe326da7cd883f0a7df599d0d173c4bd04;hpb=fdcd33a1554c768412061a0448c5ab2044fdae07 diff --git a/contrib/intro/libguestfs-intro.html b/contrib/intro/libguestfs-intro.html index cfc7b8b..adbe572 100644 --- a/contrib/intro/libguestfs-intro.html +++ b/contrib/intro/libguestfs-intro.html @@ -7,7 +7,7 @@ counter-reset: chapter; } - body p { + body > p, body > img, body > pre, body > table { margin-left: 2em; } @@ -26,8 +26,7 @@ } h2 { - background-color: #f3f3f3; - margin-top: 2em; + margin-top: 4em; color: rgb(204,0,0); counter-increment: chapter; counter-reset: section; @@ -35,20 +34,20 @@ h2:before { font-size: 80%; color: #666; - content: counter(chapter) " — "; + content: counter(chapter) " ... "; } pre { background-color: #fcfcfc; - border-top: 1px dotted #888; - border-bottom: 1px dotted #888; - border-left: 6px solid rgb(204,0,0); + border-top: 1px dotted #eee; + border-bottom: 1px dotted #eee; + border-left: 2px solid rgb(204,0,0); padding: 5px; margin-left: 1em; } p.sourcelnk { - text-align: right; + text-align: left; font-size: 70%; } @@ -89,7 +88,7 @@ free (fstype);
-
+
   ("vfs_type",
    (RString "fstype",
         [Device "device"], []),
@@ -110,7 +109,7 @@ For example a string such as C<ext3> or C<ntfs>.");
         
-
+
 char *
 do_vfs_type (const char *device)
 {
@@ -175,7 +174,7 @@ get_blkid_tag (const char *device, const char *tag)
     
 
     
-      
+
 guestfish -N fs -m /dev/sda1 <<EOF
   mkdir /etc
@@ -212,6 +211,80 @@ F15x32:/dev/vg_f15x32/lv_root 5.5G  3.4G      1.8G  63%
 
     

Inspection

+
+$ virt-inspector -c qemu:///system -d Win7x32
+
+<?xml version="1.0"?>
+<operatingsystems>
+  <operatingsystem>
+    <root>/dev/sda2</root>
+    <name>windows</name>
+    <arch>i386</arch>
+    <distro>windows</distro>
+    <product_name>Windows 7 Enterprise</product_name>
+    <product_variant>Client</product_variant>
+    <major_version>6</major_version>
+    <minor_version>1</minor_version>
+    <windows_systemroot>/Windows</windows_systemroot>
+    <windows_current_control_set>ControlSet001</windows_current_control_set>
+    <hostname>win7x32</hostname>
+... etc ...
+
+

full XML ...

+ + + + +
+ Click to enlarge the images +
+ + + +
+ +
+  char **roots;
+  size_t i;
+  char *type, *distro, *product_name;
+  int major, minor;
+
+  roots = guestfs_inspect_os (g);
+
+  if (roots == NULL)
+    exit (EXIT_FAILURE);
+
+  if (roots[0] == NULL) {
+    fprintf (stderr, "no operating systems found\n");
+    exit (EXIT_FAILURE);
+  }
+
+  for (i = 0; roots[i] != NULL; ++i) {
+    type = guestfs_inspect_get_type (g, roots[i]);
+    distro = guestfs_inspect_get_distro (g, roots[i]);
+    product_name = guestfs_inspect_get_product_name (g, roots[i]);
+    major = guestfs_inspect_get_major_version (g, roots[i]);
+    minor = guestfs_inspect_get_minor_version (g, roots[i]);
+
+    printf ("Root: %s\n"
+            "  Type: %s\n"
+            "  Distro: %s\n"
+            "  Version: %d.%d\n"
+            "  Product name: %s\n\n");
+            roots[i],
+            type ? : "unknown", distro ? : "unknown", major, minor,
+            product_name ? : "");
+
+    free (type);
+    free (distro);
+    free (product_name);
+    free (roots[i]);
+  }
+
+  free (roots);
+
+

full source ...

+