有关虚拟机的API [英] API regarding virtual machines

查看:177
本文介绍了有关虚拟机的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Azure Stack API有几个问题。


1。当我通过API获取虚拟机时,似乎我得到两个假人回来了?我在我的系统中找不到这些机器,名称和属性看起来像虚拟值?


  &NBSP; " id":" / subscriptions /< sub_id> /providers/Microsoft.Compute.Admin/tenantVirtualMachines/subscriptions/sub2/resourceGroups/myRG/virtualMachines/Bar" ;,

  &NBSP; " name" ;:" Bar",
  &NBSP; "type":"Microsoft.Compute.Admin / tenantVirtualMachines","
  &NBSP; "location":null,

  &NBSP; "properties":{

  &NBSP; &NBSP; " name" ;:" Bar",
  &NBSP; &NBSP; " subscriptionId":" sub2",&
  &NBSP; &NBSP; "resourceGroup":" myRG",$
  &NBSP; &NBSP; "provisioningState":"failed","
  &NBSP; &NBSP; "powerState":"on","
  &NBSP; &NBSP; "hyperVState":"on","
  &NBSP; &NBSP; "错误":"错误消息","
  &NBSP; &NBSP; " platformImage":" platformImageURI",$
  &NBSP; &NBSP; "faultDomain":" 1",
  &NBSP; &NBSP; " availabilitySet":" Yes",
  &NBSP; &NBSP; " vmSize":" Standard_A1",&
  &NBSP; &NBSP; "cluster":"ClusterURI","
  &NBSP; &NBSP; "host":" HostURI",
  &NBSP; &NBSP; " tenantResourceURI":" TenantResourceURI"

  &NBSP; }


2。 API中的每个范围都有许多不同的版本。根范围是否在发布中有一个版本?否则,将会有很多工作要跟上所有范围版本。



3。如果尚未计算指标,则通过API获取指标会返回错误。也就是说,我必须获取计算公制范围范围内的一段时间,这对我来说是未知的。所以这是一个猜谜游戏。有时候24小时后退
就足够了,但突然间我必须回去整整2天才能开始工作。如果我只能指定结束日期可能在将来的开始日期和结束日期,但返回的数据将是当前时间戳,或者至少还有
计算指标,那将是一件好事。如果它在24小时后甚至无法获得,那么几乎不可能获得最新的指标?我真的希望这会改变。


/ Magnus

解决方案

Hey Magnus,


对于#1,最好了解您正在努力的方案 - 您当前尝试使用的API是此时正在从产品中删除的Admin API。列出Azure Stack订阅的虚拟机可以在PowerShell中完成
作为REST的简单替代方案(如果您的用例可接受)。在安装,配置和验证PowerShell for AzureStack之后,只需使用Get-AzureRMVM。 


对于#2,我们引入了一个概念来帮助API版本化,称为API版本配置文件。今天,您可以将此作为使用PowerShell和Azure Stack的一部分。请参阅此处:https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-version-profiles


对于#3,您能澄清哪一个您正在使用的特定指标API,并提供您要发送的请求的示例?


谢谢,


Matt







I've got a few questions regarding the Azure Stack API.

1. When I fetch virtual machines through the API it seems that I get two dummies back in response? I can't find these machines in my system and the names and attributes looks like dummy values?

    "id": "/subscriptions/<sub_id>/providers/Microsoft.Compute.Admin/tenantVirtualMachines/subscriptions/sub2/resourceGroups/myRG/virtualMachines/Bar",
    "name": "Bar",
    "type": "Microsoft.Compute.Admin/tenantVirtualMachines",
    "location": null,
    "properties": {
      "name": "Bar",
      "subscriptionId": "sub2",
      "resourceGroup": "myRG",
      "provisioningState": "failed",
      "powerState": "on",
      "hyperVState": "on",
      "error": "error message",
      "platformImage": "platformImageURI",
      "faultDomain": "1",
      "availabilitySet": "Yes",
      "vmSize": "Standard_A1",
      "cluster": "ClusterURI",
      "host": "HostURI",
      "tenantResourceURI": "TenantResourceURI"
    }

2. Each scope in the API has a lot of different versions. Will the root scope have one version in the release? Otherwise there will be a lot of work to keep up with all scope versions.

3. Fetching metrics through the API returns error if the metrics has not yet been calculated. That is, I have to fetch for a period that are in the scope of the calculated metric range, which is to me unknown. So it's a guessing game. Sometimes 24h back in time will be enough, but suddenly I have to go back whole 2 days for it to work. It would be good if I could just specify start and end date where end date could be in the future but the returned data will be to current timestamp or as far as it has yet calculated the metrics. And it seems nearly impossible to get very up-to-date metrics if it's not even available after 24h? I really hope this changes.

/Magnus

解决方案

Hey Magnus,

For #1, it would be good to understand the scenario you are working towards here - the API you are currently attempting to use is an Admin API that is being removed from the product at this time. Listing virtual machines for an Azure Stack subscription can be accomplished in PowerShell as a simpler alternative to REST if that is acceptable for your use case. Just use Get-AzureRMVM after installing, configuring, and authenticating PowerShell for AzureStack. 

For #2, we are introducing a concept to help with API versioning, called API version profiles. You can make use of this today as part of using PowerShell with Azure Stack. See here: https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-version-profiles

For #3 can you clarify which specific metrics API you are using and provide an example of a request you are sending?

Thanks,

Matt


这篇关于有关虚拟机的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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