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

[Xen-devel] [PATCH v4 14/14] golang/xenlight: Implement domain create/destroy operations



Implemented DomainCreateNew and DomainDestroy methods

Signed-off-by: Ronald Rojas <ronladred@xxxxxxxxx>
---

CC: xen-devel@xxxxxxxxxxxxx
CC: george.dunlap@xxxxxxxxxx
CC: ian.jackson@xxxxxxxxxxxxx
CC: wei.liu2@xxxxxxxxxx
---
---
 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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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