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

RFC: Early mock-up of a xenopsd based on golang libxl bindings


  • To: "open list:X86" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: George Dunlap <George.Dunlap@xxxxxxxxxx>
  • Date: Fri, 16 Oct 2020 16:29:58 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+PmAnM4uvorTQPw2AeRa/U2NxnD/M6ErGu5GxzohOnI=; b=Zb/l7rLc1LYtAIYwewZ1nRCq8TUamz2DKJDlvqHAC+ebvOHwAK0WsGe1leQbbUobkhoIw8KBafAx5MQEQmQ/G4rSmOLMdnSQuvUNYOi9649ncss3rEPc4tsgKunIasBDHp3yhXFAqNUu3ALgr7GBuULGzxHTxvUxQj/pIJgRzPBhtnlp/V2rlqlloBoqm/Lq7Vu+9rP9mUxCFLhJHSWWx4rtKO13imXgGLSxhrs3l4+n3XbqlPkKWlvoZT1BRKuIdk7fa4KcRF1JhyCI0B++qKGaruIWQ6aqvy9t5sOYXfa7WHl5RvwJ3npiHhOQjzfas7qg1EeOtECzacUxJ4FDZw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e0YyJ8tZXp72V7VasgNh6h+i4n2tJtjdIHSYxjyHUGuzWzFz6KUIUbVwj39oh2N+uCom/7oekDYABvG/hIbJ3jHd+fcScenkCPSqwYM0eNQpOiupNl7PhnlizvHv5EmqjSA5tqofKD/+vk0gXZdvNBVI7yCLtGTiOW/7TXo/fAGRCHh00M0cAPPBP7+jv5GMfQszLSuqCzytKRfSryGApreij8haJXRq0OMsFt/I/SVv0HBFvmgI1EYUY02K5EKyXK2inmqws82XfnAhZ849gpjEsNPAAhjtsr53iPotfq0uGF9XZkuUKz4uTZTohlrhfbCX7sejyVGq/i4vzAB7gg==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Nick Rosbrook <rosbrookn@xxxxxxxxx>, Rich Persaud <persaur@xxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Olivier Lambert <olivier.lambert@xxxxxxxx>, Edwin Torok <edvin.torok@xxxxxxxxxx>
  • Delivery-date: Fri, 16 Oct 2020 16:30:07 +0000
  • Ironport-sdr: noZIpdj67tA5J8oXSxfBQYacU3rd+GsZe59ZN9hfPD8H+rOyCZl5Qqg/ZpJiKqqdhUYOlgxUIh x/B7BuUUkbZfi2Nr/MOysmydwSI5aqgUrs/Up6+fUA+29XIJXJXB0QPelGIa2yKVWQx//UA1YC L5/mzzb+WRsN53Z/rp4Xup6/V4/lI7TZB3C3EERI/jjXBPxyLcaHRvbeI2gXUmWlMkStTsZtye Sg5V4BQ3DGFdZ8ZrlqiFBZ3u+/ER6AAO/CbKnDOk4Mdi9TekG8pjalsK8OCuUb649p07MMOVmS Edo=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWo9mWX/nzbew8RUGADXmvLnD2mQ==
  • Thread-topic: RFC: Early mock-up of a xenopsd based on golang libxl bindings

https://gitlab.com/martyros/go-xen branch `working/xenops` contains a 
super-basic mock-up of a unix domain xenopsd based on the golang libxl bindings.

To use:

* Install Xen >= 4.14 on your target system

* Make sure you have go >= 1.11 installed

* Clone & build the server

$ git clone https://gitlab.com/martyros/go-xen

$ cd go-xen

$ git checkout working/xenops

Note that this is *not* a fast-forwarding branch.

$ cd xenops/xenopsd

$ go build

$ ./xenopsd

Theoretically this will now accept jsonrpc v1 calls on `/tmp/xenops`.  I 
haven’t dug into exactly what the wire protocol looks like, but you can test 
golang’s version of it by using one of the “client examples”.  In another 
terminal:

$ cd xenops/client-examples

$ go run get-domains-example.co

It should list the currently-running domains and their domain names.

The core of the actual implementation is in go-xen/xenops/xenops/xenops.go.  
Basically, every method you add to the Xenops type of the correct format 
(described in the “net/rpc” documentation) will be exposed as a method 
available via RPC.

The current code only does a Unix socket, but it could easily be modified to 
work over http as well.

Once we have function signatures in the libxl IDL, the xenops methods could all 
be autogenerated, just like the types are for the golang bindings.

It should be noted that at the moment there will be two “layers” of translation 
both ways here: The golang package will be converting rpc into golang 
structures, then the libxl libraries will be converting golang structures into 
C structures; then any return values have to be converted from C structures 
into golang structures, and then converted a gain from golang structures into 
json before being sent back over the wire.  This may or may not be a big 
overhead.

Two things that are currently sub-optimal about the `xenlight` package for this 
use case.

First, although we have a xenlight.Error type, a lot of the xenlight wrappers 
return a generic “error”.  I’m not sure how that will end up being converted 
into json, but we might thing about making the xenlight wrappers all return 
xenlight.Error instead.

Secondly, at the moment the xenlight types are in the same package as the 
function wrappers.  This means that in order to build even the client, you need 
to be able to link against an installed libxl library — even though the final 
binary won’t need to link against libxl at all, and could theoretically be on a 
completely separate host.

Unfortunately the way we’ve structured xenlight, it’s not simple to move 
types.gen.go into its own package, because of the toC and fromC wrappers, which 
*do* need to link against libxl (for the init and dispose functions).  Nick, we 
might think about whether we should make separate toC and fromC functions for 
each of the types, rather than making those methods.

 -George

 


Rackspace

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