When a rescue operation is initiated in Nova, a partial-period .exists event is emitted to capture instance runtime, etc for the period before the rescue. Currently, this occurs just before the actual rescue operation is kicked off on the hypervisor.
If the rescue operation is interrupted by another user operation, such as a delete or rebuild, before it finishes, then the rescue will not complete, and the instance's launched_at time will not be reset. This will result in the instance runtime for the partial .exists, and the end-of day .exists overlapping.
To fix this, the notify_usage_exists() call in ComputeManager's rescue_instance method should be moved to after the driver.rescue() call completes, just before the instance update that changes the launched_at timestamp. This will prevent the extra .exists from being emitted if the rescue is interrupted, and the launched_at is not changed.
Fix proposed to branch: master /review. openstack. org/63731
Review: https:/