def do_node_housekeeping(): JBoxEBSHousekeep.log_debug("starting node housekeeping") for device, vol in JBoxEBSVol.get_mapped_volumes().iteritems(): deviceid = os.path.basename(device) vol_id = vol.volume_id vol = EBSVol.get_volume(vol_id) user_id = vol.tags['Name'] if 'Name' in vol.tags else None if user_id is None: continue sessname = unique_sessname(user_id) cont = SessContainer.get_by_name(sessname) if cont is not None: continue JBoxEBSHousekeep.log_debug("Found orphaned volume %s for %s, %s", vol_id, user_id, sessname) ebsvol = JBoxEBSVol(deviceid, sessname=sessname) ebsvol.release(backup=True) JBoxEBSHousekeep.log_debug("finished node housekeeping")