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()
rm_cmd = 'rbd --no-progress rm {}'.format(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):
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()
rm_cmd = 'rbd --no-progress rm {}'.format(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):