WIP: Fix WCFS NEO storage URL pattern
Hello everyone,
I want to fix an issue with the NEO URL concatenation in instance.cfg.in
(see details below).
My initial attempt is still drafty, I want to open this MR to discuss few details and what's the best way to solve them.
1. Adding tests
First of all I didn't add any tests yet - because I'm not sure how to do so. I recognized there are already integration tests for WCFS in ERP5 SR. And they are successful in recent test runs. As far as I understand, they run with the default ERP5 software release parameters, which means they run with ZEO, which means they don't test the problem I try to solve.
Would it be possible to run TestWCFS
with NEO and if yes, what would be the recommended way? I already recognized that its possible to provide parameters to the tested instance with getInstanceParameterDict
, so that I could set zodb -> type -> "neo"
. But I don't know how I could setup the NEO server instance (and get its parameters like master node address to be accessible in TestWCFS
).
2. How to handle encryption parameters
Then there is one part where I'm unsure how this should be handled in instance-wcfs.cfg.in
.
Encryption file paths (x.key
, x.cert
, ca.crt
) moved to the user
part in NEO/go.
The SlapOS/software/neoppod/instance scheme
only specifies _ca
, _cert
and _key
for providing the data with inline strings. Alternatively it says the files should reside in ~/etc
.
I think we can't provide inline strings in the zurl
and we neither can provide file paths with /
, because the URL parser would interpret this as a delimiter.
So in my initial attempt I just assumed that all files are in the local directory where the script is called, which is perhaps a bad idea.
Issue description
The NEO/go commit kirr/neo@8c974485 changed the URL with which a NEO/go client can be loaded from
// neo://name@master1,master2,...,masterN?options
to
neo(s)://[credentials@]master1,master2,...,masterN/name?options
We need to apply this change in the NEO URL structure to instance-wcfs.cfg.in
to be able to use WCFS with a NEO storage.
Why?
The URL in instance-wcfs.cfg.in
is finally send to WCFS executable, which will open a NEO/go client with this URL via the openClientByURL
function [1].
If the URL formatting instance-wcfs.cfg.in follows the old pattern, NEO/go is unable to create a NEO/go client and may even raise an exception [2], because information regarding NEO server is at the wrong position of the URL.
[1] The WCFS executable calls wendelin.wcfs.main().
The main
function calls serve
.
And serve
calls here wcfs.go main which calls _main. Here the user provided zurl
is fetched to call zodb.Open
, which will finally find openClientByURL
by calling OpenDriver
(which loads it from driverRegistry
-> NEO driver is registered here).
See here for openClientByURL
.
[2] For instance when using the old pattern of putting the cluster name in the user
part, NEO/go will raise
credentials can be specified only with neos:// scheme
because NEO/go reserves the user
part for
encryption information, (see here for exception call).
Best, Levin