Skip to content

Instantly share code, notes, and snippets.

@rickymoorhouse
Created January 21, 2015 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickymoorhouse/027b097fba42eb40f807 to your computer and use it in GitHub Desktop.
Save rickymoorhouse/027b097fba42eb40f807 to your computer and use it in GitHub Desktop.
Capture Image
# Gather the block devices
blockDevices = self.client['Virtual_Guest'].getBlockDevices(id=server.id)
objectMask ="mask[id;note;transactionId;globalIdentifier;children.id;children.note;children.transactionId]"
# Gather the List of template device groups/images from softlayer as to reduce search
preVGBDTGs = self.client['Account'].getPrivateBlockDeviceTemplateGroups(mask=objectMask)
versionStamp = " [v"+version+"]"
groupName = description + versionStamp
if len(groupName) > 1000:
groupName = description[:1000-len(versionStamp)] + versionStamp
# Select disks to be captured
disks = []
for block_device in blockDevices:
if block_device['device'] != '1': # If not swap then add the disk to be captured
logger.info("addding disk #%s to be captured" % block_device['device'])
disks.append(block_device)
transactionInfo = self.client['Virtual_Guest'].createArchiveTransaction(name, disks, groupName, id=server.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment