mirror of https://github.com/ceph/ceph-ansible.git
igw: do not fail purge on rbd removal errors
Instead of failing the entire purge operation when the rbd command fails just log an error. This will allow the higher level target and config cleanup to complete, and the user only has to manually delete the rbd images. Signed-off-by: Mike Christie <mchristi@redhat.com>pull/2954/head
parent
d572a9a602
commit
6f72f96dad
|
@ -55,11 +55,11 @@ def delete_group(module, image_list, cfg):
|
|||
pending_list = list(image_list)
|
||||
|
||||
for rbd_path in image_list:
|
||||
if delete_rbd(module, rbd_path):
|
||||
disk_key = rbd_path.replace('/', '.', 1)
|
||||
cfg.del_item('disks', disk_key)
|
||||
pending_list.remove(rbd_path)
|
||||
cfg.changed = True
|
||||
delete_rbd(module, rbd_path)
|
||||
disk_key = rbd_path.replace('/', '.', 1)
|
||||
cfg.del_item('disks', disk_key)
|
||||
pending_list.remove(rbd_path)
|
||||
cfg.changed = True
|
||||
|
||||
if cfg.changed:
|
||||
cfg.commit()
|
||||
|
@ -74,8 +74,9 @@ def delete_rbd(module, rbd_path):
|
|||
rbd_path)
|
||||
rc, rm_out, err = module.run_command(rm_cmd, use_unsafe_shell=True)
|
||||
logger.debug("delete RC = {}, {}".format(rc, rm_out, err))
|
||||
|
||||
return True if rc == 0 else False
|
||||
if rc != 0:
|
||||
logger.error("Could not fully cleanup image {}. Manually run the rbd "
|
||||
"command line tool to remove.".format(rbd_path))
|
||||
|
||||
|
||||
def is_cleanup_host(config):
|
||||
|
|
|
@ -55,11 +55,11 @@ def delete_group(module, image_list, cfg):
|
|||
pending_list = list(image_list)
|
||||
|
||||
for rbd_path in image_list:
|
||||
if delete_rbd(module, rbd_path):
|
||||
disk_key = rbd_path.replace('/', '.', 1)
|
||||
cfg.del_item('disks', disk_key)
|
||||
pending_list.remove(rbd_path)
|
||||
cfg.changed = True
|
||||
delete_rbd(module, rbd_path)
|
||||
disk_key = rbd_path.replace('/', '.', 1)
|
||||
cfg.del_item('disks', disk_key)
|
||||
pending_list.remove(rbd_path)
|
||||
cfg.changed = True
|
||||
|
||||
if cfg.changed:
|
||||
cfg.commit()
|
||||
|
@ -74,8 +74,9 @@ def delete_rbd(module, rbd_path):
|
|||
rbd_path)
|
||||
rc, rm_out, err = module.run_command(rm_cmd, use_unsafe_shell=True)
|
||||
logger.debug("delete RC = {}, {}".format(rc, rm_out, err))
|
||||
|
||||
return True if rc == 0 else False
|
||||
if rc != 0:
|
||||
logger.error("Could not fully cleanup image {}. Manually run the rbd "
|
||||
"command line tool to remove.".format(rbd_path))
|
||||
|
||||
|
||||
def is_cleanup_host(config):
|
||||
|
|
Loading…
Reference in New Issue