【发布时间】:2018-12-10 16:20:25
【问题描述】:
我正在尝试创建一个基于我的自定义映像的虚拟机池。我已成功created a custom image 并将其添加到我的批处理帐户中。
但是当我尝试根据来自 azure 门户的这张图片创建一个池时,我收到了一个错误。
在执行最后一次调整大小时遇到错误 水池。请再次尝试调整池大小。代码:分配失败
消息:无法分配所需数量的专用节点
详细信息:原因 - 与关联的源托管磁盘或快照 找不到虚拟机映像 ID。
在门户中创建池时,我使用我的图像名称,因为没有设置图像 ID 的选项。但是json中的图像ID是正确的。我可以在正确的批处理帐户中看到门户中列出的图像。
这是我的池属性 json:
{
"id": "my-pool-0",
"displayName": "my-pool-0",
"lastModified": "2018-12-04T15:54:06.467Z",
"creationTime": "2018-12-04T15:44:18.197Z",
"state": "active",
"stateTransitionTime": "2018-12-04T15:44:18.197Z",
"allocationState": "steady",
"allocationStateTransitionTime": "2018-12-04T16:09:11.667Z",
"vmSize": "standard_a2",
"resizeTimeout": "PT15M",
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0,
"enableAutoScale": false,
"autoScaleFormula": null,
"autoScaleEvaluationInterval": null,
"enableInterNodeCommunication": false,
"maxTasksPerNode": 1,
"url": "https://mybatch.westeurope.batch.azure.com/pools/my-pool-0",
"resizeErrors": [
{
"message": "Desired number of dedicated nodes could not be allocated",
"code": "AllocationFailed",
"values": [
{
"name": "Reason",
"value": "The source managed disk or snapshot associated with the virtual machine Image Id was not found."
}
]
}
],
"virtualMachineConfiguration": {
"imageReference": {
"publisher": null,
"offer": null,
"sku": null,
"version": null,
"virtualMachineImageId": "/subscriptions/79b59716-301e-401a-bb8b-22edg5c1he4j/resourceGroups/resource-group-1/providers/Microsoft.Compute/images/my-image"
},
"nodeAgentSKUId": "batch.node.ubuntu 18.04"
},
"applicationLicenses": null
}
似乎错误文本与实际错误无关。有没有人遇到过这个错误或者现在有办法解决这个问题?
更新
用于创建图像的打包器 json (taken from here)
{
"builders": [{
"type": "azure-arm",
"client_id": "ffxcvbd0-c867-429a-bxcv-8ee0acvb6f99",
"client_secret": "cvb54cvb-202d-4wq-bb8b-22cdfbce4f",
"tenant_id": "ae33sdfd-a54c-40af-b20c-80810f0ff5da",
"subscription_id": "096da34-4604-4bcb-85ae-2afsdf22192b",
"managed_image_resource_group_name": "resource-group-1",
"managed_image_name": "my-image",
"os_type": "Linux",
"image_publisher": "Canonical",
"image_offer": "UbuntuServer",
"image_sku": "18.04-LTS",
"azure_tags": {
"dept": "Engineering",
"task": "Image deployment"
},
"location": "West Europe",
"vm_size": "Standard_DS2_v2"
}],
"provisioners": [{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"inline": [
"export DEBIAN_FRONTEND=noninteractive",
"apt-get update",
"apt-get upgrade -y",
"apt-get -y install nginx",
...
"/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"
],
"inline_shebang": "/bin/sh -x",
"type": "shell"
}]
}
【问题讨论】:
-
您将图像存储在什么格式中,托管磁盘、快照、托管映像还是使用新的共享图像库?
-
@SamCogan 我相信它是一个托管磁盘,我按照文档使用打包程序创建了它。它位于主页 - 图片下。
-
好的,如果它是用 Packer 创建的,它将是一个托管磁盘映像
-
@sr9yar 如果答案有帮助,您可以接受。
-
@CharlesXu np,我也打算对其进行测试,因为我们将在这些日子里转向付费订阅,但我认为你的答案是正确的,因为我没有创建一个VHD,我是直接用packer创建一个图像。
标签: azure azure-virtual-machine