无法将数据磁盘附加到 Azure VM

问题描述

我在 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

解决方法

如我所见,更新 V​​M 的请求正文没有问题。我现在就试过了,效果很好。我使用与您相同的请求正文。因此您需要再次检查磁盘,例如 lun 0 是否已在使用中。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...