使用Softlayer API获取子网容量 [英] Get subnet capacity with Softlayer APIs

查看:44
本文介绍了使用Softlayer API获取子网容量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们想找出一个子网中已经有多少个VM,以及剩余容量是多少.我们应该使用哪些Softlayer API来实现这一目标?

We would like to find out how many VMs are already in a subnet, and what the leftover capacity is. What Softlayer APIs shall we use to achieve this?

推荐答案

尝试以下休息请求:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Network_Subnet/$SubnetID/getIpAddresses?objectMask=mask[ id, isBroadcast, isGateway, isNetwork,  isReserved, subnetId,  hardware, virtualGuest, guestNetworkComponentBinding, ipAddress, note, publicNetworkGateway,privateNetworkGateway, virtualLicenseCount, applicationDeliveryController]

确定,上面的请求会将您的所有IP及其配置返回给硬件(裸机服务器)或虚拟访客.现在,您需要查看的第一件事是属性的值:

Ok lets see, the request above will return all your ip and their assigments to hardware (bare metal server) or virtual guest. Now the first thing you need to look is the value of the properties:

isBroadcast isGateway isNetwork isReserved

isBroadcast isGateway isNetwork isReserved

如果这些值中的任何一个为true,则IP被保留,它们还将帮助您了解IP的类型(例如网关等)

If any of those values is true so the IP is reserved and also they are going to help you to know what kind the IP is (e.g. gateway etc.)

然后,如果此属性与null不同,则需要查找"guestNetworkComponentBinding",因此该IP正在使用(在控制门户中,您将在此IP主IP"的描述中看到).

Then you need to look the "guestNetworkComponentBinding" if this property is differnt of null so the IP is in use (in the control portal you will see in the description of this IP "Primary IP").

然后,如果此值与空值(用于Baremetal服务器的IP)不同,则需要查看硬件"属性.硬件"属性将为您提供有关服务器的更多信息.

Then you need to look at the "hardware" property if this value is differnt from null the IP is being used for a Baremetal server the "hardware" property will give you more information about the server.

然后,您需要查看"virtualGuest"属性,该属性与"hardware"属性相同,但适用于虚拟访客.

Then you need to look at the "virtualGuest" property this is the same as the "hardware" property but applied for virtual guests.

然后,您需要查看用于netscalers的"applicationDeliveryController"属性,如果此属性不为null,则再次将IP用于设备.

then you need to look at "applicationDeliveryController" property this is used for netscalers, again if this property is not null the IP is being used for a device.

对于上述所有值均为空的情况,不应使用IP(在控制门户中,我看到的描述是为将来的主IP地址保留的)

For the cases that all the values above are null the IP should not be in use (in control portal I saw as description reserved for future Primary IP address)

在我能看到的情况下,如果您仍然遇到问题,请告诉我

Well those are the cases that I was able to see, if you still getting issues let me know

致谢

这篇关于使用Softlayer API获取子网容量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆