ambikanair
ambikanair

Reputation: 4590

Softlayer API: Unable to create the image template. faultCode=SoftLayer_Exception_Public, faultString=Invalid block device supplied

I am using the below code to capture image. Please be sure to not include the block device for a swap disk.

blockDevices = [
    {
        "id": 52xx5821,
        "complexType": "SoftLayer_Virtual_Guest_Block_Device"
    },
    #{
    #    "id": 52yy5827,
    #    "complexType": "SoftLayer_Virtual_Guest_Block_Device"
    #},
    {
        "id": 5zzz5845,
        "complexType": "SoftLayer_Virtual_Guest_Block_Device"
    }
]

try:
    # Creating the transaction for the image template
    response = client['SoftLayer_Virtual_Guest'].createArchiveTransaction(groupName, blockDevices, note, id=virtualGuestId)
    print(response)

and while executing the code , I get this error

Unable to create the image template. faultCode=SoftLayer_Exception_Public, faultString=Invalid block device supplied. Please be sure to not include the block device for a swap disk.

I got the disk details this way

 image = client['SoftLayer_Virtual_Disk_Image'].getObject(mask=mask,id=imageId)
pp(image)

For two disks, I see the description as

 'type': {'description': 'a disk that may be replaced on upgrade',

and for the third one

'type': {'description': 'a disk that is used for swap space',

I want to capture image which has the disk with first description. [ not the swap one]. It is of 25GB and 100GB.

I tried all combinations of above 3 id. But I get this error always.

Upvotes: 0

Views: 201

Answers (1)

I recomend you to see this forum is the same question:

Softlayer API: How to do image capture with specify certain data disk?

It seems that the IDs that you are getting are wrong, according your question you are using the SoftLayer_Virtual_Disk_Image::getObject method the thing is that for use that method you already need to know the ID and in your questions there is not clear how you are getting that ID.

In order to get the correct IDs you need to use the http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getBlockDevices method

e.g.

blockDevices = client['SoftLayer_Virtual_Guest'].getBlockDevices(id=virtualGuestId)

from that you need to pick up the block device that you want, just in case blockDevice which property device = 1 is the swap disk.

Also it may help you this:

https://programtalk.com/python-examples/SoftLayer.fixtures.SoftLayer_Virtual_Guest.createArchiveTransaction/

Regards

Upvotes: 1

Related Questions