1 0 Archive | Xen RSS feed for this section
post icon

libguestfs: library for accessing and modifying VM disk images

18. Jan, 2011

Imagine if there was an application that you could feed a disk image to, wether it be Microsoft Windows 2008 or Red Hat EL 6 and see a list of applications that are installed – no step back – imagine if there was an application that you could feed a disk image to and just discover what operating system was installed.

Well fear not! There is such an application. I kid you not, if you are anything like me you are going to look and see this as one of the most amazing discoveries. When I found this, I had a “oh my goodness, why didn’t I know about this sooner” moment.

libguestfs is a set of tools for accessing and modifying virtual machine (VM) disk images. You can use this for viewing and editing files inside guests, scripting changes to VMs, monitoring disk used/free statistics, P2V, V2V, performing partial backups, cloning VMs and much much more.

libguestfs basically allows you to do anything that you have ever dreamed of. Yes. It will even read your Windows Registry “hive” files and spit them out as XML files.

The virt-inspector command examines a virtual machine or disk image and tries to determine the version of the operating system and other information about the virtual machine.

libguestfs is definitely on the TODO list for installing :) I am love. I could just imagine a nice web application thrown on top of this that would allow you to do funky things like that a WIndows machine offline, run a Windows Update *while the virtual machine is not running* and then start the machine up again. Doesn’t sound awesome yet? Think about it this way: a new Windows update is released. You take an LVM snapshot of the currently running box. You apply any Windows Update to the new LVM snapshot, shutdown the current running box while bringing up the new one (or edit the registry and remove any details of the IP and add a script to run on startup…)… so many ideas :)

Read full story »


Written By Tim Groeneveld.
post icon

Xen Common Commands

11. Jul, 2010

Xen has states!

  • —r: the paravirtualised/hypervised “domain” is currently running some sort of process.
    A domain will not be in the running state (“r”) if it was just waiting for a packet to arrive or a mouse to be moved —
  • b: blocked, domain is waiting for something, usually an interrupt (for example, waiting for hard-disk data to be passed over to the domain). Also ,things like “sleep 5″ in the shell would cause “blocked”, as the domain is waiting for a number of timer ticks (5 seconds worth of) to pass.
  • —p: paused – the domain has been paused with the command:xm pause (domain)
  • —c: crashed – when a paravirtualised domain (or an “enlightened” Windows install) crashes (kernel panic / BSOD etc) the hypervisor will detect this and put the machine into a crashed state.
  • d: dying – Something has told the domain to “kill itself” (such as “xm shutdown/destroy”, but it’s not yet disappeared. It’s probably there for the purpose of avoiding race-conditions where something is killing the domain, and something else is talking to it (for example disk accesses)

‘xm’

  • —The xm program is the main interface for managing Xen guest domains. The program can be used to create, pause, and shutdown domains. It can also be used to list current domains, enable or pin VCPUs, and attach or detach virtual block devices.
  • All xm operations rely upon the Xen control daemon, aka xend. For any xm commands to run xend must also be running. For this reason you should start xend as a service when your system first boots using xen.
  • —Most xm commands require root privileges to run due to the communications channels used to talk to the hypervisor. Running as non root will return an error.
  • Most xm commands act asynchronously, so just because the xm command returned, doesn’t mean the action is complete. This is important, as many operations on domains, like create and shutdown, can take considerable time (30 seconds or more) to bring the machine into a fully compliant state. If you want to know when one of these actions has finished you must poll through xm list periodically. —

xm create [-c] configfile [name=value]

  • The create sub command requires a config file and can optionally take a series of name value pairs that add to or override variables defined in the config file.
  • NOTE: Create will return as soon as the domain is started. This does not mean the guest OS in the domain has actually booted, or is available for input.
  • -c Attach console to the domain as soon as it has started. Useful for determining issues with crashing domains.

xm info

Print information about the Xen host in name : value format. When reporting a Xen bug, please provide this information as part of the bug report.

 host                   : tim-pxe-xc02
 release                : 2.6.32.3-timg
 version                : #1 Mon Jun 02 14:26:26 EST 2010
 machine                : x86_64
 nr_cpus                : 1
 nr_nodes               : 1
 sockets_per_node       : 1
 cores_per_socket       : 4
 threads_per_core       : 2
 cpu_mhz                : 3330
 hw_caps                : 0383fbff:00000000:00000000:00000040
 total_memory           : 16384
 free_memory            : 37
 xen_major              : 4
 xen_minor              : 0
 xen_extra              : -devel
 xen_caps               : xen-4.0.1-x86_64
 xen_pagesize           : 4096
 platform_params        : virt_start=0xfc000000
 xen_changeset          : Mon Nov 14 18:13:38 2010 +0100
                          21226:7dcfdd45bc9e
 cc_compiler            : gcc version 4.5.0
 cc_compile_by          : timg
 cc_compile_domain      : beast.timg.local
 cc_compile_date        : Mon May 21 12:16:48 EST 2010
 xend_config_format     : 2

Read full story »


Written By Tim Groeneveld.