-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(rest): improve inspect api #73
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine if you remove this @Black-Hole1
comment.
65f2918
to
c131dd4
Compare
Add the correct cpus, memory, devices Signed-off-by: Kevin Cui <[email protected]>
c131dd4
to
5962c06
Compare
For what it's worth, if you want to add unit tests for this new code, it's now easier using https://github.com/crc-org/vfkit/blob/main/test/vm_test.go ,this makes it easy to create a VM with a set of devices, start vfkit, run some tests (eg make http request to the REST API), and check that the result is the expected one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is going to be helpful to #48 to provide a way to let users of vfkit know which PTY was allocated :)
Nat bool `json:"nat"` | ||
MacAddress string `json:"macAddress"` | ||
UnixSocketPath string `json:"unixSocketPath"` | ||
Fd int `json:"fd"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fwiw, I'm not sure fd
is going to be useful to expose to an external process?
Net []VirtioNetResponse `json:"net"` | ||
Rng bool `json:"rng"` | ||
Serial config.VirtioSerial `json:"serial"` | ||
USBMassStorage []config.USBMassStorage `json:"usbMassStorage"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse the same format as the preexisting json serialization code?
"devices":[{"devName":"virtio-blk","imagePath":"/virtioblk1","readOnly":false,"deviceIdentifier":""}]}
serialization/deserialization to this format should already be working, a new type should not be needed.
Or do you have strong reasons for having such a struct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#99 reuses the existing json format
I've started doing this in cfergeau@4615740 but not finished yet :) |
I'm now done with the testing code/..., I've filed #99 , in my opinion we can move the rest of the discussions in this new PR. |
Hey @cfergeau, because it's Chinese New Year now, I'm currently on vacation and will be back in about a week. |
Thanks for the message, enjoy the holidays! |
I'm back :)
Does it look like I can close this PR? |
As for me, the new JSON format will make Go developers comfortable, but I cannot be certain about developers in other languages because they may not be able to determine the result of the response by inspecting the source code. Perhaps we still need to improve the relevant documentation? |
Ah yes, for sure, I did not even think about documenting this yet :-/
|
I tried to do this in #103 |
Add the correct cpus, memory, devices
Test Code:
Result: