Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Add VM.get_consoles and console.get_location #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions console.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package client

type Console XenAPIObject

func (self *Console) GetLocation() (location string, err error) {
result := APIResult{}
err = self.Client.APICall(&result, "console.get_location", self.Ref)
if err != nil {
return "", err
}
location = result.Value.(string)

return location, nil
}
18 changes: 18 additions & 0 deletions vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,3 +658,21 @@ func (self *VM) SetHaAlwaysRun(ha_always_run bool) (err error) {
}
return
}

func (self *VM) GetConsoles() (consoles []Console, err error) {
consoles = make([]Console, 0)
result := APIResult{}
err = self.Client.APICall(&result, "VM.get_consoles", self.Ref)

if err != nil {
return consoles, err
}
for _, elem := range result.Value.([]interface{}) {
console := Console{}
console.Ref = elem.(string)
console.Client = self.Client
consoles = append(consoles, console)
}

return consoles, nil
}