Merge "Remove central backup path when subcloud deleted"
This commit is contained in:
commit
94dccf19bb
|
@ -24,6 +24,7 @@ import json
|
||||||
import keyring
|
import keyring
|
||||||
import netaddr
|
import netaddr
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -1625,9 +1626,21 @@ class SubcloudManager(manager.Manager):
|
||||||
# Delete the subcloud intermediate certificate
|
# Delete the subcloud intermediate certificate
|
||||||
SubcloudManager._delete_subcloud_cert(subcloud.name)
|
SubcloudManager._delete_subcloud_cert(subcloud.name)
|
||||||
|
|
||||||
|
# Delete the subcloud backup path
|
||||||
|
self._delete_subcloud_backup_data(subcloud.name)
|
||||||
|
|
||||||
# Regenerate the addn_hosts_dc file
|
# Regenerate the addn_hosts_dc file
|
||||||
self._create_addn_hosts_dc(context)
|
self._create_addn_hosts_dc(context)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _delete_subcloud_backup_data(subcloud_name):
|
||||||
|
try:
|
||||||
|
backup_path = os.path.join(CENTRAL_BACKUP_DIR, subcloud_name)
|
||||||
|
if os.path.exists(backup_path):
|
||||||
|
shutil.rmtree(backup_path)
|
||||||
|
except Exception as e:
|
||||||
|
LOG.exception(e)
|
||||||
|
|
||||||
def delete_subcloud(self, context, subcloud_id):
|
def delete_subcloud(self, context, subcloud_id):
|
||||||
"""Delete subcloud and notify orchestrators.
|
"""Delete subcloud and notify orchestrators.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue