Chapter 5. Working with Virtual Machines

Our two Automate examples so far have been slightly abstract, but in this chapter we’ll work with a real virtual machine. Our script will find and use the Automation Engine object representing the virtual machine, and we’ll call one of the object’s methods. Rather than running our script from Simulation as we have up to now, we’ll customize the WebUI display for our virtual machine and add a new toolbar button to run our script.

Custom Attributes

CloudForms naturally collects a large amount of data about each virtual machine or instance that it manages and displays this in the WebUI. We can examine such attributes as IP address, operating system, CPU count, or disk configuration, for example, but sometimes it is useful to be able to add our own comments or notes to the virtual machine. CloudForms allows us to do this in the form of custom attributes, which have two parts: a name (sometimes called the key) and a text string value (see Figure 5-1).

mcla 0501
Figure 5-1. Example custom attributes

Custom attributes are a useful way to store any related free-text information with an object, particularly a virtual machine. We might store a CMDB configuration item ID, for example, or perhaps some text describing the configuration status. Virtual machine custom attributes are visible in the WebUI and readable from an automation script.

In this example ...

Get Mastering CloudForms Automation now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.