Implemented DomainCreateNew and DomainDestroy methods

Signed-off-by: Ronald Rojas <ronlad...@gmail.com>
---

CC: xen-devel@lists.xen.org
CC: george.dun...@citrix.com
CC: ian.jack...@eu.citrix.com
CC: wei.l...@citrix.com
---
---
 tools/golang/xenlight/xenlight.go | 43 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/tools/golang/xenlight/xenlight.go 
b/tools/golang/xenlight/xenlight.go
index ed76fec..c9774cf 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -1360,3 +1360,46 @@ func (gdc DomainConfig) toC() (cdc 
C.libxl_domain_config) {
        cdc.on_soft_reset = gdc.OnSoftReset.toC()
        return
 }
+
+//int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config,
+//                             uint32_t *domid,
+//                             const libxl_asyncop_how *ao_how,
+//                             const libxl_asyncprogress_how *aop_console_how)
+//                             LIBXL_EXTERNAL_CALLERS_ONLY;
+func (Ctx *Context) DomainCreateNew(dconfig DomainConfig) (id Domid, err 
error) {
+       err = Ctx.CheckOpen()
+       if err != nil {
+               return
+       }
+       cconfig := dconfig.toC()
+
+       var cid C.uint32_t
+       //FIXME: create async caller
+       ret := C.libxl_domain_create_new(Ctx.ctx, &cconfig, &cid, nil, nil)
+       if ret != 0 {
+               err = Error(-ret)
+               return
+       }
+       id = Domid(cid)
+
+       return
+}
+
+//int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid,
+//                     const libxl_asyncop_how *ao_how)
+//                     LIBXL_EXTERNAL_CALLERS_ONLY;
+func (Ctx *Context) DomainDestroy(id Domid) (err error) {
+       err = Ctx.CheckOpen()
+       if err != nil {
+               return
+       }
+
+       //FIXME: create async caller
+       ret := C.libxl_domain_destroy(Ctx.ctx, C.uint32_t(id), nil)
+       if ret != 0 {
+               err = Error(-ret)
+               return
+       }
+       return
+
+}
-- 
2.7.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to