From: Ronald Rojas <ronladred@gmail.com>
To: xen-devel@lists.xen.org, george.dunlap@citrix.com,
ian.jackson@eu.citrix.com, wei.liu2@citrix.com
Cc: Ronald Rojas <ronladred@gmail.com>
Subject: [PATCH RFC 4/8] golang/xenlight: Implement libxl_domain_info and libxl_domain_unpause
Date: Wed, 18 Jan 2017 14:56:42 -0500 [thread overview]
Message-ID: <1484769406-17416-4-git-send-email-ronladred@gmail.com> (raw)
In-Reply-To: <1484769406-17416-1-git-send-email-ronladred@gmail.com>
Add calls for the following host-related functionality:
- libxl_domain_info
- libxl_domain_unpause
Include Golang version for the libxl_domain_info as
DomainInfo.
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Ronald Rojas <ronladred@gmail.com>
---
tools/golang/xenlight/xenlight.go | 91 +++++++++++++++++++++++++++++++++++++++
1 file changed, 91 insertions(+)
diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go
index 6b04850..1e25413 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -105,6 +105,12 @@ func (e Errorxl) Error() string {
/*
* Types: Builtins
*/
+type Domid uint32
+
+type MemKB uint64
+
+type Uuid C.libxl_uuid
+
type Context struct {
ctx *C.libxl_ctx
}
@@ -165,6 +171,32 @@ type VersionInfo struct {
BuildId string
}
+type Dominfo struct {
+ Uuid Uuid
+ Domid Domid
+ Ssidref uint32
+ SsidLabel string
+ Running bool
+ Blocked bool
+ Paused bool
+ Shutdown bool
+ Dying bool
+ NeverStop bool
+
+ ShutdownReason int32 // FIXME shutdown_reason enumeration
+ OutstandingMemkb MemKB
+ CurrentMemkb MemKB
+ SharedMemkb MemKB
+ PagedMemkb MemKB
+ MaxMemkb MemKB
+ CpuTime time.Duration
+ VcpuMaxId uint32
+ VcpuOnline uint32
+ Cpupool uint32
+ DomainType int32 //FIXME libxl_domain_type enumeration
+
+}
+
/*
* Context
*/
@@ -332,3 +364,62 @@ func (Ctx *Context) GetVersionInfo() (info *VersionInfo, err error) {
return
}
+
+func (Ctx *Context) DomainInfo(Id Domid) (di *Dominfo, err error) {
+ err = Ctx.CheckOpen()
+ if err != nil {
+ return
+ }
+
+ var cdi C.libxl_dominfo
+
+ ret := C.libxl_domain_info(Ctx.ctx, unsafe.Pointer(&cdi), C.uint32_t(Id))
+
+ if ret != 0 {
+ err = Errorxl(ret)
+ return
+ }
+
+ // We could consider having this boilerplate generated by the
+ // idl, in a function like this:
+ //
+ // di = translateCdomaininfoToGoDomaininfo(cdi)
+ di = &Dominfo{}
+ di.Uuid = Uuid(cdi.uuid)
+ di.Domid = Domid(cdi.domid)
+ di.Ssidref = uint32(cdi.ssidref)
+ di.SsidLabel = C.GoString(cdi.ssid_label)
+ di.Running = bool(cdi.running)
+ di.Blocked = bool(cdi.blocked)
+ di.Paused = bool(cdi.paused)
+ di.Shutdown = bool(cdi.shutdown)
+ di.Dying = bool(cdi.dying)
+ di.NeverStop = bool(cdi.never_stop)
+ di.ShutdownReason = int32(cdi.shutdown_reason)
+ di.OutstandingMemkb = MemKB(cdi.outstanding_memkb)
+ di.CurrentMemkb = MemKB(cdi.current_memkb)
+ di.SharedMemkb = MemKB(cdi.shared_memkb)
+ di.PagedMemkb = MemKB(cdi.paged_memkb)
+ di.MaxMemkb = MemKB(cdi.max_memkb)
+ di.CpuTime = time.Duration(cdi.cpu_time)
+ di.VcpuMaxId = uint32(cdi.vcpu_max_id)
+ di.VcpuOnline = uint32(cdi.vcpu_online)
+ di.Cpupool = uint32(cdi.cpupool)
+ di.DomainType = int32(cdi.domain_type)
+
+ return
+}
+
+func (Ctx *Context) DomainUnpause(Id Domid) (err error) {
+ err = Ctx.CheckOpen()
+ if err != nil {
+ return
+ }
+
+ ret := C.libxl_domain_unpause(Ctx.ctx, C.uint32_t(Id))
+
+ if ret != 0 {
+ err = Errorxl(ret)
+ }
+ return
+}
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-01-18 19:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 19:56 [PATCH RFC 1/8] golang/xenlight: Create stub package Ronald Rojas
2017-01-18 19:56 ` [PATCH RFC 2/8] golang/xenlight: Add error constants and standard handling Ronald Rojas
2017-01-18 22:16 ` Dario Faggioli
2017-01-19 15:13 ` Ronald Rojas
2017-01-19 16:02 ` George Dunlap
2017-01-19 16:15 ` Wei Liu
2017-01-19 16:19 ` Dario Faggioli
2017-01-19 17:16 ` George Dunlap
2017-01-18 19:56 ` [PATCH RFC 3/8] golang/xenlight: Add host-related functionality Ronald Rojas
2017-01-19 17:51 ` George Dunlap
2017-01-18 19:56 ` Ronald Rojas [this message]
2017-01-18 19:56 ` [PATCH RFC 5/8] golang/xenlight: Implement libxl_bitmap and helper operations Ronald Rojas
2017-01-18 19:56 ` [PATCH RFC 6/8] tools/xenlight: Implement libxl_scheduler enumeration Ronald Rojas
2017-01-18 19:56 ` [PATCH RFC 7/8] golang/xenlight: Implement cpupool operations Ronald Rojas
2017-01-18 19:56 ` [PATCH RFC 8/8] golang/xenlight: Add tests host related functinality functions Ronald Rojas
2017-01-18 22:10 ` [PATCH RFC 1/8] golang/xenlight: Create stub package Dario Faggioli
2017-01-18 22:37 ` Ronald Rojas
2017-01-19 12:03 ` Wei Liu
2017-01-19 15:15 ` Ronald Rojas
2017-01-19 16:16 ` George Dunlap
2017-01-19 16:40 ` George Dunlap
2017-01-19 16:45 ` George Dunlap
-- strict thread matches above, loose matches on Subject: below --
2017-01-23 16:43 Ronald Rojas
2017-01-23 16:43 ` [PATCH RFC 4/8] golang/xenlight: Implement libxl_domain_info and libxl_domain_unpause Ronald Rojas
2017-02-01 16:16 ` 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=1484769406-17416-4-git-send-email-ronladred@gmail.com \
--to=ronladred@gmail.com \
--cc=george.dunlap@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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).