client: Add RepairInstance

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
This commit is contained in:
Stéphane Graber 2026-07-30 01:20:40 -04:00
parent 593775c736
commit 99792b5556
No known key found for this signature in database
GPG Key ID: C638974D64792D67
2 changed files with 21 additions and 0 deletions

View File

@ -3284,6 +3284,26 @@ func (r *ProtocolIncus) CreateInstanceBitmap(name string, bitmap api.StorageVolu
return nil
}
// RepairInstance requests that Incus runs a low-level repair action on the instance.
func (r *ProtocolIncus) RepairInstance(name string, repair api.InstanceDebugRepairPost) error {
if !r.HasExtension("instances_debug_repair") {
return errors.New("The server is missing the required \"instances_debug_repair\" API extension")
}
path, _, err := r.instanceTypeToPath(api.InstanceTypeAny)
if err != nil {
return err
}
// Send the request
_, _, err = r.query("POST", fmt.Sprintf("%s/%s/debug/repair", path, url.PathEscape(name)), repair, "")
if err != nil {
return err
}
return nil
}
func (r *ProtocolIncus) getInstanceNVRAM(name string, guid string, varName string, accept string) (*http.Response, error) {
path, _, err := r.instanceTypeToPath(api.InstanceTypeVM)
if err != nil {

View File

@ -178,6 +178,7 @@ type InstanceServer interface {
DeleteInstanceTemplateFile(name string, templateName string) (err error)
GetInstanceDebugMemory(name string, format string) (rc io.ReadCloser, err error)
RepairInstance(name string, repair api.InstanceDebugRepairPost) (err error)
GetInstanceNVRAM(name string) (vars map[string]map[string]*api.InstanceNVRAMVariable, err error)
GetInstanceNVRAMGUID(name string, guid string) (vars map[string]*api.InstanceNVRAMVariable, err error)
GetRawInstanceNVRAMGUIDVar(name string, guid string, varName string) (resp []byte, err error)