0

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.

ambikanair
  • 4,004
  • 11
  • 43
  • 83

1 Answers1

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

  • Yes , I did refer to the stackoverflow question you mentioned in the reply before posting this query. We used the `getObject` method to check the details of the disk . For passing the id to this particular method, we used `getBlockDevices` method. And in the query,I have masked few characters of the ID. They are not the actual IDs. – ambikanair Feb 01 '18 at 03:08
  • `curl -XGET -H "Authorization: Basic ${AUTH}" -H "Content-type: application/json" https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/48xxx481/getBlockDevices.json` – ambikanair Feb 01 '18 at 03:10
  • 1
    you could try the VSManger that the python client offers, it has a method to create the image template without spececify the ID for the block devices http://softlayer-python.readthedocs.io/en/latest/api/managers/vs.html#SoftLayer.managers.vs.VSManager.capture – Nelson Raul Cabero Mendoza Feb 01 '18 at 12:57