From e834cd02b27f51bd482ddf3cef2e12baa9176185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gonz=C3=A1lez?= Date: Thu, 28 Mar 2019 13:05:49 +0100 Subject: [PATCH] F #3144 monitoring methods should return the monitoring info --- src/oca/go/src/goca/host.go | 11 ++++++++--- src/oca/go/src/goca/vm.go | 22 ++++++++++++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/oca/go/src/goca/host.go b/src/oca/go/src/goca/host.go index 81bcdc17687..3667bc699c8 100644 --- a/src/oca/go/src/goca/host.go +++ b/src/oca/go/src/goca/host.go @@ -240,9 +240,14 @@ func (host *Host) Info() error { } // Monitoring returns the host monitoring records. -func (host *Host) Monitoring() error { - _, err := client.Call("one.host.monitoring", host.ID) - return err +func (host *Host) Monitoring() (string, error) { + monitor_data, err := client.Call("one.host.monitoring", host.ID) + + if err != nil{ + return "", err + }else { + return monitor_data.Body(), err + } } // State looks up the state of the image and returns the ImageState diff --git a/src/oca/go/src/goca/vm.go b/src/oca/go/src/goca/vm.go index 54893f6165e..20a9fcc6baa 100644 --- a/src/oca/go/src/goca/vm.go +++ b/src/oca/go/src/goca/vm.go @@ -624,9 +624,14 @@ func NewVMPool(args ...int) (*VMPool, error) { // -2: All resources // -1: Resources belonging to the user and any of his groups // >= 0: UID User's Resources -func (vmpool *VMPool) Monitoring(filter int) error { - _, err := client.Call("one.vmpool.monitoring", filter) - return err +func (vmpool *VMPool) Monitoring(filter int) (string, error) { + monitor_data, err := client.Call("one.vmpool.monitoring", filter) + + if err != nil{ + return "", err + }else { + return monitor_data.Body(), err + } } // Accounting returns the virtual machine history records @@ -778,9 +783,14 @@ func (vm *VM) UpdateConf(tpl string) error { } // Monitoring Returns the virtual machine monitoring records -func (vm *VM) Monitoring() error { - _, err := client.Call("one.vm.monitoring", vm.ID) - return err +func (vm *VM) Monitoring() (string, error) { + monitor_data, err := client.Call("one.vm.monitoring", vm.ID) + + if err != nil{ + return "", err + }else { + return monitor_data.Body(), err + } } // Chown changes the owner/group of a VM. If uid or gid is -1 it will not