Просмотр исходного кода

Use region_name (not zone_name) for Azure disk location

AzureVolumeService.create was passing provider.zone_name as the disk's
'location' field. Azure ARM disks treat 'location' as a region; an
availability zone goes in a separate 'zones' field. As long as
azure_zone_name happens to be set to the same value as the region in
config, the bug is invisible. But anything that lets the two diverge
(env-var propagation glitch through a subprocess, an unset
azure_zone_name falling back to region.default_zone.name resolving
differently, etc.) creates a disk in a different region than the
parent VM, manifesting as cross-region attach failures that are hard
to reproduce.

Everything else in azure/services.py uses provider.region_name for the
location field, including NIC creation in this same module. Volume
creation should match.
Nuwan Goonasekera 1 день назад
Родитель
Сommit
11ac90e3dc
1 измененных файлов с 2 добавлено и 3 удалено
  1. 2 3
      cloudbridge/providers/azure/services.py

+ 2 - 3
cloudbridge/providers/azure/services.py

@@ -388,7 +388,6 @@ class AzureVolumeService(BaseVolumeService):
         disk_name = AzureVolume._generate_name_from_label(label, "cb-vol")
         tags = {'Label': label}
 
-        zone_name = self.provider.zone_name
         snapshot = (self.provider.storage.snapshots.get(snapshot)
                     if snapshot and isinstance(snapshot, str) else snapshot)
 
@@ -397,7 +396,7 @@ class AzureVolumeService(BaseVolumeService):
 
         if snapshot:
             params = {
-                'location': zone_name,
+                'location': self.provider.region_name,
                 'creation_data': CreationData(
                     create_option=DiskCreateOption.copy,
                     source_uri=snapshot.resource_id,
@@ -410,7 +409,7 @@ class AzureVolumeService(BaseVolumeService):
 
         else:
             params = {
-                'location': zone_name,
+                'location': self.provider.region_name,
                 'disk_size_gb': size,
                 'creation_data': CreationData(
                     create_option=DiskCreateOption.empty,