-
+
("vfs_type",
(RString "fstype",
[Device "device"], []),
@@ -110,7 +112,7 @@ For example a string such as C<ext3> or C<ntfs>.");
|
-
+
char *
do_vfs_type (const char *device)
{
@@ -172,10 +174,12 @@ get_blkid_tag (const char *device, const char *tag)
Tools written around the API
-
+
-
+ |
guestfish -N fs -m /dev/sda1 <<EOF
mkdir /etc
@@ -212,6 +216,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 ...
+
| |