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

[Xen-devel] [PATCH v4 13/14] golang/xenlight: Implement ActionOnShutdown and DomainConfig



Applied enumeration and implemented toC method for ActionOnShutdown

Implemented struct and implemented toC method for DomainConfig

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 | 61 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/tools/golang/xenlight/xenlight.go 
b/tools/golang/xenlight/xenlight.go
index 8b5ca38..ed76fec 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -1299,3 +1299,64 @@ type DeviceUsbdev struct {
 func (gdu DeviceUsbdev) toC() (cdu C.libxl_device_usbdev) {
        return
 }
+
+type ActionOnShutdown int
+
+const (
+       ActionOnShutdownDestroy         = C.LIBXL_ACTION_ON_SHUTDOWN_DESTROY
+       ActionOnShutdownRestart         = C.LIBXL_ACTION_ON_SHUTDOWN_RESTART
+       ActionOnShutdownRestartRename   = 
C.LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME
+       ActionOnShutdownPreserve        = C.LIBXL_ACTION_ON_SHUTDOWN_PRESERVE
+       ActionOnShutdownCoredumpDestroy = 
C.LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY
+       ActionOnShutdownCoredumRestart  = 
C.LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART
+       ActionOnShutdownSoftReset       = C.LIBXL_ACTION_ON_SHUTDOWN_SOFT_RESET
+)
+
+func (aos ActionOnShutdown) String() (str string) {
+       cstr := 
C.libxl_action_on_shutdown_to_string(C.libxl_action_on_shutdown(aos))
+
+       str = C.GoString(cstr)
+
+       return
+}
+
+func (gaos ActionOnShutdown) toC() (caos C.libxl_action_on_shutdown) {
+       caos = C.libxl_action_on_shutdown(gaos)
+       return
+}
+
+type DomainConfig struct {
+       CInfo DomainCreateInfo
+       BInfo DomainBuildInfo
+
+       Disks   []DeviceNic
+       Pcidevs []DevicePci
+       Rdms    []DeviceRdm
+       Dtdevs  []DeviceDtdev
+       Vftbs   []DeviceVfb
+       Vkbs    []DeviceVkb
+       Vtpms   []DeviceVtpm
+
+       Channels []DeviceChannel
+       Usbctrls []DeviceUsbctrl
+       Usbdevs  []DeviceUsbdev
+
+       OnPoweroff  ActionOnShutdown
+       OnReboot    ActionOnShutdown
+       OnWatchdog  ActionOnShutdown
+       OnCrash     ActionOnShutdown
+       OnSoftReset ActionOnShutdown
+}
+
+func (gdc DomainConfig) toC() (cdc C.libxl_domain_config) {
+       cdc.c_info = gdc.CInfo.toC()
+       cdc.b_info = gdc.BInfo.toC()
+       //FIXME: Implement converting device information
+
+       cdc.on_poweroff = gdc.OnPoweroff.toC()
+       cdc.on_reboot = gdc.OnReboot.toC()
+       cdc.on_watchdog = gdc.OnWatchdog.toC()
+       cdc.on_crash = gdc.OnCrash.toC()
+       cdc.on_soft_reset = gdc.OnSoftReset.toC()
+       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®.