Fix integer parsing of spindles in gnt-instance add

'gnt-instance' did not parse the spindles value to integer
before submitting the opcode.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Design details of the implementation of new WConfD daemon

Describes steps needed to implement the new configuration and locks
management.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Document the jobqueue timestamp format

...and also provide a method to get the current time in
that format.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Provide a function to set the received times tamp of a job

This is the pure function for changing the received time stamp;
obtaining the actual time stamp has to be done in IO.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Set the received time stamp for new jobs

Since luxid now handles the job submission requests, it is also
its responsibility to set the received time stamps. Do this.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Activate QA for rapi queries via luxi

This patch enables QA testing for rapi queries for the
newly transformed queries from python to haskell
(groups, instances, nodes, export, and networks). So far,
the QA did not distinguish between resources that cannot be
queried with PUT requests, hence an additional distinction
between luxi-able and luxi-and-put-able resources was
necessary.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Fix missing '@raise' in docstring of 'StopInstance'

Fix missing '@raise' in docstring of 'StopInstance'.

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Destroy Xen domain only if necessary

Check if a given Xen domain still exists after a 'xm shutdown' before
destroying it.  This check is necessary in order to cope with Xen
domains created with other version of Ganeti, given that an instance
created in or prior to Ganeti 2.10 will be cleaned up automatically
and thus calling 'xm destroy' is unnecessary and will lead to an
error, whereas instances from the more recent versions of Ganeti do
require 'xm destroy' as it is part of the instance shutdown detection
feature.

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Use query client for instance removal

This patch fixes another occurrence of triggering queries
with a non-query client.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Remove parseUnit for spindles

In patch e33c9e6881e6, it was a bit overkill to use
parseUnit for converting the 'spindles' value since it is
only an int without a unit. This patch fixes that.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Modify --mond to yes|no option

Modify --mond option used by hail, hbal and hinfo from non
argument to yes|no option.

Signed-off-by: Spyros Trigazis <strigazi@gmail.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Add default_iallocator_params cluster parameter

Add a cluster parameter to hold the iallocator parameters used
by the default instance allocator. Implement the option to
modify config.data, query config.data and upgrade man pages,
tests and cfgupgrade tool. The new default_iallocator_params is
an empty dict by default.

Signed-off-by: Spyros Trigazis <strigazi@gmail.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Parse spindles as integers

When parsing disk parameters, also convert spindles into integers.
This is needed to obtain a syntactically correct request.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Add LUXID_ARGS to defaults/ganeti

luxid accepts arguments as well.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
design: scheduling will be simple in the first iteration

In order to progress faster towards jobs as processes, the decision on
the final scheduling algorithm will be postponed. For the time being,
the simple one will be used that starts jobs until a fixed maximal
number of running jobs is reached. This postponing also has the
advantage that the final decision can be based on experience with the
characteristics of jobs as processes under realistic load.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Rename enqueueJobs to startJobs

This reflects better what the method actually does. Later,
we will add a job scheduler that will provide a proper enqueue
method.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Move FStat related function to Utils

In this way, the functions to to decide, based on fstat, whether
a file needs to be reloaded can used by other parts as well,
in particular to monitor progress in the job queue.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Add a scheduler to keep track of the job queue

In order to allow informed decissions on when to start a job,
it is necessary for luxid to keep track of the (active part
of the) job queue. Add a scheduler, similar to the config reader,
that does this, but also schedules jobs to be executed. At the
moment this is just the simple mechanism of starting jobs until
a fixed number of running jobs is reached.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Make luxid use the JQScheduler

Make luxid use the job scheduler instead of immediately
starting every received job.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Differentiate watchers in luxid

luxid has two time-based watcher threads, one for the
configuration, and one for the job queue. To improve readability
of the debug output, make both watcher use a different debug
message when the timer fires.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Jose Lopes <jabolopes@google.com>