Browse Source

NSX|P: Fix devstack cleanup to use the default domain

The policy plugin do not use per-tenant domain any more, so
it should delete objects from the default domain instead.

Change-Id: Ia93d9e1c888105305db880e8166c98a3d2fcad9f
changes/36/680936/1
Adit Sarfaty 1 week ago
parent
commit
e83c7fdd88
1 changed files with 5 additions and 20 deletions
  1. 5
    20
      devstack/tools/nsxp_cleanup.py

+ 5
- 20
devstack/tools/nsxp_cleanup.py View File

@@ -28,6 +28,7 @@ from vmware_nsxlib.v3 import config
28 28
 from vmware_nsxlib.v3 import exceptions
29 29
 from vmware_nsxlib.v3 import nsx_constants
30 30
 from vmware_nsxlib.v3 import policy
31
+from vmware_nsxlib.v3.policy import constants as policy_constants
31 32
 
32 33
 
33 34
 class NeutronNsxDB(object):
@@ -92,18 +93,6 @@ class NSXClient(object):
92 93
         else:
93 94
             self.NsxLib = None
94 95
 
95
-    def get_nsx_os_domains(self):
96
-        domains = self.get_os_resources(self.nsxpolicy.domain.list())
97
-        return [d['id'] for d in domains]
98
-
99
-    def cleanup_domains(self, domains):
100
-        """Delete all OS created NSX Policy segments ports per segment"""
101
-        for domain_id in domains:
102
-            try:
103
-                self.nsxpolicy.domain.delete(domain_id)
104
-            except exceptions.ManagerError as e:
105
-                print("Failed to delete domain %s: %s" % (domain_id, e))
106
-
107 96
     def get_os_resources(self, resources):
108 97
         """
109 98
         Get all logical resources created by OpenStack
@@ -363,7 +352,7 @@ class NSXClient(object):
363 352
             try:
364 353
                 self.nsxpolicy.service.delete(srv['id'])
365 354
             except exceptions.ManagerError as e:
366
-                print("Failed to delete service %s: %s" % (srv['id'], e))
355
+                print("Failed to delete rule service %s: %s" % (srv['id'], e))
367 356
 
368 357
     def _cleanup_lb_resource(self, service, service_name):
369 358
         r_list = self.get_os_resources(service.list())
@@ -432,19 +421,15 @@ class NSXClient(object):
432 421
         Global cleanup steps:
433 422
             - Tier1 routers
434 423
             - Segments and ports
424
+            - rules and services
435 425
         """
436
-        domains = self.get_nsx_os_domains()
437
-        for domain_id in domains:
438
-            print("Cleaning up openstack resources from domain %s" % domain_id)
439
-            self.cleanup_security_groups(domain_id)
440
-
441
-        print("Cleaning up openstack global resources")
426
+        print("Cleaning up openstack resources")
427
+        self.cleanup_security_groups(policy_constants.DEFAULT_DOMAIN)
442 428
         self.cleanup_segments()
443 429
         self.cleanup_load_balancers()
444 430
         self.cleanup_nsx_logical_dhcp_servers()
445 431
         self.cleanup_tier1_routers()
446 432
         self.cleanup_rules_services()
447
-        self.cleanup_domains(domains)
448 433
 
449 434
 
450 435
 if __name__ == "__main__":

Loading…
Cancel
Save