问题描述
我在 Create Disk 之后创建了一个共享磁盘,当我尝试将它附加到 VM Update VM 时,我发现 createOption 无法更改。以下是完整的错误,
disk attachment Failed,request response is - {
"error": {
"code": "PropertyChangeNotAllowed","message": "Changing property 'datadisk.createOption' is not allowed.","target": "datadisk.createOption"
}
创建数据磁盘的请求正文(请注意这是一个共享磁盘),
{
"location": LOCATION,"sku": {
"name": "Premium_lrs"
},"properties": {
"creationData": {
"createOption": "empty"
},"osType": "linux","diskSizeGB": SIZE,"maxShares": 5,"networkAccesspolicy": "AllowAll"
}
}
VM 补丁请求的请求正文,
{
"properties": {
"storageProfile": {
"datadisks": [
{
"caching" : "ReadOnly","createOption": "Attach","lun": 0,"manageddisk" : {
"id": disk_id,//-> this disk_id is id of the created disk above
"storageAccountType": "Premium_lrs"
}
}
]
}
}
}
有人可以指出我哪里做错了。我没有找到太多关于共享磁盘附件的文档,通过 API。
解决方法
如我所见,更新 VM 的请求正文没有问题。我现在就试过了,效果很好。我使用与您相同的请求正文。因此您需要再次检查磁盘,例如 lun
0 是否已在使用中。