1

I'm trying to do a dry-run for ordering a bare metal server using the Softlayer python API following the instructions here: http://sldn.softlayer.com/blog/bpotter/ordering-bare-metal-servers-using-softlayer-api and leveraging the sample code provided (https://gist.github.com/bmpotter/27913e92e9ff7b6b0c54). However, I keep getting this exception when doing a orderVerify():

SoftLayer_Exception_Public: The price for 64 GB RAM (#154399) is not valid for location dal10.

Here is price array I use for package 253:

prices = [
{'id': getItemPriceId(items, 'server', 'INTEL_XEON_2620_2_40')},
{'id': getItemPriceId(items, 'os', 'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT')},
{'id': getItemPriceId(items, 'ram', 'RAM_64_GB_DDR3_1333_REG_2')},
{'id': getItemPriceId(items, 'disk_controller', 'DISK_CONTROLLER_RAID_1')},
{'id': getItemPriceId(items, 'disk0', 'HARD_DRIVE_1_00_TB_SATA_2')},
{'id': getItemPriceId(items, 'disk1', 'HARD_DRIVE_1_00_TB_SATA_2')},
{'id': getItemPriceId(items, 'disk2', 'HARD_DRIVE_1_00_TB_SATA_2')},
{'id': getItemPriceId(items, 'disk3', 'HARD_DRIVE_1_00_TB_SATA_2')},
{'id': getItemPriceId(items, 'port_speed', '10_GBPS_REDUNDANT_PRIVATE_NETWORK_UPLINKS')},
{'id': getItemPriceId(items, 'power_supply', 'REDUNDANT_POWER_SUPPLY')},
{'id': getItemPriceId(items, 'bandwidth', 'BANDWIDTH_0_GB')},
{'id': getItemPriceId(items, 'pri_ip_addresses', '1_IP_ADDRESS')},
{'id': getItemPriceId(items, 'remote_management', 'REBOOT_KVM_OVER_IP')},
{'id': getItemPriceId(items, 'vpn_management', 'UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT')},
{'id': getItemPriceId(items, 'monitoring', 'MONITORING_HOST_PING_AND_TCP_SERVICE')},
{'id': getItemPriceId(items, 'notification', 'NOTIFICATION_EMAIL_AND_TICKET')},
{'id': getItemPriceId(items, 'response', 'AUTOMATED_NOTIFICATION')},
{'id': getItemPriceId(items, 'vulnerability_scanner', 'NESSUS_VULNERABILITY_ASSESSMENT_REPORTING')},
]

And the order info:

{'hardware': [{'domain': 'my.domain.com',
           'hostname': 'myHost'}],
 'location': 1441195,
 'packageId': 253,
 'prices': [{'id': 50635},
        {'id': 37652},
        {'id': 154399},
        {'id': 141957},
        {'id': 49811},
        {'id': 49811},
        {'id': 49811},
        {'id': 49811},
        {'id': 35685},
        {'id': 50223},
        {'id': 35963},
        {'id': 34807},
        {'id': 25014},
        {'id': 33483},
        {'id': 34241},
        {'id': 32500},
        {'id': 32627},
        {'id': 35310}],
 'quantity': 1}

I checked and RAM_64_GB_DDR3_1333_REG_2 is in the output of getOrderItemsDict(). Any ideas?

Andy Pham
  • 11
  • 2

1 Answers1

0

There is a mistake with price: 154399, it is not valid for Dallas 10 datacenter (1441195), to get more information you can review the below link:

Location-based Pricing and You

You can try changing this price 49427(is a standard price which is valid for any datacenter) instead of 154399 in the order, for RAM_64_GB_DDR3_1333_REG_2


Retrieve packages (prices and locations) which contain specific items

"""
This script searches packages with its prices and locations according 
to items sent (it's necessary to send the item's keyName, it's possible 
to send more than one item to search)

Important links:
http://sldn.softlayer.com/reference/services/SoftLayer_Account/getActivePackages
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getItemPrices

License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
from prettytable import PrettyTable

# Define your username and apiKey
USERNAME = 'set me'
API_KEY = 'set me'

# Items to search
items = ['INTEL_XEON_2620_2_40',
         'OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT',
         'RAM_64_GB_DDR3_1333_REG_2',
         'DISK_CONTROLLER_RAID_1',
         'HARD_DRIVE_1_00_TB_SATA_2',
         'HARD_DRIVE_1_00_TB_SATA_2',
         'HARD_DRIVE_1_00_TB_SATA_2',
         'HARD_DRIVE_1_00_TB_SATA_2',
         '10_GBPS_REDUNDANT_PRIVATE_NETWORK_UPLINKS',
         'REDUNDANT_POWER_SUPPLY',
         'BANDWIDTH_0_GB',
         '1_IP_ADDRESS',
         'REBOOT_KVM_OVER_IP',
         'UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT',
         'MONITORING_HOST_PING_AND_TCP_SERVICE',
         'NOTIFICATION_EMAIL_AND_TICKET',
         'AUTOMATED_NOTIFICATION',
         'NESSUS_VULNERABILITY_ASSESSMENT_REPORTING']

# Declaring the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)

# Declaring Account and Package services
accountService = client['SoftLayer_Account']
packageService = client['SoftLayer_Product_Package']

# objectFilter to get standard prices
objectFilter = {"itemPrices":{"locationGroupId":{"operation":"is null"}}}

# Counting the items
countItems = len(items)

try:
    packages = accountService.getActivePackages()
    for package in packages:
        itemsDisplay = ''
        pricesDisplay = ''
        prices = packageService.getItemPrices(id=package['id'], filter=objectFilter)
        count = 0
        for item in items:
            for price in prices:
                if price['item']['keyName'] == item:
                    itemsDisplay += str("%s\n" % price['item']['keyName'])
                    pricesDisplay += str("%s\n" % price['id'])
                    count = count + 1
        if count == countItems:
            table = PrettyTable(["PackageId", "Item(s)", "Price(s)", "Location(s)"])
            locations = packageService.getRegions(id=package['id'])
            locationDisplay = ''
            for location in locations:
                locationDisplay += str("Id: %s (%s)\n" % (location['location']['location']['id'], location['location']['location']['longName']))
            table.add_row([package['id'], itemsDisplay, pricesDisplay, locationDisplay])
            print(table)

except SoftLayer.SoftLayerAPIError as e:
    print(('Error faultCode=%s, faultString=%s'
    % (e.faultCode, e.faultString)))

Setting VLANS

"hardware": [  
   {  
      "hostname":"testhost",
      "domain":"softlayer.com",
      "primaryBackendNetworkComponent":{  
         "networkVlanId":971077
      },
      "primaryNetworkComponent":{  
         "networkVlanId":971075
      }
   }
]
  • Thanks. That makes sense. Per the comment in the sample code I use, it should return the right item id: – Andy Pham May 30 '17 at 18:20
  • Though something I'm still wondering is, I looked thru the list and only found these options for RAM: RAM_128_GB_DDR3_1333_REG_2, RAM_256_GB_DDR3_1333_REG_2, RAM_512_GB_DDR4_2133_ECC_REG, RAM_64_GB_DDR3_1333_REG_2. If only 16 GB of RAM is needed, what option should be used? – Andy Pham May 30 '17 at 18:28
  • The minimum option for this kind of servers is 64 GB RAM, you need to chose another package if you would like to order a server with 16 GB RAM – Ruber Cuellar Valenzuela May 30 '17 at 19:35
  • Thanks that works. So the next hurdle for me is to ensure all new servers are in the same Vlan. I've looked around and noticed from this post: https://stackoverflow.com/questions/44146080/how-can-i-filter-the-list-of-vlans-to-just-get-ones-valid-for-virtual-guest-orde/44146385#44146385 to use https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Order/getVlans to get the Vlans. However, I tried with the Chrome poster REST client and always get {"privateVlans":[],"publicVlans":[]} with a 200 return code, tried different package/location same result. Any ideas? – Andy Pham Jun 01 '17 at 15:53
  • It means that you don't have any vlan purchased in that datacenter, but it is not the problem, if you don't have any vlan in there, SoftLayer will provide one without any charge. – Ruber Cuellar Valenzuela Jun 01 '17 at 17:20
  • Putting everything together, our typical order is 5 servers with the following items: INTEL_XEON_2650_2_30-dup OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT RAM_64_GB_DDR3_1333_REG_2 DISK_CONTROLLER_RAID HARD_DRIVE_1_00_TB_SATA_2 HARD_DRIVE_1_00_TB_SATA_2 HARD_DRIVE_1_00_TB_SATA_2 10_GBPS_REDUNDANT_PRIVATE_NETWORK_UPLINKS REDUNDANT_POWER_SUPPLY BANDWIDTH_0_GB 1_IP_ADDRESS REBOOT_KVM_OVER_IP UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT MONITORING_HOST_PING_AND_TCP_SERVICE NOTIFICATION_EMAIL_AND_TICKET AUTOMATED_NOTIFICATION NESSUS_VULNERABILITY_ASSESSMENT_REPORTING – Andy Pham Jun 01 '17 at 20:05
  • From experimenting with SL API, it seems not all packages have those items and not all locations/datacenters have all the packages. Another thing is all 5 servers need to be on the same Vlan. So is there any script/tool to help determine which package and location I can use to place the order with that requirement? Pretty sure other customers would have the same need. Figure I can crawl thru all the packages/location/Vlans to check but that would be very inefficient imho. – Andy Pham Jun 01 '17 at 20:19
  • Let me check if I can create something to help with it – Ruber Cuellar Valenzuela Jun 01 '17 at 20:28
  • so while waiting for what you come up with, I explore another option; the REST API approach : https://sldn.softlayer.com/reference/services/SoftLayer_Hardware/createObject. I found a preset keyName that’s closest to what we need D2620V4_64GB_2X1TB_SATA_RAID_1 (running of space so will post the payload I use in the next comment). However, I'm getting a 500 Internal server error: {"error":"VLANs may not be specified for Bare Metal Server configurations.","code":"SoftLayer_Exception_Public"} The doc clearly mentions we can specify Vlan, not sure what’s going on. – Andy Pham Jun 02 '17 at 19:48
  • Here is the payload I use: { "parameters": [ { "hostname": "foobar", "domain": "x.y.z.net", "privateNetworkOnlyFlag":true, "hourlyBillingFlag": false, "operatingSystemReferenceCode": "UBUNTU_14_64" , "primaryNetworkComponent": { "networkVlan": { "id": 1307849 }}, "datacenter": {"name": "dal10"}, "fixedConfigurationPreset": {"keyName": "D2620V4_64GB_2X1TB_SATA_RAID_1"}, "networkComponents": [{"maxSpeed": 1000}], "sshKeys":[{“id”: #####}] } ] } – Andy Pham Jun 02 '17 at 19:51
  • Since you are ordering a preset configuration, this uses the package: 200 which is fast provisioning servers, unfortunately it's not possible to set vlans for this kind of servers – Ruber Cuellar Valenzuela Jun 05 '17 at 17:21
  • Review the script that I attached in **Retrieve packages (prices and locations) which contain specific items** section in my last answer. I hope it helps – Ruber Cuellar Valenzuela Jun 05 '17 at 18:27
  • Thanks Ruber. With your help was able to put together a working script. – Andy Pham Jun 08 '17 at 18:33
  • hi @Ruber ... So I ran the script a couple of times ordering 5 BM servers each time and it worked both times. However, upon closer inspection I noticed a couple of things are still NOT quite right. 1) even though I specified the same vlan ID for all; NOT all servers are on the same VLAN; 1st order: 2 on one and 3 on another, 2nd order: 1 on one and 4 on a different one. 2) incorrect disk configuration: WANTED : 4 RAID1 disks associated with 2 logical volumes and volume 2 not mounted GOT: 4 RAID disks with 2 logical volumes and both volumes mounted ... out of space, more details following – Andy Pham Jun 28 '17 at 21:29
  • Using package 253 and the following items: INTEL_XEON_2620_2_40, OS_UBUNTU_14_04_LTS_TRUSTY_TAHR_64_BIT, RAM_64_GB_DDR3_1333_REG_2, DISK_CONTROLLER_RAID, HARD_DRIVE_1_00_TB_SATA_2, HARD_DRIVE_1_00_TB_SATA_2, HARD_DRIVE_1_00_TB_SATA_2, HARD_DRIVE_1_00_TB_SATA_2, 1_GBPS_REDUNDANT_PRIVATE_NETWORK_UPLINKS, REDUNDANT_POWER_SUPPLY, BANDWIDTH_0_GB, 1_IP_ADDRESS, REBOOT_KVM_OVER_IP, UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT, MONITORING_HOST_PING_AND_TCP_SERVICE, NOTIFICATION_EMAIL_AND_TICKET, AUTOMATED_NOTIFICATION, NESSUS_VULNERABILITY_ASSESSMENT_REPORTING. Will post the final order next – Andy Pham Jun 28 '17 at 21:39
  • {'hardware': [{'domain': 'fool.bar.net', 'hostname': 'my-bm-server', 'networkVlans': [{'id': 1307849}]}], 'location': 1441195, 'packageId': 253, 'prices': [{'id': 50635}, {'id': 37652}, {'id': 49427}, {'id': 141945}, {'id': 49811}, {'id': 49811}, {'id': 49811}, {'id': 49811}, {'id': 26723}, {'id': 50223}, {'id': 35963}, {'id': 34807}, {'id': 25014}, {'id': 33483}, {'id': 34241}, {'id': 32500}, {'id': 32627}, {'id': 35310}], 'quantity': 1, 'storageGroups': [{'arrayTypeId': 2, 'hardDrives': [0, 1], 'partitionTemplateId': 1}, {'arrayTypeId': 2, 'hardDrives': [2, 3]}]} ... using dal10 DC – Andy Pham Jun 28 '17 at 21:41
  • As you can see I searched for a VLAN that has enough slots using the code you provided and specified its ID for all the servers: 1307849 ... however, when I looked on https://control.softlayer.com/devices# this is what I see: 4 of my servers are on VLAN # 909 with ID 1307855 and only one on VLAN # 908 with ID 1307849. Any ideas how I can debug/fix the 2 remaining issues? – Andy Pham Jun 28 '17 at 21:54
  • As I see, there is a mistake in your template to define VLANS, I added **Setting Vlans** section in my answer, see it, for more information – Ruber Cuellar Valenzuela Jun 29 '17 at 14:43
  • So is there a restriction/required relation between "primaryBackendNetworkComponent" and "primaryNetworkComponent"? That is do they have to be on the same Vlan number or just in the same datacenter is fine? Thanks. – Andy Pham Jun 29 '17 at 16:38
  • **primaryBackendNetworkComponent (private vlan)** and **primaryNetworkComponent (public vlan)**, both vlans should belong to the datacenter in which you would like to place the order. You can configure both or just one according to your requirements. There is no any restriction – Ruber Cuellar Valenzuela Jun 29 '17 at 17:31
  • Thanks Ruber. On the other listed issue: the 4 RAID1 disks (spare ones unmounted). Would that be 'DISK_CONTROLLER_RAID' or 'DISK_CONTROLLER_RAID1'? Also how do you specify for the spare disks (3) to be not mounted? Any links to doc where these are explained would also be of great help. – Andy Pham Jun 29 '17 at 18:14
  • Sorry I forgot, Please review this link: [Ordering RAID Through API](http://sldn.softlayer.com/blog/hansKristian/Ordering-RAID-through-API), let me know if you have any doubt about how to configure this – Ruber Cuellar Valenzuela Jun 29 '17 at 18:25