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

[xen staging] golang/xenlight: add DeviceNicAdd/Remove wrappers



commit 0f140aa92029516858cc986837dc902b88bd1675
Author:     Nick Rosbrook <rosbrookn@xxxxxxxxx>
AuthorDate: Sun Apr 12 18:02:40 2020 -0400
Commit:     George Dunlap <george.dunlap@xxxxxxxxxx>
CommitDate: Thu Apr 23 11:30:54 2020 +0100

    golang/xenlight: add DeviceNicAdd/Remove wrappers
    
    Add DeviceNicAdd and DeviceNicRemove as wrappers for
    libxl_device_nic_add and libxl_device_nic_remove.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@xxxxxxxxxxxx>
    Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
 tools/golang/xenlight/xenlight.go | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tools/golang/xenlight/xenlight.go 
b/tools/golang/xenlight/xenlight.go
index 3f1b0baa0c..961939e947 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -1045,3 +1045,37 @@ func (Ctx *Context) PrimaryConsoleGetTty(domid uint32) 
(path string, err error)
        path = C.GoString(cpath)
        return
 }
+
+// DeviceNicAdd adds a nic to a domain.
+func (Ctx *Context) DeviceNicAdd(domid Domid, nic *DeviceNic) error {
+       var cnic C.libxl_device_nic
+
+       if err := nic.toC(&cnic); err != nil {
+               return err
+       }
+       defer C.libxl_device_nic_dispose(&cnic)
+
+       ret := C.libxl_device_nic_add(Ctx.ctx, C.uint32_t(domid), &cnic, nil)
+       if ret != 0 {
+               return Error(ret)
+       }
+
+       return nil
+}
+
+// DeviceNicRemove removes a nic from a domain.
+func (Ctx *Context) DeviceNicRemove(domid Domid, nic *DeviceNic) error {
+       var cnic C.libxl_device_nic
+
+       if err := nic.toC(&cnic); err != nil {
+               return err
+       }
+       defer C.libxl_device_nic_dispose(&cnic)
+
+       ret := C.libxl_device_nic_remove(Ctx.ctx, C.uint32_t(domid), &cnic, nil)
+       if ret != 0 {
+               return Error(ret)
+       }
+
+       return nil
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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