It's possible for vcld to overwrite and miss a reservation that was placed into the image state.
During the inuse state a reservation gets polled roughly every 5 minutes. The states of the request/resevation go from inuse to pending and back to inuse once the polling checks have completed. There are a few milli-seconds where the backend is not aware that the state has changed and it changes the stateid back to inuse.
The method would be to update the state change query to only update if request.stateid is pending or
There are already several checks in the inuse module to check if a request is in imaging state _check_imaging_request.