Ver código fonte

Merge pull request #245 from nuwang/os_delete_robustness

Increase robustness of openstack port delete
Nuwan Goonasekera 5 anos atrás
pai
commit
24a13a0af6
3 arquivos alterados com 16 adições e 12 exclusões
  1. 10 10
      README.rst
  2. 5 1
      cloudbridge/providers/openstack/services.py
  3. 1 1
      tests/helpers/__init__.py

+ 10 - 10
README.rst

@@ -22,20 +22,20 @@ Build Status Tests
    :target: http://cloudbridge.readthedocs.org/en/latest/?badge=latest
    :alt: Documentation Status
 
-.. |aws-py36| image:: https://travis-matrix-badges.herokuapp.com/repos/CloudVE/cloudbridge/branches/master/1
-              :target: https://travis-ci.org/CloudVE/cloudbridge
+.. |aws-py36| image:: https://travis-matrix-badges.herokuapp.com/repos/CloudVE/cloudbridge/branches/master/1?use_travis_com=yes
+              :target: https://travis-ci.com/CloudVE/cloudbridge
 
-.. |azure-py36| image:: https://travis-matrix-badges.herokuapp.com/repos/CloudVE/cloudbridge/branches/master/2
-                :target: https://travis-ci.org/CloudVE/cloudbridge
+.. |azure-py36| image:: https://travis-matrix-badges.herokuapp.com/repos/CloudVE/cloudbridge/branches/master/2?use_travis_com=yes
+                :target: https://travis-ci.com/CloudVE/cloudbridge
 
-.. |gcp-py36| image:: https://travis-matrix-badges.herokuapp.com/repos/CloudVE/cloudbridge/branches/master/3
-              :target: https://travis-ci.org/CloudVE/cloudbridge
+.. |gcp-py36| image:: https://travis-matrix-badges.herokuapp.com/repos/CloudVE/cloudbridge/branches/master/3?use_travis_com=yes
+              :target: https://travis-ci.com/CloudVE/cloudbridge
 
-.. |mock-py36| image:: https://travis-matrix-badges.herokuapp.com/repos/CloudVE/cloudbridge/branches/master/4
-              :target: https://travis-ci.org/CloudVE/cloudbridge
+.. |mock-py36| image:: https://travis-matrix-badges.herokuapp.com/repos/CloudVE/cloudbridge/branches/master/4?use_travis_com=yes
+              :target: https://travis-ci.com/CloudVE/cloudbridge
 
-.. |os-py36| image:: https://travis-matrix-badges.herokuapp.com/repos/CloudVE/cloudbridge/branches/master/5
-             :target: https://travis-ci.org/CloudVE/cloudbridge
+.. |os-py36| image:: https://travis-matrix-badges.herokuapp.com/repos/CloudVE/cloudbridge/branches/master/5?use_travis_com=yes
+             :target: https://travis-ci.com/CloudVE/cloudbridge
 
 +---------------------------+----------------+
 | **Provider/Environment**  | **Python 3.6** |

+ 5 - 1
cloudbridge/providers/openstack/services.py

@@ -934,7 +934,11 @@ class OpenStackInstanceService(BaseInstanceService):
             # Assumption: it's the first interface in the list
             iface_list = os_instance.interface_list()
             if iface_list:
-                self.provider.neutron.delete_port(iface_list[0].port_id)
+                with cb_helpers.cleanup_action(
+                        lambda: self.provider.neutron.delete_port(
+                            iface_list[0].port_id)):
+                    # Ignore errors if port can't be deleted
+                    pass
             os_instance.delete()
 
 

+ 1 - 1
tests/helpers/__init__.py

@@ -96,7 +96,7 @@ TEST_DATA_CONFIG = {
         'image': cb_helpers.get_env(
             'CB_IMAGE_GCP',
             'https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/'
-            'global/images/ubuntu-1710-artful-v20180126'),
+            'global/images/ubuntu-1804-bionic-v20200908'),
         'vm_type': cb_helpers.get_env('CB_VM_TYPE_GCP', 'f1-micro'),
         'placement': cb_helpers.get_env('GCP_ZONE_NAME', 'us-central1-a'),
         "placement_cfg_key": "gcp_zone_name"