When you work with virtual machines in the cloud, one of the most critical functions that you’ll need to perform is to back up your virtual machines on a consistent basis. Since cloud vendors employ a hourly or monthy billing model for having the machines running, unless the machines are business critical and required to run 24×7, you’ll want them running for a set period of time, cancelled, and then re-provisioned when they are needed again. To faciliate this process, many cloud vendors allow you to create a template for the virtual machine to save a copy for future use. When you want to bring this machine online again, you just order the template instead of ordering a brand new virtual machine.
The SoftLayer Activity Library that I posted about a month ago provides the ability to create templates from the Cloud Computing Instances (CCIs) that you have running on your SoftLayer account. This article explains how to create templates from existing virtual machines as part of Workflow Studio workflows. To download the SoftLayer activity library and get started, view the setup instructions listed here. To view the full list of blogs within this blog series, refer to the bottom of this article.
As I was creating the workflow for this article, I noticed the original SoftLayer Activity Library that I created had a bug within the Create Template activity. When this activity executed, I kept getting the error – “Invalid block device supplied. Please be sure to not include the block device for a swap disk.” When talking with the lead developer at SoftLayer, it turned out they had changed the code slightly on how we should create templates from existing CCIs. I updated the Create Template activity to include the needed changes. So if you want to follow this workflow yourself, you’ll need to re-download the latest SoftLayer Activity Library for Citrix Workflow Studio.
To create a template for an instance on SoftLayer, we need to know the Instance ID for the instance. In one of the previous blogs in this series, we used the SoftLayer Activity Library for displaying the instance details in a message box. The Instance ID was one of the details that we retrieved.
If you have experience in using the SoftLayer portal, you’ll notice that when they display the list of Cloud Computing Instances (CCIs) for your account on the web page, each link contains the Instance ID for that instance. This is another way you can retrieve the Instance ID for the instance that you want to create a template for.
Open the Workflow Studio Console and create a new workflow called CreateTemplate. Within the Workflow Studio Designer, drag the Connect To SoftLayer, Create Template, Message Box, and Disconnect From SoftLayer activities to the designer surface as shown below. The Message Box activity can be found within the Workflow Control activity library section. The other three activities are all part of the SoftLayer activity library section.
Configure the activities as noted in the table below:
|Connect To SoftLayer||
|Disconnect From SoftLayer||
The purpose of inserting the Message Box activity into this sample workflow is to allow us to view the status of the template request. If the template request went through successfully, a transaction id should be returned. In a true workflow, I would definitely recommend storing the transaction id into a SQL Server database or wherever you are storing data about this instance. The SQL Server Activity Library can be used for executing commands on a SQL database for storing this data. The key point is that the transaction id should be retained so that it can used for displaying within your applications.
Run the workflow within the Designer. Ensure that it succeeds properly. A message box should be displayed containing the transaction id for the template request. If you open the SoftLayer portal you should now see a transaction being performed on this instance which represents the template being created.
Once the template is created, you’ll want to keep track of the Template ID for the template. You can re-provision the template as a new Cloud Computing Instance (CCI) by using the Place Order activity within the SoftLayer activity library. When you configure this activity just be sure to include the Template ID. See this blog about how to use the Place Order activity.
This is the last blog in the series about how to use the SoftLayer Activity Library for Citrix Workflow Studio. If you have any requests on what else you would like to see with this library, just let me know. Stay tuned for more blogs on additional Workflow Studio topics.
- SoftLayer Activity Library Download
- Getting Started
- Ordering instances on SoftLayer
- Checking status of instances on SoftLayer
- Cancelling instances on SoftLayer
- Creating templates on SoftLayer (this one)
Ask-the-Architect Site: http://community.citrix.com/p/product-automation#home
Follow Me on twitter: http://twitter.com/citrixedy