From: Richard W.M. Jones Date: Tue, 1 Nov 2011 17:51:00 +0000 (+0000) Subject: contrib: Update talk. X-Git-Tag: 1.15.2~11 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=acd06dbe326da7cd883f0a7df599d0d173c4bd04;p=libguestfs.git contrib: Update talk. --- 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 ...

+ diff --git a/contrib/intro/talk.txt b/contrib/intro/talk.txt index a8632f6..d28bcc4 100644 --- a/contrib/intro/talk.txt +++ b/contrib/intro/talk.txt @@ -5,3 +5,133 @@ distributed before the talk. ---------------------------------------------------------------------- +[1 The Idea] + +The "big idea" behind libguestfs is to read and write disk +images by reusing all the qemu, Linux kernel and userspace +code. + +This gives us tremendous power in a relatively small +library: we can handle all Linux filesystems, all Windows +filesystems, LVM, BSD, containers like raw and qcow, CD ISOs, +USB keys, regular hard disks, and lots more. + +If you give us a btrfs filesystem in a BSD partition wrapped +in a qcow2 file -- that is something we can handle. + +libguestfs -- as the name suggests -- is a plain, ordinary +shared library written in C that you can link to C programs. +You're all very smart people and you will have guessed +already that we don't in fact run qemu as a library inside +libguestfs as this diagram suggests. Instead we fork +qemu or KVM, running a small "appliance" which has +the usual kernel, a small Linux distribution with tools +like mkfs, lvcreate and parted, and a libguestfs daemon. +The library and the daemon talk to each other over a +virtio-serial connection. + +The qemu instance is connected to the disks we are +examining using the ordinary qemu -drive option. + +[2 The Stable API] + +Consider how you might send commands to the daemon. +Example: Create a filesystem (mkfs). + +One thing you might do is to send shell commands over +the virtio-serial connection. It would send "mkfs -t ..." + +This is something that is possible using the libguestfs +API, but we don't encourage it. There are three reasons +why we don't encourage and support this: one is that +because we're calling this from a C program, it's hard +to construct shell commands and deal with quoting issues. +Secondly it's hard to parse the result from commands +(think about parted or lvs which are two commands that +produce quite complex output that is hard to parse). +Thirdly the command line isn't very long-term stable, +with some commands appearing and changing over time. + +I'd emphasize again that we do let you send shell +commands over to the daemon if that's what you want to do. + +What we support, though, is a long-term stable API and ABI. +It's slightly (but not very much) higher level than shell +commands. + +I've got an example on the page. This is the guestfs_vfs_type +API which returns the name of the filesystem on a device. + +Like libvirt, we are serious about the long term stability +of the API and ABI, and if you write your program against +this API, you'll never have to change the program or even +recompile it. + +Because there are 100s of commands that you might want to +run, we made it exceptionally simple to add new APIs. +Shown below is the actual code used to implement "vfs-type". + +On the right is the code fragment that runs in the daemon. +This is a short C function which handles constructing the +command line and parsing out the result. Although there +is parsing code here, the good thing is that it only exists +in one place, and we can update it from time to time if +the underlying shell commands change. + +On the left is the metadata for this API function. It +has a description of the parameters and return value, +some tests (not shown), and a fragment of documentation. + +That's ALL you have to write. From that, we generate +header files, bindings in all the different languages, +RPC for the virtio-serial connection, documentation, etc. +Currently we generate about a quarter of a million lines +of code and documentation. + +[3 Tools written around the API] + +Around this stable API, myself and the libguestfs team +have written a number of tools. There are also people +in the community writing other tools. + +A few of them are shown on this diagram, in fact there +are many more than are shown here. + +Starting at the top, "guestfish" is a shell for the API, +letting you write simple shell scripts. If you look at +the code examples below, you can see a small guestfish +script that creates a new raw format partitioned filesystem +with some content. + +Going round clockwise: + +The libguestfs API is a mix of high-level calls like +mkfs, lvremove, vfs-type; and also low level POSIX calls +like mkdir and writing to files. +"guestmount" lets you mount an existing filesystem from +a guest and access it as a regular mountpoint on the host. +guestmount intelligently caches and prefetches data so it's +quite usable and fast from the command line or graphical +programs like the GNOME Nautilus file browser. + +"virt-rescue" lets you use the appliance directly, and +it's a useful way to rescue guests by hand. +You just want to hammer out some shell commands manually. + +"virt-win-reg" lets you read and write Windows Registry +entries. There is a rather complex example below right. + +Now we come round to the "inspection" tools, and these +three tools let you inspect an unknown guest to find out +what operating system it contains, what applications are +installed, what filesystems, how the filesystems are used +and much more. I cover that in the next section, but if +you look below you'll see an example of running "virt-df". + +Finally there are now tools to resize guests, make them +sparse, align them, and check their alignment. These +last tools are ones that we eventually hope will become +obsolete. + +[4 Inspection] + diff --git a/contrib/intro/virt-manager-t.png b/contrib/intro/virt-manager-t.png new file mode 100644 index 0000000..892647b Binary files /dev/null and b/contrib/intro/virt-manager-t.png differ diff --git a/contrib/intro/virt-manager.png b/contrib/intro/virt-manager.png new file mode 100644 index 0000000..4ac5eb5 Binary files /dev/null and b/contrib/intro/virt-manager.png differ diff --git a/contrib/intro/vmm-icons-t.png b/contrib/intro/vmm-icons-t.png new file mode 100644 index 0000000..419bcc9 Binary files /dev/null and b/contrib/intro/vmm-icons-t.png differ diff --git a/contrib/intro/vmm-icons.png b/contrib/intro/vmm-icons.png new file mode 100644 index 0000000..e25b389 Binary files /dev/null and b/contrib/intro/vmm-icons.png differ diff --git a/contrib/intro/win7.xml b/contrib/intro/win7.xml new file mode 100644 index 0000000..05c484f --- /dev/null +++ b/contrib/intro/win7.xml @@ -0,0 +1,164 @@ + + + + /dev/sda2 + windows + i386 + windows + Windows 7 Enterprise + Client + 6 + 1 + /Windows + ControlSet001 + win7x32 + installed + + / + + + + ntfs + F2E8996AE8992E3B + + + + /dev/sda2 + + + + Microsoft .NET Framework 4 Client Profile + Microsoft .NET Framework 4 Client Profile + 4.0.30319 + C:\Windows\Microsoft.NET\Framework\v4.0.30319\SetupCache\Client + Microsoft Corporation + http://go.microsoft.com/fwlink/?LinkId=164164 + + + Mozilla Firefox (3.6.12) + Mozilla Firefox (3.6.12) + 3.6.12 (en-GB) + C:\Program Files\Mozilla Firefox + Mozilla + http://www.mozilla.com/en-GB/ + Mozilla Firefox + + + VLC media player + VLC media player 1.1.5 + 1.1.5 + C:\Program Files\VideoLAN\VLC + VideoLAN + http://www.videolan.org/ + + + {3C3901C5-3455-3E0A-A214-0B093A5070A6} + Microsoft .NET Framework 4 Client Profile + 4.0.30319 + Microsoft Corporation + http://go.microsoft.com/fwlink/?LinkId=164164 + + + {3C3901C5-3455-3E0A-A214-0B093A5070A6}.KB2468871 + Update for Microsoft .NET Framework 4 Client Profile (KB2468871) + 1 + Microsoft Corporation + http://support.microsoft.com + This update is for Microsoft .NET Framework 4 Client Profile. +If you later install a more recent service pack, this update will be uninstalled automatically. +For more information, visit http://support.microsoft.com/kb/2468871. + + + {3C3901C5-3455-3E0A-A214-0B093A5070A6}.KB2518870 + Security Update for Microsoft .NET Framework 4 Client Profile (KB2518870) + 1 + Microsoft Corporation + http://support.microsoft.com + This security update is for Microsoft .NET Framework 4 Client Profile. +If you later install a more recent service pack, this security update will be uninstalled automatically. +For more information, visit http://support.microsoft.com/kb/2518870. + + + {3C3901C5-3455-3E0A-A214-0B093A5070A6}.KB2533523 + Update for Microsoft .NET Framework 4 Client Profile (KB2533523) + 1 + Microsoft Corporation + http://support.microsoft.com + This update is for Microsoft .NET Framework 4 Client Profile. +If you later install a more recent service pack, this update will be uninstalled automatically. +For more information, visit http://support.microsoft.com/kb/2533523. + + + {3C3901C5-3455-3E0A-A214-0B093A5070A6}.KB2539636 + Security Update for Microsoft .NET Framework 4 Client Profile (KB2539636) + 1 + Microsoft Corporation + http://support.microsoft.com + This security update is for Microsoft .NET Framework 4 Client Profile. +If you later install a more recent service pack, this security update will be uninstalled automatically. +For more information, visit http://support.microsoft.com/kb/2539636. + + + iVBORw0KGgoAAAANSUhEUgAAADYAAAA3CAIAAADIey4vAAAMo0lEQVRoge2YaViTVxbHMQlb +CCGCW6lVNinIYpURbQcqiiRAWILIIgLKLmEnkAQJa4CELYAJqwIadgFBVkHZEVAQQXZEwQVL +rdpxaVWgdY4ynQ/zzMwzIm0/DOc5H9577/n//ue5yXvfNxEQWI3VWI3VWI3/t0CJIDYqIZXw +KE07oW8cRPQCIOEChkhlPCxBwZ/WG2K9AkrD6ovD4eYR+ZzKntobd9pGHnZNzkHCBQwTK7oP +heVtPhwGZVD8hza3BrtJeK+9If109bXbE7NP7z56MjbzaPD2gxvj9/rGpiHhAoYweWf2ydjD +J5XdE/rULJCA8I9oD6l4YMdxVkPf5O2Hj6Gb1v6Jxt6x+p6R2q7hmq6hmqsfsmsIhjAJS1AA +ZZMPHtf3ToAQ5AD53dpDCglpWPmnVgzfne0YmKi+Olje1l/SdKPwcm9+4/W8hmv8Sz3/TBjC +JCxBAZRBMUhACHKACCAFf5f+MNouZ+t7rg1Plbf05Tf05NRezarqTK9sT7vQlnqhlVf+rwmT +sAQFUAbFIAEhyAECKACuWG+ioqJ4PEEaT85vvNbQPZhb3Z5a3pxcciWhsJHFr4s4UxGSWhyU +kk9LzjvJLQjNKIvKrWHlXWLnN0DGQhY0xBU0JhZdBgkIQQ4QQEkT3AEL8E/tb82aNd9++608 +3pGdf+liay+3pDEur5aZUx2WXUXnFvsxuawAymknC/6hA3wjrRxrfZanm184JyApn5FZEXqm ++resCjtTHZ5TDUKQAwRQsQWXAAtwsPikFuXk5LQMLfB+py62XI87Vx2WWU5PLQ3glnon5lMo +YVV7dzYqS7fs2typvaX74NYegkw3fstlM3WOv/sJVo5vynk/bpk/70Nyyyjc90KQAwRQAAQs +wMFi+f2hUCh9ff3Nhj6ll7ujz1wITCn0jOe7x/Ld4vLsQ9MTbCyadmzp0pHpNZa7aaUwZKc4 +4qg06qw0fEyh6YSBLZ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