def delete_cache_tier(): backer_pool = action_get("backer-pool") cache_pool = action_get("cache-pool") # Pre flight checks if not pool_exists('admin', backer_pool): log("Backer pool {} must exist before calling this".format( backer_pool)) action_fail("remove-cache-tier failed. Backer pool {} must exist " "before calling this".format(backer_pool)) if not pool_exists('admin', cache_pool): log("Cache pool {} must exist before calling this".format( cache_pool)) action_fail("remove-cache-tier failed. Cache pool {} must exist " "before calling this".format(cache_pool)) pool = Pool(service='admin', name=backer_pool) try: pool.remove_cache_tier(cache_pool=cache_pool) except CalledProcessError as err: log("Removing the cache tier failed with message: {}".format( err.message)) action_fail("remove-cache-tier failed. Removing the cache tier failed " "with message: {}".format(err.message))
def handle_remove_cache_tier(request, service): storage_pool = request.get('cold-pool') cache_pool = request.get('hot-pool') # cache and storage pool must exist first if not pool_exists(service=service, name=storage_pool) or not pool_exists( service=service, name=cache_pool): msg = ("cold-pool: {} or hot-pool: {} doesn't exist. Not " "deleting cache tier".format(storage_pool, cache_pool)) log(msg, level=ERROR) return {'exit-code': 1, 'stderr': msg} pool = Pool(name=storage_pool, service=service) pool.remove_cache_tier(cache_pool=cache_pool)
def handle_remove_cache_tier(request, service): """Remove a cache tier from the cold pool. :param request: dict of request operations and params :param service: The ceph client to run the command under. :returns: dict. exit-code and reason if not 0 """ storage_pool = request.get('cold-pool') cache_pool = request.get('hot-pool') # cache and storage pool must exist first if not pool_exists(service=service, name=storage_pool) or not pool_exists( service=service, name=cache_pool): msg = ("cold-pool: {} or hot-pool: {} doesn't exist. Not " "deleting cache tier".format(storage_pool, cache_pool)) log(msg, level=ERROR) return {'exit-code': 1, 'stderr': msg} pool = Pool(name=storage_pool, service=service) pool.remove_cache_tier(cache_pool=cache_pool)
def delete_cache_tier(): backer_pool = action_get("backer-pool") cache_pool = action_get("cache-pool") # Pre flight checks if not pool_exists('admin', backer_pool): log("Backer pool {} must exist before calling this".format( backer_pool)) action_fail("remove-cache-tier failed. Backer pool {} must exist " "before calling this".format(backer_pool)) if not pool_exists('admin', cache_pool): log("Cache pool {} must exist before calling this".format(cache_pool)) action_fail("remove-cache-tier failed. Cache pool {} must exist " "before calling this".format(cache_pool)) pool = Pool(service='admin', name=backer_pool) try: pool.remove_cache_tier(cache_pool=cache_pool) except CalledProcessError as err: log("Removing the cache tier failed with message: {}".format(str(err))) action_fail("remove-cache-tier failed. Removing the cache tier failed " "with message: {}".format(str(err)))