Prevent operations on exited HCS objects. #1567
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add checks to
hcs.System
to prevent attempting to shutdown or terminate a compute system that has already been stopped.The same checks could be added to other operations (eg, pause, start, resume) but it is unclear what error should be returned in those situations, so those operations are left untouched.
Add checks to
hcs.Process
to prevent attempting to kill a stopped process.Although
hcs.Process
differs fromhcs.System
in that the latter returns an error if the system is already stopped or closed, but the former does not.Therefore,
(*Process).Kill
returnsErrProcessAlreadyStopped
, which is the expected error in(*hcsExec).Kill
.Finally, an additional check is added to
(*Process).CloseStdin
to skip sending a modify request to the process to close stdin if the process has already been stopped.(And
(*Process).CloseStdin
now creates a span, similar to(*Process).CloseStd(out|err)
).The motivation for this came from
(*UtilityVM).Close()
callingTerminate
on the compute system, even if(*UtilityVM).Terminate()
was already called.Signed-off-by: Hamza El-Saawy hamzaelsaawy@microsoft.com