November 23, 2017

Create image template.

The script creates a standard image template, it makes
a call to the SoftLayer_Virtual_Guest::createArchiveTransaction method
sending the IDs of the disks in the request, the response will provide an ID property
which is the Transaction number until it´s being fully provisioned.

For more information please see below.

Important manual pages:

Author: SoftLayer Technologies, Inc. <>
import SoftLayer

from pprint import pprint as pp

# The virtual guest ID you want to create a template
virtualGuestId = 39202937
# The name of the image template
groupName = 'fmirGroupImageTemplate'
# An optional note for the image template
note = 'an optional fmir note'

Build a skeleton SoftLayer_Virtual_Guest_Block_Device object
containing the disks you want to the image.
In this case we are going take an image template of 2 disks
from the virtual machine.
blockDevices = [
        "id": 60788837,
        # "complexType": "SoftLayer_Virtual_Guest_Block_Device"
        "id": 59411427,
        # "complexType": "SoftLayer_Virtual_Guest_Block_Device"

# Declare a new API service object
client = SoftLayer.create_client_from_env()

    # Creating the transaction for the image template
    response = client['SoftLayer_Virtual_Guest'].createArchiveTransaction(
        groupName, blockDevices, note, id=virtualGuestId)
except SoftLayer.SoftLayerAPIError as e:
    # If there was an error returned from the SoftLayer API then bomb out with the
    # error message.
    print("Unable to create the image template. \nfaultCode= %s, \nfaultString= %s"
          % (e.faultCode, e.faultString))


We would love to hear it
Open an issue