From: George Dunlap <george.dunlap@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ronald Rojas <ronladred@gmail.com>, Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <ian.jackson@citrix.com>
Subject: [PATCH v5 07/10] golang/xenlight: Implement Domain operations
Date: Wed, 5 Apr 2017 17:05:51 +0100 [thread overview]
Message-ID: <1491408354-9643-8-git-send-email-george.dunlap@citrix.com> (raw)
In-Reply-To: <1491408354-9643-1-git-send-email-george.dunlap@citrix.com>
From: Ronald Rojas <ronladred@gmail.com>
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@gmail.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
---
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
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
+}
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-04-05 16:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 16:05 [PATCH v5 00/10] tools: Implement basic golang bindings for libxl George Dunlap
2017-04-05 16:05 ` [PATCH v5 01/10] golang/xenlight: Create stub package George Dunlap
2017-04-05 16:05 ` [PATCH v5 02/10] golang/xenlight: Add error constants and standard handling George Dunlap
2017-04-05 16:05 ` [PATCH v5 03/10] golang/xenlight: Add host-related functionality George Dunlap
2017-04-05 16:05 ` [PATCH v5 04/10] golang/xenlight: Implement libxl_domain_info and libxl_domain_unpause George Dunlap
2017-04-05 16:05 ` [PATCH v5 05/10] golang/xenlight: Implement libxl_bitmap and helper operations George Dunlap
2017-04-05 16:05 ` [PATCH v5 06/10] golang/xenlight: Implement libxl_scheduler enumeration George Dunlap
2017-04-05 16:05 ` George Dunlap [this message]
2017-04-05 16:05 ` [PATCH v5 08/10] golang/xenlight: Implement Vcpuinfo and ListVcpu George Dunlap
2017-04-05 16:05 ` [PATCH v5 09/10] golang/xenlight: Implement get console path operations George Dunlap
2017-04-05 16:05 ` [PATCH v5 10/10] golang/xenlight: Implement cpupool operations George Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491408354-9643-8-git-send-email-george.dunlap@citrix.com \
--to=george.dunlap@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=ronladred@gmail.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).