golang/xenlight: add DomainDestroy wrapper
authorNick Rosbrook <rosbrookn@gmail.com>
Mon, 24 May 2021 20:36:50 +0000 (16:36 -0400)
committerGeorge Dunlap <george.dunlap@citrix.com>
Mon, 21 Jun 2021 15:49:08 +0000 (16:49 +0100)
Add a wrapper around libxl_domain_destroy.

Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
tools/golang/xenlight/xenlight.go

index fc3eb0bf3f07b4bc4d268fc7366da966b343fd7a..f605f176134e37c31c369a155ad22b4c856e27aa 100644 (file)
@@ -1272,3 +1272,13 @@ func (ctx *Context) DomainCreateNew(config *DomainConfig) (Domid, error) {
 
        return Domid(cdomid), nil
 }
+
+// DomainDestroy destroys a domain given a domid.
+func (ctx *Context) DomainDestroy(domid Domid) error {
+       ret := C.libxl_domain_destroy(ctx.ctx, C.uint32_t(domid), nil)
+       if ret != 0 {
+               return Error(ret)
+       }
+
+       return nil
+}