【问题标题】:Softlayer API:how to get all Virtual_Guest config types that we can use with softlayer apisSoftlayer API:如何获取我们可以与 softlayer api 一起使用的所有 Virtual_Guest 配置类型
【发布时间】:2018-06-28 07:28:41
【问题描述】:

当我想升级/降级虚拟访客或创建新的虚拟访客时,我们需要一些配置选项,但我不知道如何获取这些可用配置?

同时,磁盘和网络呢?

【问题讨论】:

    标签: api ibm-cloud-infrastructure nim-lang


    【解决方案1】:

    要创建虚拟访客,控制门户使用多种服务和方法来根据需要识别可能的类型配置,为此,您必须使用受支持的编程语言并以编程方式创建自己的脚本,因为没有特定的 api在一个或两个 api 调用中检索配置类型

    要确定创建计算实例时可用的可能选项,您可以将SoftLayer_Virtual_Guest::getCreateObjectOptions 方法与这些其他方法一起使用。

    创建虚拟机有两种方式:SoftLayer_Virtual_Guest::createObjectSoftLayer_Product_Order::placeOrder,创建vm的链接如下:

    关于获取“primaryNetworkComponent”(公共)和“primaryBackendNetworkComponentyou”(私有)可用的网络vlan添加到vm,您可以使用以下rest api:

    方法:获取

    https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Account/getPrivateNetworkVlans?objectMask=mask[billingItem[location]]
    
    https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Account/getPublicNetworkVlans?objectMask=mask[billingItem[location]]
    

    您必须记住,您要添加到虚拟机的 vlan 必须位于同一个数据中心。

    要获得可用的项目价格,例如 cpu、ram、os、disk 等,请使用这个 rest api:

    方法:获取

    https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/46/getItemPrices?objectMask=mask[pricingLocationGroup[locations]]
    

    这些项目必须位于同一个数据中心。

    Upgrade/Downgrade相关,方法同placeOrder,只是Json主体结构不同,示例见下:

    POST https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Order/placeOrder
    
    body: 
        {
            "parameters": [{
                "virtualGuests": [{
                    "id": 49495232
                }],
                "prices": [{
                        "id": 2277,
                        "categories": [{
                            "categoryCode": "guest_disk1",
                            "complexType": "SoftLayer_Product_Item_Category"
                        }],
                        "complexType": "SoftLayer_Product_Item_Price"
                    },
    
                    {
                        "id": 2270,
                        "categories": [{
                            "categoryCode": "guest_disk2",
                            "complexType": "SoftLayer_Product_Item_Category"
                        }],
                        "complexType": "SoftLayer_Product_Item_Price"
                    }
                ],
                "properties": [
    
                    {
                        "name": "NOTE_GENERAL",
                        "value": "adding disks"
                    },
    
                    {
                        "name": "MAINTENANCE_WINDOW",
                        "value": "2014-08-25T9:50:00-05:00"
                    }
                ],
                "complexType": "SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade"
            }]
        }
    

    How to add two or more disk to softlayer virtual server while provisioning

    查看其他示例:

    New items for SoftLayer virtual server order?

    How to get the proper list of SoftLayer datacenters for a given package?

    Creating a vGPU device with second disk

    【讨论】:

    • 如何在升级虚拟客户机时获取所有配置选项,例如 cpu 内存磁盘等,例如在 IBM 控制台上升级
    • 使用以下 rest api 获取所有配置选项以升级您的虚拟访客: 方法:POST https://[username]:[apiKey]@api.softlayer.com/rest/v3.1 /SoftLayer_Virtual_Guest/[virtualGuestId]/getUpgradeItemPrices Body: Json { "parameters": [ true ] } body 中的“true”数据包含降级项目价格。有关更多信息,请参阅此文档:softlayer.github.io/reference/services/SoftLayer_Virtual_Guest/…
    • 感谢您的帮助,getUpgradeItemPrices api 的响应数据只有 CPU,只有内存。如何知道它们之间是否存在有效的组合,例如控制台中的 c1.1*1 和 c1.2*2
    • 以及创建实例时如何获取选项,因为getCreateObjectOptions的响应不是详细数据,我认为它看起来只有磁盘信息
    • 此方法返回可用于在门户控件中进行升级或降级的所有项目价格,即只有 cpu、ram、磁盘和上行链路端口速度。您可以选择门户控件中的任意项目组合。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多