Provide a function to determine whether a job is finalized

While there is a function to calculate the job status, sometimes
it is only relevant if the job is finalized. In this case, it is
more readable not having to know the internal order of JobStatus.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Use the jobFinalized predicate in JQScheduler

...to improve readability.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Export getFStat from Utils

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add a predicate to determine if a job has been started

Add a predicate jobs indicated that it has left the queue. This
will be needed, to allow restarts of luxid (which now handles
the queue) independent of jobs (currently running in masterd).

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Remove queue inspection from masterd

When masterd was responsible for queue handling, it would, on
restart, pick up all non-started jobs from the queue. Now that
luxid is responsible for handling the queue, make masterd not
do this any more.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Make luxid inspect the job queue on startup

Since luxid handled the scheduling, make luxid also read the queue
upon restart. In this way, jobs get scheduled in the same way, independent
of luxid restarts.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Design: Improvements of Node Security

This is a design doc addressing issue 377. Objective is
to reduce the number of nodes that are able to establish
ssh and RPC connections to other nodes. Limiting this
set of nodes to the master candidates is desired to
decrease the risk of a compromised node compromising the
entire cluster.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Gluster: Update design document

Anticipate and explain the choices made in the Gluster patch series.
Remove parts about a possible way of supporting userspace access as
it has been implemented otherwise.
bdev: Fix position of DEV_MAP

This rather important dictionary from constants to classes was hiding
between function definitions. The dict cannot go to the top of the file
as the classes haven't been defined there yet, so it's been pushed
to the bottom of the file.

For bonus points, the dict gets an epydoc docstring and a comment, too.
ComputeLDParams: do not spell out disk templates unnecessarily

A large part of the complexity in this function is due to the need
to translate from "template-specific" parameter names to
"template-agnostic" parameter names. This logic is complex and having
complex code for complex logic is okay.

However, for all other cases, the additional complexity is not needed.
Additionally this function would do the wrong thing silently for new,
unhandled disk templates by just not changing the resulting paramters.

This commit replaces the ad-hoc logic with a more generally useful
logic while leaving the DRBD code carefully alone.
PathJoin: improve error message when given one argument

PathJoin fails with an unclear message if only one argument is passed
to it. Calling PathJoin("/foo") causes this exception:

    Error: path joining resulted in different prefix (/foo != /foo)

However, /foo and /foo obviously share prefixes: what this function
really checks is that the resulting path should be inside the first
argument and, in that sense, /foo is not a "real" prefix of /foo.

Given that PathJoin already asserts that it received any arguments
at all, this commit discards the assertion for an error to be raised
if 0 or 1 arguments are received. The semantics don't change, but
the error message is clearer.
FileStorage: move to filesstorage.py

Move the FileStorage class in its own file, together with its helper
functions.
FileStorage: extract file logic to a FileDeviceHelper object

This will allow code reuse for Gluster through composition, rather
than inheritance.
netutils: Add ValidatePortNumber method

This method accepts a port number and checks that it is in fact valid.
Gluster: minimal implementation

Add Gluster to Ganeti by essentially cloning the shared file behaviour
everywhere in the code base.
Gluster: add GlusterVolume class

This commit teaches Gluster what a volume is and how to use it.
ssconf: Add Gluster mount directory

This commit adds the gluster storage directory to ssconf (without
actually using its value just yet).
Gluster: use ssconf value for mountpoint directory

Gluster still does not mount anything autonomously, but this commit
changes where Gluster expects its mountpoint to be.
Gluster: mount automatically

Add parameters to the Gluster disk template so Gluster can manage the
mount point point autonomously.
Gluster: add userspace access support

Add support for the QEMU gluster: protocol. Also change the access
mode routines so they check the access parameter for all templates.