1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-25 23:21:29 +03:00

B #3516: GOCA - fix saveas method mapping (#3517)

Signed-off-by: Pierre Lafievre <pierre.lafievre@iguanesolutions.com>
This commit is contained in:
treywelsh 2019-07-24 11:41:52 +02:00 committed by Tino Vázquez
parent 10d317123f
commit de5deda28f

View File

@ -291,11 +291,16 @@ func (vc *VMController) Resize(template string, enforce bool) error {
return err
}
// Saveas exports a disk to an image. If imageType is empty the default one
// will be used. If snapID is -1 the current image state will be exported
func (vc *VMDiskController) Saveas(imageName, imageType string, snapID int) error {
_, err := vc.c.Client.Call("one.vm.disksaveas", vc.entityID, vc.ID, imageName, imageType, snapID)
return err
// Saveas exports a disk to an image and returns the image ID.
// If imageType is empty the default one will be used.
// If snapID is -1 the current image state will be exported
func (vc *VMDiskController) Saveas(imageName, imageType string, snapID int) (int, error) {
response, err := vc.c.Client.Call("one.vm.disksaveas", vc.entityID, vc.ID, imageName, imageType, snapID)
if err != nil {
return 0, err
}
return response.BodyInt(), nil
}
// SnapshotCreate will create a snapshot of the disk image