【问题标题】:Softlayer API Hardware: RAM-related Error when calling verifyOrder() for Bare MetalSoftlayer API 硬件:为裸机调用 verifyOrder() 时出现与 RAM 相关的错误
【发布时间】:2017-05-25 19:05:20
【问题描述】:

我正在尝试按照此处的说明使用 Softlayer python API 订购裸机服务器:http://sldn.softlayer.com/blog/bpotter/ordering-bare-metal-servers-using-softlayer-api 并利用提供的示例代码 (https://gist.github.com/bmpotter/27913e92e9ff7b6b0c54)。但是,在执行 orderVerify() 时,我不断收到此异常:

SoftLayer_Exception_Public:64 GB RAM (#154399) 的价格对位置 dal10 无效。

这是我用于 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')},
]

以及订单信息:

{'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}

我检查了 RAM_64_GB_DDR3_1333_REG_2 在 getOrderItemsDict() 的输出中。有什么想法吗?

【问题讨论】:

    标签: ibm-cloud-infrastructure


    【解决方案1】:

    价格有错误:154399,对达拉斯10数据中心(1441195)无效,要了解更多信息,您可以查看以下链接:

    Location-based Pricing and You

    您可以尝试更改此价格 49427(这是适用于任何数据中心的标准价格)而不是订单中的 154399,用于 RAM_64_GB_DDR3_1333_REG_2


    检索包含特定项目的包裹(价格和位置)

    """
    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)))
    

    设置 VLAN

    "hardware": [  
       {  
          "hostname":"testhost",
          "domain":"softlayer.com",
          "primaryBackendNetworkComponent":{  
             "networkVlanId":971077
          },
          "primaryNetworkComponent":{  
             "networkVlanId":971075
          }
       }
    ]
    

    【讨论】:

    • 谢谢。这就说得通了。根据我使用的示例代码中的注释,它应该返回正确的项目 ID:
    • 虽然我仍然想知道的是,我查看了列表,只找到了以下 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。如果只需要 16 GB 的 RAM,应该使用什么选项?
    • 这种服务器的最小选项是 64 GB RAM,如果您想订购具有 16 GB RAM 的服务器,您需要选择另一个包
    • 谢谢你的作品。所以对我来说下一个障碍是确保所有新服务器都在同一个 Vlan 中。我环顾四周并从这篇文章中注意到:stackoverflow.com/questions/44146080/… 使用 https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Order/getVlans 来获取 Vlan。但是,我尝试使用 Chrome 海报 REST 客户端并始终得到 {"privateVlans":[],"publicVlans":[]} 和 200 返回码,尝试了不同的包/位置相同的结果。有什么想法吗?
    • 表示您在该数据中心没有购买任何vlan,但这不是问题,如果您那里没有任何vlan,SoftLayer 将免费提供一个。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-06
    • 1970-01-01
    相关资源
    最近更新 更多