def fix_error_deleting_volumes(meta, error_deleting_volumes):
    volumes_t = Table('volumes', meta, autoload=True)
    volume_attachment_t = Table('volume_attachment', meta, autoload=True)
    volume_metadata_t = Table('volume_metadata', meta, autoload=True)
    volume_admin_metadata_t = Table('volume_admin_metadata', meta, autoload=True)
    for error_deleting_volumes_id in error_deleting_volumes:
        now = datetime.datetime.utcnow()
        log.info('-- action: deleting possible volume admin metadata for volume id: %s', error_deleting_volumes_id)
        delete_volume_admin_metadata_q = volume_admin_metadata_t.update().where((volume_admin_metadata_t.c.volume_id == error_deleting_volumes_id)).values(updated_at=now, deleted_at=now, deleted=1)
        delete_volume_admin_metadata_q.execute()
        log.info('-- action: deleting possible volume metadata for volume id: %s', error_deleting_volumes_id)
        delete_volume_metadata_q = volume_metadata_t.update().where((volume_metadata_t.c.volume_id == error_deleting_volumes_id)).values(updated_at=now, deleted_at=now, deleted=1)
        delete_volume_metadata_q.execute()
        log.info('-- action: deleting possible volume attachments for volume id: %s', error_deleting_volumes_id)
        delete_volume_attachment_q = volume_attachment_t.update().where((volume_attachment_t.c.volume_id == error_deleting_volumes_id)).values(updated_at=now, deleted_at=now, deleted=1)
        delete_volume_attachment_q.execute()
        log.info('-- action: deleting volume id: %s', error_deleting_volumes_id)
        delete_volume_q = volumes_t.update().where((volumes_t.c.id == error_deleting_volumes_id)).values(updated_at=now, deleted_at=now, deleted=1)
        delete_volume_q.execute()
def fix_error_deleting_volumes(meta, error_deleting_volumes):
    volumes_t = Table('volumes', meta, autoload=True)
    volume_attachment_t = Table('volume_attachment', meta, autoload=True)
    volume_metadata_t = Table('volume_metadata', meta, autoload=True)
    volume_admin_metadata_t = Table('volume_admin_metadata', meta, autoload=True)
    for error_deleting_volumes_id in error_deleting_volumes:
        now = datetime.datetime.utcnow()
        log.info('-- action: deleting possible volume admin metadata for volume id: %s', error_deleting_volumes_id)
        delete_volume_admin_metadata_q = volume_admin_metadata_t.update().where((volume_admin_metadata_t.c.volume_id == error_deleting_volumes_id)).values(updated_at=now, deleted_at=now, deleted=1)
        delete_volume_admin_metadata_q.execute()
        log.info('-- action: deleting possible volume metadata for volume id: %s', error_deleting_volumes_id)
        delete_volume_metadata_q = volume_metadata_t.update().where((volume_metadata_t.c.volume_id == error_deleting_volumes_id)).values(updated_at=now, deleted_at=now, deleted=1)
        delete_volume_metadata_q.execute()
        log.info('-- action: deleting possible volume attachments for volume id: %s', error_deleting_volumes_id)
        delete_volume_attachment_q = volume_attachment_t.update().where((volume_attachment_t.c.volume_id == error_deleting_volumes_id)).values(updated_at=now, deleted_at=now, deleted=1)
        delete_volume_attachment_q.execute()
        log.info('-- action: deleting volume id: %s', error_deleting_volumes_id)
        delete_volume_q = volumes_t.update().where((volumes_t.c.id == error_deleting_volumes_id)).values(updated_at=now, deleted_at=now, deleted=1)
        delete_volume_q.execute()