|
|
@@ -23,7 +23,8 @@ from cloudbridge.interfaces.resources import (Instance, MachineImageState,
|
|
|
|
|
|
from azure.common import AzureException
|
|
|
from azure.core.exceptions import ResourceNotFoundError
|
|
|
-from azure.mgmt.compute.models import SubResource as ComputeSubResource
|
|
|
+from azure.mgmt.compute.models import (DataDisk, ManagedDiskParameters,
|
|
|
+ SubResource as ComputeSubResource)
|
|
|
from azure.mgmt.devtestlabs.models import GalleryImageReference
|
|
|
from azure.mgmt.network.models import NetworkSecurityGroup
|
|
|
|
|
|
@@ -428,14 +429,12 @@ class AzureVolume(BaseVolume):
|
|
|
Instance) else instance
|
|
|
vm = self._provider.azure_client.get_vm(instance_id)
|
|
|
|
|
|
- vm.storage_profile.data_disks.append({
|
|
|
- 'lun': len(vm.storage_profile.data_disks),
|
|
|
- 'name': self._volume.name,
|
|
|
- 'create_option': 'attach',
|
|
|
- 'managed_disk': {
|
|
|
- 'id': self.resource_id
|
|
|
- }
|
|
|
- })
|
|
|
+ vm.storage_profile.data_disks.append(DataDisk(
|
|
|
+ lun=len(vm.storage_profile.data_disks),
|
|
|
+ name=self._volume.name,
|
|
|
+ create_option='attach',
|
|
|
+ managed_disk=ManagedDiskParameters(id=self.resource_id)
|
|
|
+ ))
|
|
|
self._provider.azure_client.update_vm(instance_id, vm)
|
|
|
|
|
|
def detach(self, force=False):
|