You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过SoftLayer API判断运行中的VSI是否配备vGPU?

识别vGPU虚拟客户机的ObjectMask配置

要判断你的VSI是否配备vGPU,你需要在现有的objectMask中添加GPU组件相关的字段——这是最直接准确的方式。

需要添加的Mask字段

你需要在当前的mask里追加以下内容:

,gpuComponents[id, name, manufacturer, model, memoryCapacity, isGpuPartition]

更新后的完整Mask

把上面的内容加入你原有的mask后,最终的mask参数会是:

mask[datacenter,status,globalIdentifier,primaryIpAddress,primaryBackendIpAddress,billingItem.categoryCode,billingItem.description,billingItem.createDate,billingItem.orderItem.order.userRecord.username,billingItem.orderItem.order.userRecord.email,users.username,users.email,users.userStatus,operatingSystemReferenceCode,softwareComponents.passwords,operatingSystem,hourlyBillingFlag,localDiskFlag,managedResourceFlag,privateNetworkOnlyFlag,powerState,blockDeviceTemplateGroup.name,blockDeviceTemplateGroup.id,blockDeviceTemplateGroup.blockDevices,blockDevices.diskImage,networkVlans,activeTransactionCount,activeTransactions,consoleIpAddressRecord.type,consoleIpAddressRecord.port,consoleIpAddressRecord.ipAddress.ipAddress,userDataCount,userData,gpuComponents[id, name, manufacturer, model, memoryCapacity, isGpuPartition]]

如何判断结果

调用API后,你可以通过以下方式判断:

  • 如果返回的gpuComponents数组不为空,说明该VSI是vGPU实例;
  • 你还能从gpuComponents的字段里获取详细信息:比如model查看GPU型号,memoryCapacity查看显存大小,isGpuPartition判断是否为GPU分区类型的实例。

另外,也可以辅助检查billingItem.categoryCode是否为gpu,但这个方式不如直接查看gpuComponents可靠,因为部分特殊场景下可能存在偏差。

内容的提问来源于stack exchange,提问作者Gary Sutherland

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 07:27:56