]> www.infradead.org Git - users/dhowells/kafs-utils.git/log
users/dhowells/kafs-utils.git
11 years agoC can't just return exception classes to python to raise an exception
David Howells [Fri, 11 Apr 2014 12:24:06 +0000 (13:24 +0100)]
C can't just return exception classes to python to raise an exception

C can't just return exception classes to python to raise an exception, it must
instead call something like PyErr_Format().

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoDeclare RXKAD abort messages
David Howells [Fri, 11 Apr 2014 12:22:24 +0000 (13:22 +0100)]
Declare RXKAD abort messages

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Save trailing comments on error codes in .xg files for exception message
David Howells [Fri, 11 Apr 2014 12:21:28 +0000 (13:21 +0100)]
rxgen: Save trailing comments on error codes in .xg files for exception message

Save the trailing comment on an error code definition in a .xg file and attach
it to the python exception raised if a matching abort is received.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoImplement "vos listvol"
David Howells [Wed, 9 Apr 2014 23:13:39 +0000 (00:13 +0100)]
Implement "vos listvol"

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoSave raw argument list for each switch
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>
11 years agoAdd a convenience module for partition ID handling
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>
11 years agoFix "vos listaddrs" with -host
David Howells [Wed, 9 Apr 2014 23:05:16 +0000 (00:05 +0100)]
Fix "vos listaddrs" with -host

Fix "vos listaddrs" with -host to expect a host name or ip address rather than
a UUID.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Emit individual exception classes for defined abort codes and raise them
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>
11 years agoImplement "vos listaddrs"
David Howells [Wed, 9 Apr 2014 16:44:11 +0000 (17:44 +0100)]
Implement "vos listaddrs"

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Set struct members correctly in struct types
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>
11 years agorxgen: Anchor kafs.RemoteAbort class to module
David Howells [Wed, 9 Apr 2014 20:25:30 +0000 (21:25 +0100)]
rxgen: Anchor kafs.RemoteAbort class to module

Anchor the kafs.RemoteAbort exception class to module so that it can be
referred to by name from scripts.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoImplement "vos partinfo"
David Howells [Wed, 9 Apr 2014 16:24:28 +0000 (17:24 +0100)]
Implement "vos partinfo"

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoImplement 'vos listpart'
David Howells [Wed, 9 Apr 2014 14:47:36 +0000 (15:47 +0100)]
Implement 'vos listpart'

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoMove VL connection security determination into cell.py
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>
11 years agoProvide generic check for non-combinable parameters
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>
11 years agoAllow RxRPC transport security to be requested
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>
11 years ago"vos listvldb -server xxx" takes a fileserver name, not a vlserver name
David Howells [Tue, 8 Apr 2014 17:08:30 +0000 (18:08 +0100)]
"vos listvldb -server xxx" takes a fileserver name, not a vlserver name

"vos listvldb -server xxx" takes a fileserver name, not a vlserver name, so
provide a class for that and change the argument list.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoCreate 'vos listvldb' command
David Howells [Mon, 7 Apr 2014 22:41:20 +0000 (23:41 +0100)]
Create 'vos listvldb' command

11 years agorxgen: Need to align after encoding an array of bytes or a string
David Howells [Mon, 7 Apr 2014 23:22:16 +0000 (00:22 +0100)]
rxgen: Need to align after encoding an array of bytes or a string

Padding may need to be inserted after encoding an array of bytes or a string
to bring the buffer to 4-byte alignment.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoRemove unused files
David Howells [Thu, 3 Apr 2014 17:57:21 +0000 (18:57 +0100)]
Remove unused files

11 years agoMove to mostly asynchronous model and emit server side pieces
David Howells [Wed, 22 Jan 2014 00:55:24 +0000 (00:55 +0000)]
Move to mostly asynchronous model and emit server side pieces

Move to a mostly asynchronous model for sending and receiving RPC calls and
also emit server side pieces.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoAdd call to VL_ListAttribute() to test program and fix stuff
David Howells [Wed, 15 Jan 2014 13:49:36 +0000 (13:49 +0000)]
Add call to VL_ListAttribute() to test program and fix stuff

Fix the following things:

 (1) Calculation of iovecs for filling the reply data circular buffer from
     recvmsg().

 (2) Set the circular buffer tail pointer correctly when discarding extraneous
     data in the final reply decode phase when waiting for MSG_EOR.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Use the xg files as sources for rxgen
David Howells [Fri, 10 Jan 2014 01:44:40 +0000 (01:44 +0000)]
rxgen: Use the xg files as sources for rxgen

Use the Arla xg files rather than C headers as sources for the rxgen script.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoxg: More cleanups
David Howells [Fri, 10 Jan 2014 01:07:03 +0000 (01:07 +0000)]
xg: More cleanups

More cleanups to the xg files.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoxg: Reindent the xg files
David Howells [Fri, 10 Jan 2014 00:52:12 +0000 (00:52 +0000)]
xg: Reindent the xg files

Reindent the xg files to use tabs.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoxg: All integer types should be in terms of stdint
David Howells [Fri, 10 Jan 2014 00:39:44 +0000 (00:39 +0000)]
xg: All integer types should be in terms of stdint

All integer types should be in terms of stdint:

int8_t uint8_t
int16_t uint16_t
int32_t uint32_t
int64_t uint64_t

Long should not be used as it may be 32-bits or 64-bits.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoxg: Clean up Arla xg files
David Howells [Fri, 10 Jan 2014 00:13:10 +0000 (00:13 +0000)]
xg: Clean up Arla xg files

Clean up Arla xg files to remove CVS-isms and Arla-specific bits.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoImport the Arla XG files
David Howells [Fri, 10 Jan 2014 00:02:20 +0000 (00:02 +0000)]
Import the Arla XG files

Import the Arla XG files.  These are RxRPC RPC API definitions for rxgen to
turn into compilables.

They are licensed under the 3-clause BSD licence from Royal Institute of
Technology, Stockholm, Sweden, which is GPL-compatible.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoIntegrate the afs_xg.h contents back into afs.h and afs_vl.h
David Howells [Thu, 9 Jan 2014 15:59:50 +0000 (15:59 +0000)]
Integrate the afs_xg.h contents back into afs.h and afs_vl.h

Integrate the afs_xg.h contents back into afs.h and afs_vl.h and get rid of
the afs_xg.h file.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Extract C synchronous RPC func emitter
David Howells [Thu, 9 Jan 2014 14:59:13 +0000 (14:59 +0000)]
rxgen: Extract C synchronous RPC func emitter

Extract the code to emit C functions to perform synchronous RPC calls from the
main rxgen script and put into its own module.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Extract C struct marshal/unmarshal code emitter
David Howells [Thu, 9 Jan 2014 14:55:10 +0000 (14:55 +0000)]
rxgen: Extract C struct marshal/unmarshal code emitter

Extract the code to emit the code to marshal/unmarshal C structures from the
main rxgen script and put into its own perl module.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Extract py module emitter
David Howells [Thu, 9 Jan 2014 14:44:55 +0000 (14:44 +0000)]
rxgen: Extract py module emitter

Extract the code to emit the python module creation code from the main rxgen
script and put into its own perl module.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Turn the py module emitter into a perl subroutine
David Howells [Thu, 9 Jan 2014 14:41:04 +0000 (14:41 +0000)]
rxgen: Turn the py module emitter into a perl subroutine

Turn the python module defining code emitter into a perl subroutine within the
main rxgen script.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Extract py wrapper type emitter
David Howells [Thu, 9 Jan 2014 14:33:21 +0000 (14:33 +0000)]
rxgen: Extract py wrapper type emitter

Extract the code to emit python wrapper types from the main rxgen script
and put into its own module.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Extract py wrapper func emitter
David Howells [Thu, 9 Jan 2014 14:29:25 +0000 (14:29 +0000)]
rxgen: Extract py wrapper func emitter

Extract the code to emit python wrapper functions from the main rxgen script
and put into its own module.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Make lists of constants, structs and funcs global
David Howells [Thu, 9 Jan 2014 14:49:29 +0000 (14:49 +0000)]
rxgen: Make lists of constants, structs and funcs global

Make lists of constants, structs and funcs global within the rxgen perl script
and any modules it uses.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agorxgen: Move rxgen.pl to its own dir
David Howells [Thu, 9 Jan 2014 13:50:07 +0000 (13:50 +0000)]
rxgen: Move rxgen.pl to its own dir

Move rxgen.pl to its own dir so that it can be split up.

Signed-off-by: David Howells <dhowells@redhat.com>
11 years agoInitial code commit now that the VLDB lookup test python script works
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>
11 years agoInitial revision
David Howells [Wed, 8 Jan 2014 21:15:54 +0000 (21:15 +0000)]
Initial revision