From 67494c05674a4d26471c215d5ec824446e1c0597 Mon Sep 17 00:00:00 2001 From: dcvan Date: Fri, 30 Nov 2018 17:12:30 -0500 Subject: [PATCH] replaced "erase/erasure" with "purge" for clarity --- appliance/handler.py | 10 +++++----- appliance/manager.py | 10 +++++----- volume/handler.py | 2 +- volume/manager.py | 24 ++++++++++++------------ 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/appliance/handler.py b/appliance/handler.py index c524602..5f00690 100644 --- a/appliance/handler.py +++ b/appliance/handler.py @@ -114,12 +114,12 @@ async def delete(self, app_id): application/json: schema: Error """ - erase_data = self.get_query_argument('erase_data', False) - if not isinstance(erase_data, bool) and erase_data.lower() not in ('true', 'false'): + purge_data = self.get_query_argument('purge', False) + if not isinstance(purge_data, bool) and purge_data.lower() not in ('true', 'false'): self.set_status(400) - self.write(error(400, "Unrecognized 'erase_data' value: %s"%erase_data)) + self.write(error(400, "Unrecognized 'purge_data' value: %s"%purge_data)) return - erase_data = erase_data and erase_data.lower() == 'true' - status, msg, err = await self.__app_mgr.delete_appliance(app_id, erase_data=erase_data) + purge_data = purge_data and purge_data.lower() == 'true' + status, msg, err = await self.__app_mgr.delete_appliance(app_id, purge_data=purge_data) self.set_status(status) self.write(json.dumps(message(msg) if status == 200 else error(err))) diff --git a/appliance/manager.py b/appliance/manager.py index 5c791d4..2c4b8eb 100644 --- a/appliance/manager.py +++ b/appliance/manager.py @@ -114,9 +114,9 @@ def set_container_volume_scope(contrs, vols): ApplianceScheduleExecutor(app.id, scheduler).start() return 201, app, None - async def delete_appliance(self, app_id, erase_data=False): + async def delete_appliance(self, app_id, purge_data=False): vol_mgr = self.__vol_mgr - self.logger.info('Erase data?: %s'%erase_data) + self.logger.debug('Purge data?: %s' % purge_data) status, app, err = await self.get_appliance(app_id) if status != 200: self.logger.error(err) @@ -133,8 +133,8 @@ async def delete_appliance(self, app_id, erase_data=False): # deprovision/delete local persistent volumes if any if app.data_persistence: _, local_vols, _ = await vol_mgr.get_local_volumes(appliance=app_id) - resps = await multi([(vol_mgr.erase_local_volume(app_id, v.id) - if erase_data else vol_mgr.deprovision_volume(v)) + resps = await multi([(vol_mgr.purge_local_volume(app_id, v.id) + if purge_data else vol_mgr.deprovision_volume(v)) for v in local_vols]) for i, (status, _, err) in enumerate(resps): if status != 200: @@ -152,7 +152,7 @@ async def delete_appliance(self, app_id, erase_data=False): if status != 200 and status != 404: self.logger.error(err) return 207, None, "Failed to deprovision appliance '%s'"%app_id - if erase_data: + if purge_data: await self.__app_db.delete_appliance(app_id) ApplianceDeletionChecker(app_id).start() return status, msg, None diff --git a/volume/handler.py b/volume/handler.py index f53d812..19cb504 100644 --- a/volume/handler.py +++ b/volume/handler.py @@ -110,7 +110,7 @@ async def delete(self, app_id, vol_id): schema: Error """ - status, msg, err = await self.__vol_mgr.erase_local_volume(app_id, vol_id) + status, msg, err = await self.__vol_mgr.purge_local_volume(app_id, vol_id) self.set_status(status) self.write(json_encode(message(msg) if status == 200 else error(err))) diff --git a/volume/manager.py b/volume/manager.py index 25de044..3a13eaa 100644 --- a/volume/manager.py +++ b/volume/manager.py @@ -83,20 +83,20 @@ async def deprovision_volume(self, vol): await self.__vol_db.save_volume(vol) return status, "Persistent volume '%s' has been deprovisioned"%vol.id, None - async def erase_global_volume(self, vol_id): + async def purge_global_volume(self, vol_id): status, vol, err = await self.get_global_volume(vol_id) if status != 200: return status, None, err if len(vol.used_by) > 0: return 400, None, "Global persistent volume '%s' is in use by appliance(s): " \ "%s"%(vol_id, vol.used_by) - status, msg, err = await self.__vol_api.delete_global_volume(vol_id, erasure=True) + status, msg, err = await self.__vol_api.delete_global_volume(vol_id, purge=True) if status != 200: return status, None, err await self.__vol_db.delete_volume(vol) - return status, "Persistent volume '%s' has been erased" % vol, None + return status, "Persistent volume '%s' has been purged" % vol, None - async def erase_local_volume(self, app_id, vol_id): + async def purge_local_volume(self, app_id, vol_id): status, vol, err = await self.get_local_volume(app_id, vol_id, full_blown=True) if status != 200: return status, None, err @@ -105,11 +105,11 @@ async def erase_local_volume(self, app_id, vol_id): if len(in_use) > 0: return 400, None, "Local persistent volume '%s' is in use by container(s): " \ "%s"%(vol_id, list(in_use)) - status, msg, err = await self.__vol_api.delete_local_volume(app_id, vol_id, erasure=True) + status, msg, err = await self.__vol_api.delete_local_volume(app_id, vol_id, purge=True) if status != 200: return status, None, err await self.__vol_db.delete_volume(vol) - return status, "Persistent volume '%s' has been erased"%vol, None + return status, "Persistent volume '%s' has been purged"%vol, None async def get_global_volume(self, vol_id): status, vol, err = await self._get_volume(self.__vol_db.get_global_volume, @@ -187,11 +187,11 @@ async def create_volume(self, vol): api = config.ceph return await self.http_cli.post(api.host, api.port, '/fs', dict(vol.to_request())) - async def delete_global_volume(self, vol_id, erasure=False): - return await self._delete_volume(str(vol_id), erasure) + async def delete_global_volume(self, vol_id, purge=False): + return await self._delete_volume(str(vol_id), purge) - async def delete_local_volume(self, app_id, vol_id, erasure=False): - return await self._delete_volume('%s-%s'%(app_id, vol_id), erasure) + async def delete_local_volume(self, app_id, vol_id, purge=False): + return await self._delete_volume('%s-%s' % (app_id, vol_id), purge) async def _get_volume(self, ext_vol_id): api = config.ceph @@ -200,9 +200,9 @@ async def _get_volume(self, ext_vol_id): return status, None, err return status, vol, None - async def _delete_volume(self, ext_vol_id, erasure=False): + async def _delete_volume(self, ext_vol_id, purge=False): api = config.ceph - return await self.http_cli.delete(api.host, api.port, '/fs/%s?erasure=%s'%(ext_vol_id, erasure)) + return await self.http_cli.delete(api.host, api.port, '/fs/%s?purge=%s' % (ext_vol_id, purge)) class VolumeDBManager(Manager):