David Howells [Thu, 10 Apr 2014 13:04:52 +0000 (14:04 +0100)]
Implement "vos examine"
Implement the "vos examine" command. There is a lot of common display code
between this and several of the other commands, so the common bits are drawn
out into a library module for all to share.
Signed-off-by: David Howells <dhowells@redhat.com>
David Howells [Thu, 10 Apr 2014 10:19:56 +0000 (11:19 +0100)]
Save raw argument list for each switch
Several of the switch parameters have their argument lists cooked by the
argument parser. This means we cannot get at the original string(s) when
producing error messages.
Save the raw argument list for each switch in the parameters dictionary as a
list of strings attached to a key of "raw.<switchname>".
Signed-off-by: David Howells <dhowells@redhat.com>
David Howells [Thu, 10 Apr 2014 10:17:25 +0000 (11:17 +0100)]
Add a convenience module for partition ID handling
Add a convenience module for partition ID handling. One function translates
"/vicepX[Y]", "vicepX[Y]", "X[Y]" and "N" into a numeric ID and range checks
it. Another function translates a numeric ID back into "/vicepX[Y]".
Make the argument parser use it.
Signed-off-by: David Howells <dhowells@redhat.com>
David Howells [Wed, 9 Apr 2014 22:38:32 +0000 (23:38 +0100)]
rxgen: Emit individual exception classes for defined abort codes and raise them
Emit an exception class for each defined abort code and raise the appropriate
exception when an abort is received. Each set of classes is subclassed from a
package-specific class (eg. AbortVL_NOENT -> VLAbort) and each
package-specific class is subclassed from a generic class (eg. VLAbort ->
RemoteAbort) so that all package codes can be trapped in one statement and all
remote aborts can be trapped together.
If an unknown code is received, then this is raised as RemoteAbort only.
RxRPC/rxgen codes are supplied now also in the rxgen.xg file under the RXGEN
package name.
KAA/KAM/KAT codes are under the KA package.
Signed-off-by: David Howells <dhowells@redhat.com>
David Howells [Wed, 9 Apr 2014 20:27:58 +0000 (21:27 +0100)]
rxgen: Set struct members correctly in struct types
When setting a member of a struct (eg. VL.ListAddrByAttributes) where that
member is itself a struct type (eg. afsUUID), we need to check that the type
of the value to assign is the member type, not the container type.
Signed-off-by: David Howells <dhowells@redhat.com>
David Howells [Wed, 9 Apr 2014 14:40:36 +0000 (15:40 +0100)]
Move VL connection security determination into cell.py
Move the Volume Location DB connection security handling into
cell.open_vl_server() as it's common to all vos commands. It can be
configured directly by passing in a dictionary holding the appropriate
parameters.
Signed-off-by: David Howells <dhowells@redhat.com>
David Howells [Wed, 9 Apr 2014 14:43:22 +0000 (15:43 +0100)]
Provide generic check for non-combinable parameters
Provide generic check for non-combinable parameters in command py files. A
list of tuples of pairs of argument names that don't interact is provided by
the name cant_combine_arguments as a global var.
Signed-off-by: David Howells <dhowells@redhat.com>
David Howells [Tue, 8 Apr 2014 17:23:54 +0000 (18:23 +0100)]
Allow RxRPC transport security to be requested
Honour the -encrypt flag to vos listvldb and make it tell AF_RXRPC to secure
the connection. This requires an appropriate key to be available in one of
the user's keyrings, labelled:
afs@<UPPERCASE.CELL.NAME>
Without such a key, error:
[Errno 126] Required key not available
will be issued.
Signed-off-by: David Howells <dhowells@redhat.com>
David Howells [Wed, 8 Jan 2014 23:38:07 +0000 (23:38 +0000)]
Initial code commit now that the VLDB lookup test python script works
The rxgen.pl script takes a C header file, parses it for #defined constants,
structures declarations and synchronous RPC call function declarations and
emits the following:
- C functions to marshal/unmarshal structs.
- C functions to marshal func arguments and dispatch the request.
- C functions to unmarshal the replies.
- C functions to provide synchronous RPC calls matching the source.
- A python module containing:
- Python types to wrap the structs.
- Python methods to wrap the synchronous RPC calls.
- Python constants to wrap the constants.
It cannot yet handle functions that deal in bulk types/lists of structs and
functions that take interpolated chunks of arbitrary data.
It also does not yet emit server-side parts or top layer of the asynchronous
client side stuff.
It requires python v3 and requires the AF_RXRPC socket family to be available
in the kernel.
A script called "vl-test.py" is included that can be used to test the
functionality. Run without arguments, it will attempt to retrieve the
"afs.root" volume from the grand.central.org AFS cell.
The test script uses the DNS so may require a python3-dns package installing.
Signed-off-by: David Howells <dhowells@redhat.com>