def remove_old_snapshots(session, instance, vm_ref):
    LOG.debug("Starting remove_old_snapshots for VM", instance=instance)
    vm_vdi_ref, vm_vdi_rec = get_vdi_for_vm_safely(session, vm_ref)
    chain = _walk_vdi_chain(session, vm_vdi_rec['uuid'])
    vdi_uuid_chain = [vdi_rec['uuid'] for vdi_rec in chain]
    sr_ref = vm_vdi_rec["SR"]
    _delete_snapshots_in_vdi_chain(session, instance, vdi_uuid_chain, sr_ref)
See if there is an snapshot present that should be removed.
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/virt/xenapi/vm_utils.py/remove_old_snapshots