Archive

Building virtual images in a scripting environment with IBM SmartCloud Provisioning

Share this post:

In this post, I describe how you can script the building of virtual images by using the Image Construction and Composition Tool provided by IBM SmartCloud Provisioning.

The upcoming release of IBM SmartCloud Provisioning 2.1 embeds, among other things, a new version of the Image Construction and Composition Tool. With this tool, you can build virtual images that are self-descriptive, customizable, and manageable; at the end, it produces Open Virtualization Appliance (OVA) images that can be deployed to a cloud environment.

One of the new features of this tool is the capability of performing image management operations directly through a command-line interface (CLI). This capability enables a set of new use cases through a scripting environment.

The CLI of the Image Construction and Composition Tool provides a scripting environment based on Jython (the Java-based implementation of Python); in addition to issuing commands specific to the Image Construction and Composition Tool, you can also issue Python commands at the command prompt.

With the interface, you can manage the Image Construction and Composition Tool remotely because you can download it to any machine and then point to the system where the tool is running: it communicates with the server using the HTTPS protocol so that all the communications are encrypted. The CLI can be installed on both Linux and Windows operating systems and can run in both interactive and batch modes.

Anything that can be managed in the Image Construction and Composition Tool is modelled by a resource object on the CLI that exposes a set of methods for performing the related management actions. The following objects are available:

  • Software bundles references (for defining software configurations to be deployed on a virtual machine)
  • Cloud providers references (for defining the hypervisors used by Image Construction and Composition Tool to build and capture images)
  • Images references (for handling virtual machine images to be used for import, extend, capture and export operations)
  • User references (for administering the user of Image Construction and Composition Tool).

After you download and configure the command-line to start a new session in interactive mode, you can issue the following command from a shell prompt:

<icct_cli-install-dir>/bin/icct -h <icct server> -u username -p password

 

When you get the interactive shell, you can start issuing commands.

Here are several examples:

Get a list of all the images for a cloud provider:

>>> icct.cloudproviders[0].getImages()

 

Import a software bundle and wait for the import to complete; use a set of commands:

>>> importingBundle = icct.bundles.import('http://localhost/myBundle.ras')

>>> importingBundle.waitFor()

>>> if importingBundle.currentState == 'import_failed':

... print 'Bundle import failed!'

 

Get a list of all the images:

>>> allImages = icct.images

And so on.

You can also use the Image Construction and Composition Tool command-line interface in batch mode, by creating your own script and then launching it.

For example, to run a script named myScript.py, issue the following command:

icct -h <icct server> -u username -p password -f myScript.py arg1 arg2 arg3

 

A few samples come directly with Image Construction and Composition Tool. They are located under the following directory:

<icct_cli-install-dir>/samples

 

They cover some of the Image Construction and Composition Tool basic flows, such as creating a new cloud provider configuration, importing an image, extending an image, and more.

You can use them as a starting point for creating your own workflows.

That’s all for now.

This is a quick introduction of all the capabilities of the Image Construction and Composition Tool command-line interface. If you are interested in discovering more about this tool, its command-line interface, and SCP 2.1, see what is included in IBM SmartCloud Provisioning beta code:

Customer interaction program

Cloud Provisioning and Orchestration – Development Collaboration Community

More stories

Why we added new map tools to Netcool

I had the opportunity to visit a number of telecommunications clients using IBM Netcool over the last year. We frequently discussed the benefits of have a geographically mapped view of topology. Not just because it was nice “eye candy” in the Network Operations Center (NOC), but because it gives an important geographically-based view of network […]

Continue reading

How to streamline continuous delivery through better auditing

IT managers, does this sound familiar? Just when everything is running smoothly, you encounter the release management process in place for upgrading business applications in the production environment. You get an error notification in one of the workflows running the release management process. It can be especially frustrating when the error is coming from the […]

Continue reading

Want to see the latest from WebSphere Liberty? Join our webcast

We just released the latest release of WebSphere Liberty, 16.0.0.4. It includes many new enhancements to its security, database management and overall performance. Interested in what’s new? Join our webcast on January 11, 2017. Why? Read on. I used to take time to reflect on the year behind me as the calendar year closed out, […]

Continue reading