Closed cfergeau closed 6 months ago
@BlackHole1: changing LGTM is restricted to collaborators
This can be tested by starting vfkit with --restful-uri unix:///Users/teuf/dev/vfkit/rest.sock
and then running curl --unix-socket /Users/teuf/dev/vfkit/rest.sock http://unused/vm/inspect
Tested with following and works as expected
✗ ./out/vfkit \
--cpus 2 --memory 2048 \
--bootloader efi,variable-store=efi-variable-store,create \
--device virtio-blk,path=vfkit-test-image.raw \
> --restful-uri unix:///Users/prkumar/dev/vfkit/rest.sock
INFO[0000] &{2 2048 {[efi variable-store=efi-variable-store create] true} [virtio-blk,path=vfkit-test-image.raw] unix:///Users/prkumar/dev/vfkit/rest.sock false}
INFO[0000] boot parameters: &{EFIVariableStorePath:efi-variable-store CreateVariableStore:true}
INFO[0000]
INFO[0000] virtual machine parameters:
INFO[0000] vCPUs: 2
INFO[0000] memory: 2048 MiB
INFO[0000]
INFO[0000] Adding virtio-blk device (imagePath: vfkit-test-image.raw)
INFO[0000] virtual machine is running
INFO[0000] waiting for VM to stop
and api response
✗ curl --unix-socket /Users/prkumar/dev/vfkit/rest.sock http://unused/vm/inspect | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 236 100 236 0 0 524k 0 --:--:-- --:--:-- --:--:-- 230k
{
"vcpus": 2,
"memoryBytes": 2147483648,
"bootloader": {
"kind": "efiBootloader",
"efiVariableStorePath": "efi-variable-store",
"createVariableStore": true
},
"devices": [
{
"kind": "virtioblk",
"devName": "virtio-blk",
"imagePath": "vfkit-test-image.raw"
}
]
}
/lgtm
/approve /lgtm
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: BlackHole1, praveenkumar Once this PR has been reviewed and has the lgtm label, please ask for approval from cfergeau. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
The aim of this PR was to add the list of devices to the /inspect endpoint with their parameters. This supersedes https://github.com/crc-org/vfkit/pull/73
My initial goal was to only add tests for this code. Along the way I found 2 related issues (memory byte/MiB confusion, and too long unix socket paths) which I fixed, and I also realized the code from #73 could be made simpler: config.VirtualMachine already can be serialized to/from json, so we don't need any new code.