New tool: virt-inspector

Today we released the first proper version of virt-inspector, which is a command line tool that tells you what’s in a virtual machine. You just point it at a disk image or a libvirt domain and it can tell you things like:

  • What operating system(s) are installed, and what distros and versions.
  • How disk partitions are expected to be mounted (eg. /dev/sda1 -> /boot)
  • What applications are installed.
  • What kernel(s) are installed.
  • What kernel modules are installed.

The report that comes out can be in plain text or in XML so you can feed it to another program. You can also use it as a wrapper around guestfish, to pre-mount the filesystems as they would be mounted on the virtual machine:

  $ eval `virt-inspector --fish /dev/Guests/CentOS5.img`
  
  Welcome to guestfish, the libguestfs filesystem interactive shell for
  editing virtual machine filesystems.
  
  Type: 'help' for help with commands
        'quit' to quit the shell
  
  ><fs> mounts
  /dev/mapper/VolGroup00-LogVol00
  /dev/sda1
  ><fs> ll /boot/
  total 12151
  drwxr-xr-x  4 root root    1024 May 11 18:16 .
  drwxr-xr-x 22 root root    4096 May 19 05:06 ..
  -rw-r--r--  1 root root  931546 May  7 11:05 System.map-2.6.18-128.1.10.el5
  -rw-r--r--  1 root root  931457 Jan 21 11:10 System.map-2.6.18-128.el5
  -rw-r--r--  1 root root   67942 May  7 11:05 config-2.6.18-128.1.10.el5
  -rw-r--r--  1 root root   67937 Jan 21 11:10 config-2.6.18-128.el5
  [etc]
About these ads

4 Comments

Filed under Uncategorized

4 responses to “New tool: virt-inspector

  1. kashyap

    Hi, I tried virt-inspector today on F11(x64).
    All the virtual machine guests I run are RHEL 5.3.
    I tried 2 things.
    1. virt-inspector on a RHEL5.3 guest (active-up & running)
    Result – Refusing to proceed
    ———————————–
    [root@f1164 ~]# virt-inspector /var/lib/libvirt/images/greece.img
    guest image /var/lib/libvirt/images/greece.img is writable! REFUSING TO PROCEED.
    You can use –force to override this BUT that action
    MAY CORRUPT THE DISK IMAGE.
    ———————————
    Note: though –force worked(but I hesitantly used as it’s not recommended).
    ***********************
    (2).virt-inspector on a RHEL5.3 guest (inactive -Shutoff)
    Result: same as in (1) – Refusing to proceed.
    –force says the below
    ———————————
    [root@f1164 ~]# virt-inspector /var/lib/libvirt/images/venice.img –force
    Could not allocate physical memory
    launch: failed to connect to vmchannel socket at /usr/bin/virt-inspector line 217.
    ———————————-
    Let me know if you need any debugging info(I ran strace & ltrace. If you think it’d be useful, I can provide them).
    My question: what does ” foo.img is writable!” mean- ofcourse it’dwriteable as I’m root. Let me know if I’m totally ignoring something.

  2. rich

    kashyap, Thanks for the detailed report.

    I think you’re using a rather old version of virt-inspector, because the need for the “–force” option was removed quite a long time ago. Can you try the new version:

    yum --enablerepo=updates-testing install virt-inspector
    

    or from here.

    The second problem sounds like you didn’t have enough memory to run virt-inspector, but anyway if I were you I’d use the latest version before concluding it is a bug.

    • kashyap

      thanks rich for the response,
      new version (1.0.51) from updates-testing did the trick :). I guess the package is waiting to get signed.
      I was using 1.0.21 from the “updates” repo.
      I should have checked the “updates-testing” repo before proceeding.
      Note: It worked fine,with guests in both “Active” and “Shutoff” states.
      Nice tool.

  3. Pingback: GLLUG talk on libguestfs (18th March 2010) « Richard WM Jones

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s