$ vmtree -h | head -1
Utility to display cloud images and servers' inheritance tree.
The nova client program (and the web UI) is a source of comprehensive information on an OpenStack deployment. This information, however, is presented in a strictly typed manner: you get information either on servers, or images, or networks, or whatever entity, but on one of these at a time.
Some information is though inherently heterogenous. One such is the inheritance tree, involving images and servers. Images beget servers by instantiation, and servers beget images by snapshotting. It might be convenient to get an overview of these begetting relations. vmtree is an utility to display the tree that they consitute.
Requires ruby ≥ 1.9.2, and the colorize and fog gems:
# gem install fog colorize
Then run in place.
$ vmtree -h
Utility to display cloud images and servers' inheritance tree.
Usage: vmtree [options]
-s, --set X set a fog parameter in K:V format
-p, --password[=P] specify password or read from stdin
-i, --indent I indentation string (raw or json)
-C, --color[=B] colorized output
-a, --all-images show all images
--all-tenants show all tenants' servers
-A, --attrs A list of attributes ("[ap1,ap2,..|]a1,a2,...")
Currently for OpenStack (being based on fog, a versatile cloud library, other cloud providers are feasible to support).
Identity and crendentials can be given in the following ways:
- novaclient style environment variables (usually provided by sourcing an openrc file);
- fog credential file (
${FOGRC:=~/.fog}
); - individual specfication of the parameters via
--set
--password=<passwd>
is a shorthand for--set openstack_api_key:<passwd>
;--password
with no argument reads<passwd>
from stdin.
1. is a nova compatibility mode but the set of supported parameters is limited. Parameters set as of 2.-3. are directly used by Fog::Compute.new
(reference: Fog::Compute::OpenStack
's requires
/recognizes
).
Color mode is automatic by default, ie. colorized on tty, monochromatic otherwise. In the following examples we are using -Cno
for pastability but in real life you can omit that.
Basic usage:
$ vmtree -Cno
Image loot01
Server loot01
Image loot03
Server marauder5
Server loot00
Server marauder4c
Server marauder4b
Image loot02
Image Fedora 20 official release
Server marauder
Displaying some attributes along the items:
$ vmtree -Cno -A status,state,ip_addresses
Image loot01: ACTIVE
Server loot01: ACTIVE ["172.16.53.19", "10.3.13.103"]
Image loot03: ACTIVE
Server marauder5: ACTIVE ["172.16.53.18", "10.3.8.100"]
Server loot00: ACTIVE ["172.16.53.14", "10.3.11.4"]
Server marauder4c: ACTIVE ["172.16.53.6", "10.3.8.7"]
Server marauder4b: ACTIVE ["172.16.53.25", "10.3.8.116"]
Image loot02: ACTIVE
Image Fedora 20 official release: ACTIVE
Server marauder: ACTIVE ["172.16.53.3", "10.3.12.83"]
The following observations can be made:
- For each item, the attribute set is filtered by endowment, ie. if you ask for non-extant attributes (
-A foo,bar
) you don't get an error, rather they will be silently discarded. In this case,ip_addresses
is available only for servers, so it's displayed along them (but there is no issue with images not having it). - The available attributes are those of the
Fog::Compute::OpenStack::
{Image
,Server
} classes. - An oddity of fog is that status info is avaliable as
status
for images andstate
for servers. So to get the overall status info we have to passstatus,state
to-A
.
Attributes can be put to prefix position with pipe character (useful for fixed width ones):
$ vmtree -Cno -A 'id,state,status|ip_addresses'
55a9cda8-f4ab-4c7c-9b6d-324fabc15b3c ACTIVE Image loot01
51d96fc6-2681-4c7e-8267-593480364db7 ACTIVE Server loot01: ["172.16.53.19", "10.3.13.103"]
732eba89-4980-4a39-b03e-16e007013457 ACTIVE Image loot03
47f874dc-cec8-4f71-a3df-a743ada96e59 ACTIVE Server marauder5: ["172.16.53.18", "10.3.8.100"]
065e08ff-9601-496e-9190-8f5536c16cd7 ACTIVE Server loot00: ["172.16.53.14", "10.3.11.4"]
87fd2d01-f219-4df2-9124-ecae6ab45a28 ACTIVE Server marauder4c: ["172.16.53.6", "10.3.8.7"]
d5d6be22-a173-48f6-b4bd-9654ba77d1f3 ACTIVE Server marauder4b: ["172.16.53.25", "10.3.8.116"]
b88b0810-f342-4b8f-9d05-0a71855369f0 ACTIVE Image loot02
20a6f54a-bd46-4160-9cf7-a1e2d2c230aa ACTIVE Image Fedora 20 official release
12f8926b-39fd-44ac-8274-70939498db9c ACTIVE Server marauder: ["172.16.53.3", "10.3.12.83"]
Asking for all images (as by default only instantiated ones are displayed):
$ vmtree -Cno -a
Image rh-atomic-controller-2014.2
Image rh-atomic-controller-2014.1
Image fedora-atomic-controller-2014.3
Image savanna-0.3-vanilla-1.2.1-fedora19
Image loot01
Server loot01
Image loot03
Server marauder5
Server loot00
Server marauder4c
Server marauder4b
Image loot02
Image loot00
Image Fedora-x86_64-20-20131211.1 QCOW2
Image fedora-19-dev_jeos
Image centos-6.5-20140117.0.x86_64
Image centos-6-x86_64-cloud
Image ubuntu-12.04_jeos
Image fedora-20_jeos
Image fedora-19_jeos
Image RHEL 7.0 Public Beta (Official Guest Image)
Image Ubuntu 13.10
Image Fedora 20 official release
Server marauder
Image rhel7-dogfood
Image rhel-server-x86_64-kvm-6.4_20130130.0-4
Image Fedora 19
Image Fedora19-RC1
Image Fedora18-x64
Image RHEL6.4-qcow2