首页 文章

Softlayer API硬件:为裸机调用verifyOrder()时出现与RAM相关的错误

提问于
浏览
1

我正在尝试使用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()的输出中 . 有任何想法吗?

1 回答

  • 0

    价格有误:154399,对Dallas 10数据中心(1441195)无效,要获得更多信息,请查看以下链接:

    Location-based Pricing and You

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


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

    """
    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
          }
       }
    ]
    

相关问题