[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] golang/xenlight: Implement DomainCreateNew
commit aa14feb6723d3bb15a884533ade1cd9732792145 Author: George Dunlap <george.dunlap@xxxxxxxxxx> AuthorDate: Tue Dec 24 12:51:56 2019 +0000 Commit: George Dunlap <george.dunlap@xxxxxxxxxx> CommitDate: Thu Apr 23 16:00:15 2020 +0100 golang/xenlight: Implement DomainCreateNew 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> Reviewed-by: Nick Rosbrook <rosbrookn@xxxxxxxxxxxx> --- tools/golang/xenlight/xenlight.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go index 20f6542f6b..6b4f492550 100644 --- a/tools/golang/xenlight/xenlight.go +++ b/tools/golang/xenlight/xenlight.go @@ -1213,3 +1213,21 @@ func (Ctx *Context) DeviceUsbdevRemove(domid Domid, usbdev *DeviceUsbdev) error return nil } + +// DomainCreateNew creates a new domain. +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 +} -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |