-
Notifications
You must be signed in to change notification settings - Fork 191
feat(kubevirt): Add VM lifecycle management tools (start, stop, restart) #533
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
base: main
Are you sure you want to change the base?
Conversation
57ac756 to
2a36d67
Compare
|
@codingben can you please review this PR? |
Cali0707
left a comment
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.
Hey @ksimon1 is it possible to consolidate these three tools into one?
IMO, a tool like vm_lifecycle_update or vm_lifecycle_set could work well - stop/start/restart could all be options set in the tool call.
That should help us keep a smaller tool count in this toolset
WDYT? (also cc @manusa as he has lots of great ideas about tool defs)
|
@Cali0707 for sure I can do that 👍 |
It's similar to KubeVirt implementation in lifecycle.go from BackEnd perspective. Why we're not importing |
codingben
left a comment
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 good, just try to have a single lifecycle tool, and I'd recommend to get rid of the dynamic client and unstructured fields.
| return api.NewToolCallResult("# VirtualMachine restarted successfully\n"+marshalledYaml, nil), nil | ||
| } | ||
|
|
||
| func getRequiredString(params api.ToolHandlerParams, key string) (string, 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.
nit: This is a duplicated function, should be part of API utils or something else.
2a36d67 to
1935000
Compare
|
@codingben I am not fan of unstructured and dynamic client too, but problem is, that kubevirt.io/client-go has dependency conflicts with packages in this project. That means I would have to update dependencies in this project to fit our kubevirt dependency. @Cali0707 do you think it would be possible? |
codingben
left a comment
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 good to me!
Add the vm_start, vm_stop, and vm_restart tools into a
single vm_lifecycle tool with an 'action' parameter.
The new vm_lifecycle tool accepts:
- namespace: The namespace of the virtual machine
- name: The name of the virtual machine
- action: The lifecycle action ('start', 'stop', or 'restart')
- start: changes runStrategy to Always
- stop: changes runStrategy to Halted
- restart: stops then starts the VM
Code was assisted by Cursor AI.
Signed-off-by: Karel Simon <[email protected]>
Add tests for the vm_lifecycle tool Code was assisted by Cursor AI. Signed-off-by: Karel Simon <[email protected]>
1935000 to
3773aa9
Compare
|
@ksimon1 Can you please update the PR description and commit messages? |
Summary
This PR extends the KubeVirt toolset with VM lifecycle management capabilities, enabling AI agents to start, stop, and restart virtual machines.
The new vm_lifecycle tool accepts:
startStarts a halted VirtualMachine by updating its
runStrategytoAlways.stopStops a running VirtualMachine by updating its
runStrategytoHalted.restartRestarts a VirtualMachine by cycling it through a complete stop-start sequence.