|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 4/8] golang/xenlight: Implement libxl_domain_info and libxl_domain_unpause
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@xxxxxxxxxx>
Signed-off-by: Ronald Rojas <ronladred@xxxxxxxxx>
---
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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |