EarIier I wrote about some ways to modify VM disk images used by Unetlab. Basically it boils down to running a VM, console to it and change things through its shell. Obviously, this approach is no way near a handy way to do small changes like:
- loading basic config
- adding license files
In this post I will talk about
guestfish utility which is a part of
libguestfs tools set. With
guestfish one could easily get a shell-like access to the filesystem located on a disk image (qcow2, vmdk, iso and many others). That is how authors of
libguestfs tools describe it:
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
, creating guests
, P2V, V2V
, performing backups, cloning VMs, building VMs, formatting disks, resizing disks, and much more.
libguestfs can access almost any disk image imaginable. It can do it securely — without needing root and with multiple layers of defence against rogue disk images. It can access disk images on remote machines or on CDs/USB sticks. It can access proprietary systems like VMware and Hyper-V.
To demonstrate the way how guestfish works I will solve a particular task of adding a license file to Nokia (Alcatel-Lucent) 7750 Virtual Service Router (VSR) by embedding it to the disk image itself. Tune in!
It became quite a pain to get Web-based console working on ESXi hosts or vCenter servers with deprecation of NPAPI plugins in modern browsers. As for me, the most comfortable method to get a remote console access is to use standalone Virtual Machine Remote Console client (VMRC) which is available for free for major OSes. The sad part about VMRC is that you have to login to ESXi web client/vCenter, choose a desired VM and click on Launch VMRC link to get access. Too many unnecessary and annoying steps to take.
In my day to day work I have to deal with 2-4 VMs and what I want is to have their consoles 1-click away. In this post I’ll share a tiny Python script which composes links for VMs suitable for VMRC:
vmrc://email@example.com:443/?moid=vm-373 . Click on the previous link will trigger VMRC to connect to virtual console of a VM.