Softlayer_Hardware: How to setup multiple raid10 s

2019-08-16 11:50发布

I am working on automation of provisioning Softlayer baremetal instances. I have an appropriate json for ordering the hardware, but I can't seem to figure out how to specify the disk layout.

The Answer below from Nelson shows the key part to the process: Using the Chrome developer tools to obtain price ids and raid configuration.

On the portal I ordered a test system, specifying 4 4000GB Western Digital WD RE drives and cofiguring the storage groups with 1 TB standard linux plus a 7 TB additional partition.

Storage group configuration

And using the chrome dev tools to capture the resulting json, I see the storage group configuration

data[Order][primaryDiskPartitionId]:1
data[Order][storageGroups][storage-group-1][arrayTypeId]:5
data[Order][storageGroups][storage-group-1][arraySize]:1000
data[Order][storageGroups][storage-group-1][lvmFlag]:0
data[Order][storageGroups][storage-group-1][partitionTemplateId]:1
data[Order][storageGroups][storage-group-1][hardDrives][]:0
data[Order][storageGroups][storage-group-1][hardDrives][]:1
data[Order][storageGroups][storage-group-1][hardDrives][]:2
data[Order][storageGroups][storage-group-1][hardDrives][]:3
data[Order][storageGroups][storage-group-2][arrayTypeId]:5
data[Order][storageGroups][storage-group-2][arraySize]:7000
data[Order][storageGroups][storage-group-2][lvmFlag]:0
data[Order][storageGroups][storage-group-2][hardDrives][]:0
data[Order][storageGroups][storage-group-2][hardDrives][]:1
data[Order][storageGroups][storage-group-2][hardDrives][]:2
data[Order][storageGroups][storage-group-2][hardDrives][]:3

When the system materialzied, I saw the disks as follows:

/dev/sda6        1006602  1850    953597   1% / <------ sda - 1Tb linux parttion set
/dev/sda1            237    68       158  30% /boot 
/dev/sdb1        6553650    54   6487522   1% /disk1 <- sdb - remaining 7Tb 

And the disk structure is

-> fdisk -l /dev/sda
Disk /dev/sda: 1000 GiB, 1073741824000 bytes, 2097152000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disklabel type: dos
Disk identifier: 0xab520822

Device     Boot   Start        End    Sectors   Size Id Type
/dev/sda1  *       2048     499711     497664   243M 83 Linux
/dev/sda2        501758 2097149951 2096648194 999.8G  5 Extended
/dev/sda5        501760    2500607    1998848   976M 82 Linux swap / Solaris
/dev/sda6       2502656 2097149951 2094647296 998.8G 83 Linux

Partition 2 does not start on physical sector boundary.

-> fdisk -l /dev/sdb
Disk /dev/sdb: 6.3 TiB, 6926708506624 bytes, 13528727552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disklabel type: gpt
Disk identifier: ADFDCBE8-94E3-4C23-85C6-D43F332AA1BB

Device     Start         End     Sectors  Size Type
/dev/sdb1   2048 13528725503 13528723456  6.3T Linux filesystem

SL created a raid 10 device, carved that into 2 separate disks, 1 as a 1 TB linux basic and 1 as a 7 TB fs mounted at /disk1

Now we need to figure out the syntax for creating the same via python. SoftLayer API: Provision Server with Basic RAID Configuration shows how to create a basic raid10 linux partition. And Configuring Softlayer Disk Partitions at Order Time extends that to show how to create various configurations. However, neither shows how to create the configuration above. And the second states that it was not possible at the time.

This is the order json without the storageGroup block. Note that the price ids are available in the chrome dev tool discussed in the answer.

worker_json = {
    "quantity" : 1,
    "packageId": 551,
    "location" : datacenterId,
    "hardware" : [
        {
            "hostname": module.params.get('hostname'),
            "domain": module.params.get('domain'),
            "primaryNetworkComponent": {
                "networkVlanId": public,
            },
            "primaryBackendNetworkComponent": {
                "networkVlanId": private,
            }
        }
    ],
    "prices": [
        { "id": 171621 },
        { "id": 177669 },
        { "id": 165723 },
        { "id":  29691 ,  "item" : {"description": "RAID 10 - SATA/SAS - MegaRAID SAS 9361-8i" }},
        { "id":  49841 ,  "item" : {"description": "Hard Drive 4000GB Western Digital WD RE" }},
        { "id":  49841 ,  "item" : {"description": "Hard Drive 4000GB Western Digital WD RE" }},
        { "id":  49841 ,  "item" : {"description": "Hard Drive 4000GB Western Digital WD RE" }},
        { "id":  49841 ,  "item" : {"description": "Hard Drive 4000GB Western Digital WD RE" }},
        { "id":  33483 },
        { "id":  35686 },
        { "id":  50359 }, 
        { "id":  34807 },
        { "id":  27023 },
        { "id":  35310 },
        { "id":  50223 },
        { "id":  25014 },
        { "id":  34996 },
        { "id":  32500 }
    ],
    "storageGroups": [
        { What to put here? }
    ]
}

Here is the final storageGoup json that was created from the chrome dev tools output above. This produced the desired raid configuration:

    "primaryDiskPartitionId": 1,
    "storageGroups": [
        {
            "arraySize": 1000,
            "arrayTypeId": 5,
            "hardDrives": [ 0, 1, 2, 3 ],
            "partitionTemplateId" : 1
        },
        {
            "arraySize": 7000,
            "arrayTypeId": 5,
            "hardDrives": [ 0, 1, 2, 3 ]
        }
    ]

1条回答
唯我独甜
2楼-- · 2019-08-16 12:21

this is the configuration I think you are doing (it would be easier if you wouald had post an screenshot)

enter image description here

for that the storage groups configuration is:

"storageGroups": [
    {
    "arraySize": 8000,
    "arrayTypeId": 5,
    "hardDrives": [ 0, 1, 2, 3 ],
    "partitionTemplateId": 4
    }
]

Anyway if that is not the configuration you can see the configuration that the control portal is using with the chrome developer tools

you just need to go to control make all the configuration for your order and before pressing the "SAVE TO ORDER" open the developer tools, selec the "Network" tab and mark "Preserve log" checkbox:

enter image description here

then click the "Save to order" button and look for the following POST request

enter image description here

open it

enter image description here

and you will see the storage group configuration, then you just need to translate the same configuration in your request and that's it. If you have troubles with that send me the configuration that you see in developers tools

UPDATE

accordign your image the correct configuration seems be this:

"primaryDiskPartitionId": 1,
"storageGroups": [{
            "arraySize": 1000,
            "arrayTypeId": 5,
            "hardDrives": [0, 1, 2, 3],
            "lvmFlag": 1,
            "partitionTemplateId": 1
        },
        {
            "arraySize": 7000,
            "arrayTypeId": 5,
            "hardDrives": [0, 1, 2, 3]
        }
    ]
查看更多
登录 后发表回答