Created
January 21, 2015 19:36
-
-
Save rickymoorhouse/027b097fba42eb40f807 to your computer and use it in GitHub Desktop.
Capture Image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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