[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] golang/xenlight: Implement Domain operations



commit 412d2e622df627299ffd986cbc09a3959e6921a8
Author:     Ronald Rojas <ronladred@xxxxxxxxx>
AuthorDate: Wed Apr 5 17:05:51 2017 +0100
Commit:     George Dunlap <george.dunlap@xxxxxxxxxx>
CommitDate: Thu Apr 6 15:34:27 2017 +0100

    golang/xenlight: Implement Domain operations
    
    Add calls for the following Domain related functionality
    - libxl_domain_pause
    - libxl_domain_shutdown
    - libxl_domain_reboot
    - libxl_list_domain
    
    Signed-off-by: Ronald Rojas <ronladred@xxxxxxxxx>
    Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxx>
---
 tools/golang/xenlight/xenlight.go | 70 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/tools/golang/xenlight/xenlight.go 
b/tools/golang/xenlight/xenlight.go
index 86253c5..f16185e 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -713,3 +713,73 @@ func (Ctx *Context) DomainUnpause(Id Domid) (err error) {
        }
        return
 }
+
+//int libxl_domain_pause(libxl_ctx *ctx, uint32_t domain);
+func (Ctx *Context) DomainPause(id Domid) (err error) {
+       err = Ctx.CheckOpen()
+       if err != nil {
+               return
+       }
+
+       ret := C.libxl_domain_pause(Ctx.ctx, C.uint32_t(id))
+
+       if ret != 0 {
+               err = Error(-ret)
+       }
+       return
+}
+
+//int libxl_domain_shutdown(libxl_ctx *ctx, uint32_t domid);
+func (Ctx *Context) DomainShutdown(id Domid) (err error) {
+       err = Ctx.CheckOpen()
+       if err != nil {
+               return
+       }
+
+       ret := C.libxl_domain_shutdown(Ctx.ctx, C.uint32_t(id))
+
+       if ret != 0 {
+               err = Error(-ret)
+       }
+       return
+}
+
+//int libxl_domain_reboot(libxl_ctx *ctx, uint32_t domid);
+func (Ctx *Context) DomainReboot(id Domid) (err error) {
+       err = Ctx.CheckOpen()
+       if err != nil {
+               return
+       }
+
+       ret := C.libxl_domain_reboot(Ctx.ctx, C.uint32_t(id))
+
+       if ret != 0 {
+               err = Error(-ret)
+       }
+       return
+}
+
+//libxl_dominfo * libxl_list_domain(libxl_ctx*, int *nb_domain_out);
+//void libxl_dominfo_list_free(libxl_dominfo *list, int nb_domain);
+func (Ctx *Context) ListDomain() (glist []Dominfo) {
+       err := Ctx.CheckOpen()
+       if err != nil {
+               return
+       }
+
+       var nbDomain C.int
+       clist := C.libxl_list_domain(Ctx.ctx, &nbDomain)
+       defer C.libxl_dominfo_list_free(clist, nbDomain)
+
+       if int(nbDomain) == 0 {
+               return
+       }
+
+       gslice := (*[1 << 
30]C.libxl_dominfo)(unsafe.Pointer(clist))[:nbDomain:nbDomain]
+       for i := range gslice {
+               info := gslice[i].toGo()
+               glist = append(glist, *info)
+       }
+
+       return
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.