-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: cloudhypervisor api client #522
feat: cloudhypervisor api client #522
Conversation
pkg/cloudhypervisor/client.go
Outdated
VmmShutdown(ctx context.Context) error | ||
// Info returns general information about the cloud-hypervisor Virtual Machine (VM) instance. | ||
Info(ctx context.Context) (*VmInfo, error) | ||
//Counters(ctx context.Context) *VmmCo |
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.
what dis?
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.
Ah, thats a future todo that i forgot to remove. I have removed it now :)
pkg/cloudhypervisor/client.go
Outdated
// PowerButton triggers a power button in the VM. | ||
PowerButton(ctx context.Context) error |
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.
What does this mean? Like on/off?
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.
Well depends on what the power button is configured to do.
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.
I updated the comment.
pkg/cloudhypervisor/client.go
Outdated
func (c *client) VmmPing(ctx context.Context) (*VmmPingResponse, error) { | ||
resp := &VmmPingResponse{} | ||
|
||
if err := c.builder.Clone().Path("vmm.ping").ToJSON(resp).Fetch(ctx); err != nil { |
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.
would be good to have all these "vmm.x"
strings as consts
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.
I agree. I have moved these all to consts.
This change adds a Cloud Hypervisor API client. This will be used in a later implementation to enable Flintlock to talk to running instances of Cloud Hypervisor. This functionality will not be used initially. Signed-off-by: Richard Case <richard.case@outlook.com>
Clone(). | ||
Path(PathVmBoot). | ||
AddValidator(CustomErrValidator(map[int]string{ | ||
404: "The VM instance could not boot because it is not created yet", |
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.
would be good to have all these as consts, but happy to leave that as a TODO for later
if err = json.Unmarshal(data, dest); err != nil { | ||
return err | ||
} | ||
return nil |
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.
could be
if err = json.Unmarshal(data, dest); err != nil { | |
return err | |
} | |
return nil | |
return json.Unmarshal(data, dest) |
but not bothered
What this PR does / why we need it:
This change adds a Cloud Hypervisor API client. This will be used in a
later implementation to enable Flintlock to talk to running instances of
Cloud Hypervisor.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Relates #417
Special notes for your reviewer:
This functionality will not be used initially.
Checklist: