mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
parent
880e90bd09
commit
108ec40014
@ -164,4 +164,5 @@ const (
|
||||
Action SchedAction = "ACTION"
|
||||
EndType SchedAction = "END_TYPE"
|
||||
EndValue SchedAction = "END_VALUE"
|
||||
ActionID SchedAction = "ID"
|
||||
)
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
"github.com/OpenNebula/one/src/oca/go/src/goca/parameters"
|
||||
"github.com/OpenNebula/one/src/oca/go/src/goca/schemas/shared"
|
||||
"github.com/OpenNebula/one/src/oca/go/src/goca/schemas/vm"
|
||||
"github.com/OpenNebula/one/src/oca/go/src/goca/schemas/vm/keys"
|
||||
)
|
||||
|
||||
// VMsController is a controller for a pool of VMs
|
||||
@ -550,3 +551,26 @@ func (vc *VMController) Unlock() error {
|
||||
_, err := vc.c.Client.Call("one.vm.unlock", vc.ID)
|
||||
return err
|
||||
}
|
||||
|
||||
// AddSchedAction adds a new scheduled action to the VM
|
||||
func (vc *VMController) AddSchedAction(action *vm.SchedAction) error {
|
||||
_, err := vc.c.Client.Call("one.vm.schedadd", vc.ID, action.String())
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdateSchedAction updates the scheduled action specified by the action ID attribute
|
||||
func (vc *VMController) UpdateSchedAction(action *vm.SchedAction) error {
|
||||
actionId, err := action.GetInt(string(keys.ActionID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = vc.c.Client.Call("one.vm.schedupdate", vc.ID, actionId, action.String())
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteSchedAction deletes the actionId action
|
||||
func (vc *VMController) DeleteSchedAction(actionId int) error {
|
||||
_, err := vc.c.Client.Call("one.vm.scheddelete", vc.ID, actionId)
|
||||
return err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user