Skip to content

Unable to reload the OS with new hard drive partition #45

@acamacho82

Description

@acamacho82

Hi,
I'm creating some examples in order to pass them to customers when they required, and I'm trying to reload the OS of bare metal servers with a new disk partition but I'm unable to add the partitions to the Container_Hardware_Server_Configuration object.

configuration := datatypes.Container_Hardware_Server_Configuration{
        ItemPrices : prices,
        HardDrives : hardDrives ,    // Cannot use []Hardware_Component_HardDrive type as []Hardware_Component
}

Below is the hard drive partition that I'd like to add it to the configuration above, the problem is that HardDrives is an array of Hardware_Component objects and I couldn't find a way to add Hardware_Component_HardDrive objects like in Python or REST.
I tried by adding a complexType parameter or convert it to Hardware_Component but only errors are raised.

hardDrives := []datatypes.Hardware_Component_HardDrive{
        {
	        Partitions: []datatypes.Hardware_Component_Partition{
		        {
			        Name        : sl.String("/swap0"),
				MinimumSize : sl.Float(1),
			},				
			{
				Name        : sl.String("/"),
				MinimumSize : sl.Float(1),
				Grow        : sl.Int(1),
			},
		},
	},
}

I realize that most of supported languages for Softlayer API are based on sldn documentation, but I noticed that sldn have some issues since there are missing parameters like 'complexType' which is used in Hardware_Component (like python example below) or deprecated parameters like snapshotSpaceAvailable in Network_Storage (comment here). And due to that, this may be an issue in softlayer-go.

Please, let me know if there is something wrong with my implementation.

Examples in other languages:
Following is part of a SOAP structure to reload the OS

<ns1:reloadOperatingSystem>
      <token xsi:type="xsd:string">FORCE</token>
      <config xsi:type="ns1:SoftLayer_Container_Hardware_Server_Configuration">
        <hardDrives SOAP-ENC:arrayType="ns1:SoftLayer_Hardware_Component[1]" xsi:type="ns1:SoftLayer_Hardware_ComponentArray">
          <item xsi:type="ns1:SoftLayer_Hardware_Component_HardDrive">
            <partitions SOAP-ENC:arrayType="ns1:SoftLayer_Hardware_Component_Partition[2]" xsi:type="ns1:SoftLayer_Hardware_Component_PartitionArray">              
              <item xsi:type="ns1:SoftLayer_Hardware_Component_Partition">
                <name xsi:type="xsd:string">/swap0</name>
                <minimumSize xsi:type="xsd:decimal">0.75</minimumSize>                
              </item>
              <item xsi:type="ns1:SoftLayer_Hardware_Component_Partition">                
                <name xsi:type="xsd:string">/</name>
                <minimumSize xsi:type="xsd:decimal">10</minimumSize>
                <grow xsi:type="xsd:int">1</grow>                
              </item>              
            </partitions>
          </item>
        </hardDrives>
      </config>
    </ns1:reloadOperatingSystem>

On Python and REST, the 'complexType' parameter is used to specify the Hardware_Component_HardDrive

hardDrives = [
    {
        'complexType': 'SoftLayer_Hardware_Component_HardDrive',
        'partitions': [
            {    'name': '/swap0',  'minimumSize': '1',   },                 
            {    'name': '/',       'minimumSize': '1',   'grow': '1', },
        ]
    }
]

config = {
        'itemPrices': itemPrices,
        'hardDrives': hardDrives
    }

reload = client['Hardware_Server'].reloadOperatingSystem('FORCE', config, id=serverId)

Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions