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

[Xen-devel] [PATCH v4 3/3] golang/xenlight: Implement DomainCreateNew


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: George Dunlap <george.dunlap@xxxxxxxxxx>
  • Date: Mon, 9 Mar 2020 14:49:32 +0000
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=george.dunlap@xxxxxxxxxx; spf=Pass smtp.mailfrom=George.Dunlap@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Nick Rosbrook <rosbrookn@xxxxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
  • Delivery-date: Mon, 09 Mar 2020 14:49:45 +0000
  • Ironport-sdr: VRKX9VabFnnXwPBjmcgTiPdhRVgh0c81WrGbjwTegbEHD/9aJpmn+8mZFI9XZDUKrviaadhr45 g+l5UCDn1oC7U36aGHTeVMy0b/RGGIqpx9+8IkDY6jpqJyz9vgRojGiSwvqyTtHtPNdHRXgoG6 uFz0gJ4U18fKChM9HelDnCbrS53qTTXV5TxS1YXzmK8KBglKzr+CWhORCBcbCkHRorptRmec30 G4qppBEHHmoHd+t8bs35bQ/5kb5bRup/FLidfW4oLKHwlapT80RZtHz1wkzmf+k9TsVSX64QTd sRc=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This implements the wrapper around libxl_domain_create_new().  With
the previous changes, it's now possible to create a domain using the
golang bindings (although not yet to unpause it or harvest it after it
shuts down).

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
v4:
- Remove hand-crafted constructor code, make non-RFC

CC: Nick Rosbrook <rosbrookn@xxxxxxxxxxxx>
---
 tools/golang/xenlight/xenlight.go | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tools/golang/xenlight/xenlight.go 
b/tools/golang/xenlight/xenlight.go
index 56fa31fd7b..808b4a327c 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -1111,3 +1111,24 @@ func (Ctx *Context) PrimaryConsoleGetTty(domid uint32) 
(path string, err error)
        path = C.GoString(cpath)
        return
 }
+
+// int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config,
+//                             uint32_t *domid,
+//                             const libxl_asyncop_how *ao_how,
+//                             const libxl_asyncprogress_how *aop_console_how)
+func (Ctx *Context) DomainCreateNew(config *DomainConfig) (Domid, error) {
+       var cdomid C.uint32_t
+       var cconfig C.libxl_domain_config
+       err := config.toC(&cconfig)
+       if err != nil {
+               return Domid(0), fmt.Errorf("converting domain config to C: 
%v", err)
+       }
+       defer C.libxl_domain_config_dispose(&cconfig)
+
+       ret := C.libxl_domain_create_new(Ctx.ctx, &cconfig, &cdomid, nil, nil)
+       if ret != 0 {
+               return Domid(0), Error(ret)
+       }
+
+       return Domid(cdomid), nil
+}
-- 
2.25.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.