Closed BlackHole1 closed 10 months ago
Hi @BlackHole1. Thanks for your PR.
I'm waiting for a crc-org member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test
on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test
label.
I understand the commands that are listed here.
/ok-to-test
developers needed to first get the current status of the virtual machine and then decide whether to proceed to the next step.
One minor comment, such an API will be racy, the VM state can change between the canXXX
query and the change state
query.
I'm not sure /vm/can/:state
is the best API for this, maybe this could be added to /vm/state
?
{"state": "string", "canStop": "true", "canPause": "false", "canForceStop": "true", "canResume": "..."}
Or when changing state, we could use different errors for "the operation is impossible in this state" and "there was an error when performing the operation"?
One minor comment, such an API will be racy, the VM state can change between the canXXX query and the change state query.
Good catch! I have changed the code.
@cfergeau Done
@cfergeau Done
I've squashed all commits to a single one, and copied the PR description to the commit, and force-pushed to your feat-can
branch, I hope that's fine with you!
/lgtm
(I'll approve after CI runs)
@cfergeau Done
I've squashed all commits to a single one, and copied the PR description to the commit, and force-pushed to your
feat-can
branch, I hope that's fine with you!
NP. In the future, I will pay attention to this when I submit a PR.
NP. In the future, I will pay attention to this when I submit a PR.
The expectations vary between projects, I don't mind doing the adjustments. I did it myself to avoid additional back & forth
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: cfergeau
The full list of commands accepted by this bot can be found here.
The pull request process is described here
In the previous API, there was no way to detect before changing the status, which would make it difficult for developers to handle the following situations:
In the previous solution, developers needed to first get the current status of the virtual machine and then decide whether to proceed to the next step. However, the current virtual machine status is very diverse (see: https://github.com/Code-Hex/vz/blob/bd29a7ea3d39465c4224bfb01e990e8c220a8449/virtualization.go#L23), which would require developers to handle various cases perfectly. This PR solves this problem.