almahmoud 7 лет назад
Родитель
Сommit
f32230afc2
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      cloudbridge/cloud/providers/azure/resources.py

+ 3 - 2
cloudbridge/cloud/providers/azure/resources.py

@@ -1316,12 +1316,13 @@ class AzureInstance(BaseInstance):
         the instance and also removing OS disk and data disks where
         tag with name 'delete_on_terminate' has value True.
         """
+        # Remove IPs first to avoid a network interface conflict
+        for public_ip_id in self._public_ip_ids:
+            self.remove_floating_ip(public_ip_id)
         self._provider.azure_client.deallocate_vm(self.id)
         self._provider.azure_client.delete_vm(self.id)
         for nic_id in self._nic_ids:
             self._provider.azure_client.delete_nic(nic_id)
-        for public_ip_id in self._public_ip_ids:
-            self._provider.azure_client.delete_floating_ip(public_ip_id)
         for data_disk in self._vm.storage_profile.data_disks:
             if data_disk.managed_disk:
                 if self._vm.tags.get('delete_on_terminate',