ganeti-local
15 years agoFix issue when acquiring empty lock sets
Guido Trotter [Thu, 28 Aug 2008 10:29:46 +0000 (10:29 +0000)]
Fix issue when acquiring empty lock sets

By design if an empty list of locks is acquired from a set, no locks are
acquired, and thus release() cannot be called on the set. On the other
hand if None is passed instead of the list, the whole set is acquired,
and must later be released. When acquiring whole empty sets, a release
must happen too, because the set-lock is acquired.

Since we used to overwrite the required locks (needed_locks) with the
acquired ones, we weren't able to distinguish the two cases (empty list
of locks required, and all locks required, but an empty list returned
because the set is empty). Valid solutions include:
  (1) forbidding the acquire of empty lists of locks
  (2) skipping the acquire/release on empty lists of locks
  (3) separating the to-acquire and the acquired list

This patch implements the third approach, and thus LUs will find
acquired locks in the acquired_locks dict, rather than in needed_locks.
The LUs which used this feature before have been updated. This makes it
easier because it doesn't force LUs to do more checks on corner cases,
which are easily forgettable (1) and allows more flexibility if we want
LUs to release (part-of) the locks (which is still a possibly scary
operation, but anyway). This easily combines with (2) should we choose
to implement it.

Reviewed-by: imsnah

15 years agojqueue: Replace normal cache dict with weakref dict
Michael Hanselmann [Wed, 27 Aug 2008 14:52:34 +0000 (14:52 +0000)]
jqueue: Replace normal cache dict with weakref dict

A job should only exist once in memory. After the cache is cleaned,
there can still be references to a job somewhere else. If there
are multiple instances, one can get updated while a function is
waiting for changes on another instance. By using
weakref.WeakValueDictionary, which automatically removes instances as
soon as there are no strong references to it anymore, we can solve
this problem.

Reviewed-by: iustinp

15 years agojqueue: Keep timestamp of opcode start and end
Michael Hanselmann [Wed, 27 Aug 2008 14:52:16 +0000 (14:52 +0000)]
jqueue: Keep timestamp of opcode start and end

Reviewed-by: ultrotter

15 years agojqueue: Reset run_op_idx after job is done
Michael Hanselmann [Wed, 27 Aug 2008 14:48:16 +0000 (14:48 +0000)]
jqueue: Reset run_op_idx after job is done

It can be confusing otherwise.

Reviewed-by: ultrotter

15 years agoAnother burnin fix
Iustin Pop [Wed, 27 Aug 2008 10:05:34 +0000 (10:05 +0000)]
Another burnin fix

This is a result of the log timestamp changes.

Reviewed-by: imsnah

15 years agoFix a small typo in a constant
Iustin Pop [Wed, 27 Aug 2008 09:55:12 +0000 (09:55 +0000)]
Fix a small typo in a constant

Seems noone ran a burnin lately :)

Reviwed-by: amischenko,ultrotter

15 years agoMake sure that client programs get all messages
Michael Hanselmann [Wed, 27 Aug 2008 08:34:17 +0000 (08:34 +0000)]
Make sure that client programs get all messages

This is a large patch, but I can't figure out how to split it without
breaking stuff. The old way of getting messages by always getting the
last one didn't bring all messages to the client if they were added
too fast, thereby making commands like “gnt-cluster verify” less than
useful. These changes now introduce some sort a serial number per
log entry to keep track what message a client already received. They
also remove the log lock per opcode to make reading log entries thread
safe.

Reviewed-by: ultrotter

15 years agoQA: Use pseudo-tty via SSH
Michael Hanselmann [Tue, 26 Aug 2008 15:53:22 +0000 (15:53 +0000)]
QA: Use pseudo-tty via SSH

This gives continous output instead it being buffered.

Reviewed-by: ultrotter

15 years agoAdd simple lock debug output
Michael Hanselmann [Tue, 26 Aug 2008 15:44:34 +0000 (15:44 +0000)]
Add simple lock debug output

Currently it can only be enabled by modifying utils.py, but we can
add a command line parameter later if needed.

Reviewed-by: schreiberal

15 years agoUse python2.4 when developing
Michael Hanselmann [Mon, 25 Aug 2008 14:57:05 +0000 (14:57 +0000)]
Use python2.4 when developing

Reviewed-by: ultrotter

15 years agoRemove references to YAML
Michael Hanselmann [Mon, 25 Aug 2008 14:56:47 +0000 (14:56 +0000)]
Remove references to YAML

I forgot to remove these when converting the QA configuration from YAML
to JSON.

Reviewed-by: ultrotter

15 years agoAdd vim modeline to qa-sample.json
Michael Hanselmann [Tue, 19 Aug 2008 12:17:18 +0000 (12:17 +0000)]
Add vim modeline to qa-sample.json

Vim doesn't recognize the format automatically.

Reviewed-by: ultrotter

15 years agoParallelize LUQueryNodes
Guido Trotter [Mon, 18 Aug 2008 12:51:58 +0000 (12:51 +0000)]
Parallelize LUQueryNodes

As for LUQueryInstances the first version just acquires a shared lock on all
nodes. In the future further optimizations are possible, as outlined by
comments in the code.

Reviewed-by: imsnah

15 years agoParallelize LUQueryInstances
Guido Trotter [Mon, 18 Aug 2008 12:51:35 +0000 (12:51 +0000)]
Parallelize LUQueryInstances

This first version acquires a shared lock on all requested instances and
their nodes. In the future it can be improved by acquiring less locks if
no dynamic fields have been asked, and/or by locking just primary nodes.

Reviewed-by: imsnah

15 years agoA few more locking unit tests
Guido Trotter [Mon, 18 Aug 2008 12:51:13 +0000 (12:51 +0000)]
A few more locking unit tests

A few more tests written while bug-hunting. One of them shows a real
issue, at last. :)

Reviewed-by: imsnah

15 years agoAdd lock-all-through-GLM unit test
Guido Trotter [Mon, 18 Aug 2008 12:50:41 +0000 (12:50 +0000)]
Add lock-all-through-GLM unit test

I was hunting for a bug in my code and thought the culprit was in the
locking library, so I added a test to check. Unfortunately turns out it
wasn't. :( Committing the test anyway, while still trying to figure out
what's wrong...

Reviewed-by: imsnah

15 years agoLockSet: allow lists with duplicate values
Guido Trotter [Mon, 18 Aug 2008 12:50:22 +0000 (12:50 +0000)]
LockSet: allow lists with duplicate values

If a list with a duplicate value is passed to a lockset what the code
now does is to try to acquire the lock twice, generating a
double-acquire exception in the SharedLock code. This is definitely an
issue. In order to solve it we can either forbit double values in a list
or just delete the duplicates. In this patch we go for the latter
solution, removing any duplicate values when creating the acquire_list.

Reviewed-by: imsnah

15 years agoProcessor: lock all levels even if one is missing
Guido Trotter [Mon, 18 Aug 2008 12:49:59 +0000 (12:49 +0000)]
Processor: lock all levels even if one is missing

If a locking level wasn't specified locking used to stop. This means
that if one, for example, didn't specify anything at the LEVEL_INSTANCE
level, no locks at the LEVEL_NODE level were acquired either. With this
patch we force _LockAndExecLU to be called for all existing levels, and
break the recursion if the level doesn't exist in locking.LEVELS.

Reviewed-by: imsnah

15 years agoLURebootInstance: move arg check in ExpandNames
Guido Trotter [Mon, 18 Aug 2008 12:44:22 +0000 (12:44 +0000)]
LURebootInstance: move arg check in ExpandNames

The check for the reboot type can be done without any locks held, so
we'll move it to ExpandNames. Plus, we note in a FIXME that if the
reboot type is not full, we can probably just lock the primary node, and
leave the secondary unlocked.

Reviewed-by: imsnah

15 years agoQA: Convert configuration from YAML to JSON
Michael Hanselmann [Mon, 18 Aug 2008 11:37:55 +0000 (11:37 +0000)]
QA: Convert configuration from YAML to JSON

We no longer use YAML in Ganeti at all. This patch converts the QA
configuration from YAML to JSON. JSON doesn't support comments and
I had to use a hack with fields starting with '#'.

Reviewed-by: ultrotter

15 years agoLUVerifyCluster: Return boolean indication success
Michael Hanselmann [Mon, 18 Aug 2008 11:37:19 +0000 (11:37 +0000)]
LUVerifyCluster: Return boolean indication success

Reviewed-by: schreiberal

15 years agoUse Linux-specific way to name master socket
Michael Hanselmann [Mon, 18 Aug 2008 11:12:06 +0000 (11:12 +0000)]
Use Linux-specific way to name master socket

By using this Linux-specific way we don't have to care about removing the
socket file when quitting or starting (after an unclean shutdown). For a
more detailed description, see the comment in the patch.

Reviewed-by: schreiberal

15 years agoQA: Try to run more scripts with --version
Michael Hanselmann [Mon, 18 Aug 2008 10:51:42 +0000 (10:51 +0000)]
QA: Try to run more scripts with --version

This patch also sorts the list.

Reviewed-by: schreiberal

15 years agoQA: Always accept added node's SSH key
Michael Hanselmann [Mon, 18 Aug 2008 10:17:25 +0000 (10:17 +0000)]
QA: Always accept added node's SSH key

Reviewed-by: ultrotter

15 years agoQA: Do not upload known_hosts file anymore
Michael Hanselmann [Mon, 18 Aug 2008 09:59:00 +0000 (09:59 +0000)]
QA: Do not upload known_hosts file anymore

The cluster no longer keeps individual host's SSH key, but rather
aliases all of them to the cluster name.

Reviewed-by: ultrotter

15 years agoCopy qa_utils.AssertIn from 1.2 branch
Michael Hanselmann [Mon, 18 Aug 2008 09:58:11 +0000 (09:58 +0000)]
Copy qa_utils.AssertIn from 1.2 branch

Apparently it was forgotten when import the remote API QA tests.

Reviewed-by: schreiberal

15 years agognt-node: Add option to always accept peer's SSH key
Michael Hanselmann [Fri, 15 Aug 2008 08:55:09 +0000 (08:55 +0000)]
gnt-node: Add option to always accept peer's SSH key

This option will be used to add nodes to the cluster without
asking the user to confirm the key. Together with key based
authentication this can be used in the QA tests.

Reviewed-by: ultrotter

15 years agoSshRunner: Add parameter to always accept peer's SSH key
Michael Hanselmann [Fri, 15 Aug 2008 08:47:02 +0000 (08:47 +0000)]
SshRunner: Add parameter to always accept peer's SSH key

This will be used to add nodes without user interaction, specifically
in QA tests.

Reviewed-by: ultrotter

15 years agoMove SSH option building into a function
Michael Hanselmann [Fri, 15 Aug 2008 08:44:29 +0000 (08:44 +0000)]
Move SSH option building into a function

I'm going to add another option and it would make maintaining
them in constants even more complicated.

Reviewed-by: ultrotter

15 years agoSshRunner.Run: Pass all arguments to BuildCmd
Michael Hanselmann [Fri, 15 Aug 2008 08:44:11 +0000 (08:44 +0000)]
SshRunner.Run: Pass all arguments to BuildCmd

This patch changes SshRunner.Run to pass all arguments to
SshRunner.BuildCmd. They had the same arguments before
and should stay that way. This change makes it easier
to add new or change existing arguments.

Reviewed-by: ultrotter

15 years agoWhitespace fixes for remote API QA checks
Michael Hanselmann [Fri, 15 Aug 2008 08:43:45 +0000 (08:43 +0000)]
Whitespace fixes for remote API QA checks

Reviewed-by: ultrotter

15 years agoRemove QA hook functionality
Michael Hanselmann [Fri, 15 Aug 2008 08:43:15 +0000 (08:43 +0000)]
Remove QA hook functionality

To my knowledge they're used nowhere and it's at least slightly
confusing to people adding new QA checks.

Reviewed-by: ultrotter

15 years agoPass hypervisor type to the OS scripts
Guido Trotter [Thu, 14 Aug 2008 10:27:07 +0000 (10:27 +0000)]
Pass hypervisor type to the OS scripts

It's handy to make the os scripts know which hypervisor the instance is
going to run under. In order not to change the os API we pass this
information in the environment, where the os scripts can access it if
they're hypervisor-aware.

Reviewed-by: imsnah

15 years agoRunCmd: add optional environment overriding
Guido Trotter [Thu, 14 Aug 2008 10:26:44 +0000 (10:26 +0000)]
RunCmd: add optional environment overriding

If the user passes an env dict to RunCmd we'll override the environment
passed to the to-be-executed command with the values in the dict. This
allows us to pass arbitrary environment values to commands we run.

Reviewed-by: imsnah

15 years agoKVM Hypervisor Cleanup
Guido Trotter [Wed, 13 Aug 2008 16:41:08 +0000 (16:41 +0000)]
KVM Hypervisor Cleanup

- Remove a few experiemental code lines left as comments
- Rework first disks' boot=on addition, which was calculated twice
- Remove an empty line
- Remove reference to hvm_pae which doesn't apply to kvm

Reviewed-by: imsnah

15 years agoAllow kvm hypervisor in gnt-cluster init
Guido Trotter [Wed, 13 Aug 2008 14:25:53 +0000 (14:25 +0000)]
Allow kvm hypervisor in gnt-cluster init

Reviewed-by: imsnah

15 years agoAdd KVM hypervisor code
Guido Trotter [Wed, 13 Aug 2008 14:25:24 +0000 (14:25 +0000)]
Add KVM hypervisor code

ht_kvm.py contains the code for ganeti to work under kvm.
This patch also modifies Makefile.am to ship that file, and
lib/hypervisor/__init__.py to import it, and add kvm to the
hypervisors map.

Reviewed-by: imsnah

15 years agoconstants: add HT_KVM
Guido Trotter [Wed, 13 Aug 2008 14:25:01 +0000 (14:25 +0000)]
constants: add HT_KVM

Add a new hypervisor type, HT_KVM, to constants, and register it in the
HYPER_TYPES set.

Reviewed-by: imsnah

15 years agoAdd --with-kvm-path configure option
Guido Trotter [Wed, 13 Aug 2008 14:24:36 +0000 (14:24 +0000)]
Add --with-kvm-path configure option

This allows to configure a different path to the kvm binary. By default
/usr/bin/kvm is used, which is the one found in debian and ubuntu.

Reviewed-by: imsnah

15 years agoFakeHypervisor: fix a function signature
Guido Trotter [Wed, 13 Aug 2008 14:24:15 +0000 (14:24 +0000)]
FakeHypervisor: fix a function signature

StartInstance takes 'block_devices', not 'force' as its third argument.
Even if this is not used in the fake hypervisor it's better to have the
correct argument name to avoid confusion.

Reviewed-by: imsnah

15 years agoConvert RunCmd to an epydoc docstring
Guido Trotter [Wed, 13 Aug 2008 14:23:55 +0000 (14:23 +0000)]
Convert RunCmd to an epydoc docstring

Reviewed-by: imsnah

15 years agoFix adding pristine nodes
Michael Hanselmann [Wed, 13 Aug 2008 12:55:58 +0000 (12:55 +0000)]
Fix adding pristine nodes

If a node hasn't been part of the cluster before being added it'll not
have the cluster's SSH key. This patch makes sure to accept those by
not aliasing the machine name to the cluster name.

Reviewed-by: ultrotter

15 years agoFix race locking issue in noded
Michael Hanselmann [Tue, 12 Aug 2008 17:00:19 +0000 (17:00 +0000)]
Fix race locking issue in noded

Noded didn't release the job queue lock after initialising it. This
patch makes sure to unlock once the work is done.

Reviewed-by: ultrotter

15 years agocli: Use new RPC call instead of polling
Michael Hanselmann [Mon, 11 Aug 2008 16:28:08 +0000 (16:28 +0000)]
cli: Use new RPC call instead of polling

This means commands will not take at least one second anymore.

Reviewed-by: ultrotter

15 years agoAdd RPC call to wait for job changes
Michael Hanselmann [Mon, 11 Aug 2008 16:27:45 +0000 (16:27 +0000)]
Add RPC call to wait for job changes

This way clients can react faster to status or message changes and
don't have to poll anymore.

Reviewed-by: ultrotter

15 years agojqueue: Change log message time format
Michael Hanselmann [Mon, 11 Aug 2008 16:27:14 +0000 (16:27 +0000)]
jqueue: Change log message time format

See the comment in the patch.

Reviewed-by: ultrotter

15 years agoAdd functions to split time into tuple and merge it back
Michael Hanselmann [Mon, 11 Aug 2008 16:26:18 +0000 (16:26 +0000)]
Add functions to split time into tuple and merge it back

These will be used for job logs.

Reviewed-by: ultrotter

15 years agoUse new query function for exports in gnt-backup
Michael Hanselmann [Fri, 8 Aug 2008 11:29:49 +0000 (11:29 +0000)]
Use new query function for exports in gnt-backup

Reviewed-by: iustinp

15 years agoAdd query function for exports
Michael Hanselmann [Fri, 8 Aug 2008 11:29:20 +0000 (11:29 +0000)]
Add query function for exports

Reviewed-by: iustinp

15 years agoDon't always remove queue lock when queue is purged
Michael Hanselmann [Fri, 8 Aug 2008 11:23:17 +0000 (11:23 +0000)]
Don't always remove queue lock when queue is purged

The lock should only be removed if ganeti-noded is going to quit.
Otherwise it needs to be kept to prevent another process from creating
it again while we're still holding the (removed) lock. This is due to
POSIX filesystem semantics.

Reviewed-by: iustinp

15 years agobackend: Add optional exclusion list to _CleanDirectory
Michael Hanselmann [Fri, 8 Aug 2008 11:22:56 +0000 (11:22 +0000)]
backend: Add optional exclusion list to _CleanDirectory

The code cleaning the queue will make use of it.

Reviewed-by: iustinp

15 years agojqueue: Move archived jobs on all nodes
Michael Hanselmann [Fri, 8 Aug 2008 11:21:59 +0000 (11:21 +0000)]
jqueue: Move archived jobs on all nodes

Otherwise one might have archived jobs back in the list after a master
failover.

Reviewed-by: iustinp

15 years agonoded: Add RPC function to rename job queue files
Michael Hanselmann [Fri, 8 Aug 2008 11:21:35 +0000 (11:21 +0000)]
noded: Add RPC function to rename job queue files

This will be used to archive jobs.

Reviewed-by: iustinp

15 years agobackend: Add function to check whether file is in queue dir
Michael Hanselmann [Fri, 8 Aug 2008 11:21:00 +0000 (11:21 +0000)]
backend: Add function to check whether file is in queue dir

Another function will need to check whether its parameters
are job queue files.

Reviewed-by: iustinp

15 years agonoded: Add decorator for job queue lock
Michael Hanselmann [Fri, 8 Aug 2008 11:20:38 +0000 (11:20 +0000)]
noded: Add decorator for job queue lock

The lock will also be needed by another function.

Reviewed-by: iustinp

15 years agoTwo small style fixes
Michael Hanselmann [Fri, 8 Aug 2008 11:19:50 +0000 (11:19 +0000)]
Two small style fixes

Reviewed-by: iustinp

15 years agoImplement queue locking in node daemon
Michael Hanselmann [Fri, 8 Aug 2008 10:03:49 +0000 (10:03 +0000)]
Implement queue locking in node daemon

Reviewed-by: iustinp

15 years agojstore: Change to not always require a lock
Michael Hanselmann [Fri, 8 Aug 2008 10:03:27 +0000 (10:03 +0000)]
jstore: Change to not always require a lock

This way we can do locking when both noded and masterd are running
on the same machine, the latter holding an exclusive lock on the
queue.

Reviewed-by: iustinp

15 years agoMore logging for errors during noded RPC calls
Michael Hanselmann [Fri, 8 Aug 2008 10:02:58 +0000 (10:02 +0000)]
More logging for errors during noded RPC calls

Reviewed-by: iustinp

15 years agoLog only unexpected errors in utils.FileLock
Michael Hanselmann [Fri, 8 Aug 2008 10:02:38 +0000 (10:02 +0000)]
Log only unexpected errors in utils.FileLock

Otherwise users might be confused by errors in log files.

Reviewed-by: iustinp

15 years agoDisallow uploading job queue files through upload_file
Michael Hanselmann [Fri, 8 Aug 2008 10:02:14 +0000 (10:02 +0000)]
Disallow uploading job queue files through upload_file

The job queue is now updated through its own RPC functions.

Reviewed-by: iustinp

15 years agojqueue: Use new job queue RPC functions
Michael Hanselmann [Fri, 8 Aug 2008 10:01:49 +0000 (10:01 +0000)]
jqueue: Use new job queue RPC functions

Reviewed-by: iustinp

15 years agoAdd job queue RPC functions
Michael Hanselmann [Fri, 8 Aug 2008 10:01:28 +0000 (10:01 +0000)]
Add job queue RPC functions

jobqueue_update: Uploads a job queue file's content to a node. The
most common operation is to upload something that we already have
in a string. Unlike in the upload_file function, the file is not
read again when distributing changes, but content has to be passed
as a string.

jobqueue_purge: Removes all queue related files from a node.

Reviewed-by: iustinp

15 years agoMove function cleaning directory to module level
Michael Hanselmann [Fri, 8 Aug 2008 10:00:59 +0000 (10:00 +0000)]
Move function cleaning directory to module level

JobQueuePurge() will be used by an RPC function.

Reviewed-by: iustinp

15 years agoUse API instead of command line utilities in watcher
Michael Hanselmann [Thu, 7 Aug 2008 13:03:45 +0000 (13:03 +0000)]
Use API instead of command line utilities in watcher

Reviewed-by: iustinp

15 years agoFix cli.PollJob
Michael Hanselmann [Thu, 7 Aug 2008 09:07:27 +0000 (09:07 +0000)]
Fix cli.PollJob

feedback_fn wasn't passed to it.

Reviewed-by: iustinp

15 years agoNotify job queue about added/removed nodes
Michael Hanselmann [Wed, 6 Aug 2008 14:56:26 +0000 (14:56 +0000)]
Notify job queue about added/removed nodes

The job queue maintains its own node list and must be notified
when nodes are added/removed.

Reviewed-by: iustinp

15 years agoImplement {Add,Readd,Remove}Node in GanetiContext
Michael Hanselmann [Wed, 6 Aug 2008 14:56:10 +0000 (14:56 +0000)]
Implement {Add,Readd,Remove}Node in GanetiContext

By doing this we've a central place which coordinates what needs to be
done when adding or removing nodes. Another patch will add calls into
the job queue.

Two log messages move to config.py.

When removing a node, node_leave_cluster is now called after it has
been removed from the configuration and job manager. That way we're
sure not to access the node again after files have been removed.

Reviewed-by: iustinp

15 years agojqueue: Implement {Add,Remove}Node
Michael Hanselmann [Wed, 6 Aug 2008 13:36:23 +0000 (13:36 +0000)]
jqueue: Implement {Add,Remove}Node

These functions will be used to notify the queue about newly added
or removed nodes.

Reviewed-by: iustinp

15 years agojqueue: Don't pass the list of nodes to SubmitJob anymore
Michael Hanselmann [Wed, 6 Aug 2008 13:35:59 +0000 (13:35 +0000)]
jqueue: Don't pass the list of nodes to SubmitJob anymore

The job queue now maintains its own list and is updated when
nodes are added or removed from the cluster.

Reviewed-by: iustinp

15 years agoMaintain node list in job queue
Michael Hanselmann [Wed, 6 Aug 2008 13:35:38 +0000 (13:35 +0000)]
Maintain node list in job queue

The code makes sure not to include the master in the list.

Reviewed-by: iustinp

15 years agomasterd: Move job queue into context object
Michael Hanselmann [Wed, 6 Aug 2008 13:35:22 +0000 (13:35 +0000)]
masterd: Move job queue into context object

The job queue must be called from cmdlib when adding or removing
nodes to the cluster. Moving it to the context objects makes
this possible.

Reviewed-by: iustinp

15 years agoClean job queue directories when leaving cluster
Michael Hanselmann [Wed, 6 Aug 2008 11:27:41 +0000 (11:27 +0000)]
Clean job queue directories when leaving cluster

Old job files shouldn't be left on nodes removed from a cluster.

Reviewed-by: iustinp

15 years agoUse new RPC call in “gnt-node list”
Michael Hanselmann [Wed, 6 Aug 2008 08:28:06 +0000 (08:28 +0000)]
Use new RPC call in “gnt-node list”

Reviewed-by: iustinp

15 years agoImplement query for nodes
Michael Hanselmann [Wed, 6 Aug 2008 08:26:01 +0000 (08:26 +0000)]
Implement query for nodes

Reviewed-by: iustinp

15 years agoUse new query RPC call in “gnt-instance list”
Michael Hanselmann [Wed, 6 Aug 2008 08:25:31 +0000 (08:25 +0000)]
Use new query RPC call in “gnt-instance list”

Reviewed-by: iustinp

15 years agoImplement query for instances
Michael Hanselmann [Wed, 6 Aug 2008 08:25:03 +0000 (08:25 +0000)]
Implement query for instances

Queries don't create jobs and are more efficient. Log messages
are not yet stored anywhere.

Reviewed-by: iustinp

15 years agojqueue: Replicate jobs to all nodes
Michael Hanselmann [Tue, 5 Aug 2008 10:33:08 +0000 (10:33 +0000)]
jqueue: Replicate jobs to all nodes

Newly added nodes are not yet taken care of. Queue locking on
non-master nodes is not yet correct.

Reviewed-by: iustinp

15 years agojqueue: Use new jstore module
Michael Hanselmann [Mon, 4 Aug 2008 12:27:18 +0000 (12:27 +0000)]
jqueue: Use new jstore module

Reviewed-by: iustinp

15 years agojstore: Add queue helper functions
Michael Hanselmann [Mon, 4 Aug 2008 12:27:01 +0000 (12:27 +0000)]
jstore: Add queue helper functions

This will be used to move common code out of jqueue.

Reviewed-by: iustinp

15 years agoImplement job submission for scripts
Iustin Pop [Mon, 4 Aug 2008 09:47:08 +0000 (09:47 +0000)]
Implement job submission for scripts

This patch adds the infrastructure for executing a job in background,
instead of foreground, via a new “--submit” option. The behaviour is
that the job ID is printed and the script will immediately exit.

The patch also converts gnt-node list to this model (yes, this will be a
query in the future).

Reviewed-by: imsnah

15 years agoAnother typo in the install doc
Iustin Pop [Mon, 4 Aug 2008 09:14:31 +0000 (09:14 +0000)]
Another typo in the install doc

Reviewed-by: imsnah

15 years agoUpdate the module build section of install doc
Iustin Pop [Mon, 4 Aug 2008 09:14:16 +0000 (09:14 +0000)]
Update the module build section of install doc

Reviewed-by: imsnah

15 years agojqueue: Move assert into decorator
Michael Hanselmann [Thu, 31 Jul 2008 15:03:13 +0000 (15:03 +0000)]
jqueue: Move assert into decorator

This reduces code duplication. A later patch will modify the job queue
a bit more and will need a change of this assert. The assertion is
also removed from all class-internal functions.

Reviewed-by: iustinp

15 years agoSplit cli.SubmitOpCode in two parts
Iustin Pop [Thu, 31 Jul 2008 14:52:04 +0000 (14:52 +0000)]
Split cli.SubmitOpCode in two parts

The current SubmitOpCode function is not flexible enough to be used for
submitters that don't want to wait for the job finish.

The patch splits this in two, a SendJob function and a PollJob one, and
the old SubmitOpCode becomes a wrapper. Note that the new SendJob takes
a list of opcodes (and not a single opcode anymore).

Reviewed-by: imsnah

15 years agoAllow job queue files to be uploaded through ganeti-noded
Michael Hanselmann [Thu, 31 Jul 2008 14:42:11 +0000 (14:42 +0000)]
Allow job queue files to be uploaded through ganeti-noded

This is needed for job queue replication.

Reviewed-by: iustinp

15 years agoAdd FileLock utility class
Michael Hanselmann [Thu, 31 Jul 2008 14:33:58 +0000 (14:33 +0000)]
Add FileLock utility class

This class is a wrapper around fcntl.flock and abstracts opening and
closing the lockfile. It'll used for the job queue.

(The patch also removes a duplicate import of tempfile into the unittest)

Reviewed-by: iustinp

15 years agojqueue: Store context in job queue instead of worker pool
Michael Hanselmann [Thu, 31 Jul 2008 14:33:36 +0000 (14:33 +0000)]
jqueue: Store context in job queue instead of worker pool

The job queue will need to access to configuration, which is provided
through the context object, to get a list of nodes.

Reviewed-by: iustinp

15 years agoRAPI Implement DELETE for tags
Oleksiy Mishchenko [Thu, 31 Jul 2008 12:58:55 +0000 (12:58 +0000)]
RAPI Implement DELETE for tags

Reviewed-by: imsnah

15 years agoFirst write operation (add tag) for Ganeti RAPI
Oleksiy Mishchenko [Thu, 31 Jul 2008 09:06:37 +0000 (09:06 +0000)]
First write operation (add tag) for Ganeti RAPI

Add instance tag handling, improved error logging.
...oh, yes adopt instance listing for RAPI2!

Reviewed-by: iustinp

15 years agoFix cluster destroy
Iustin Pop [Wed, 30 Jul 2008 15:58:28 +0000 (15:58 +0000)]
Fix cluster destroy

With the recent startup/shutdown changes (and with the master daemon in
place), the cluster destroy needs some fixing.

This patch moves the finalization of the destroy out from cmdlib into
bootstrap, so we can nicely shutdown the rapi and master daemons.

Reviewed-by: ultrotter

15 years agoXen: remove two end-of-line semicolons
Guido Trotter [Wed, 30 Jul 2008 15:49:05 +0000 (15:49 +0000)]
Xen: remove two end-of-line semicolons

It's python, isn't it?

Reviewed-by: iustinp

15 years agoFix cluster init
Iustin Pop [Wed, 30 Jul 2008 15:17:58 +0000 (15:17 +0000)]
Fix cluster init

With the recent changes, I forgot the extra parameter to this rpc call.
Also the rpc call needs to be done after we setup the config data, for
the master daemon to be able to start, so we move it after all other
init steps.

Reviewed-by: ultrotter

15 years agoMake gnt-* commands fail nicely on non-masters
Iustin Pop [Wed, 30 Jul 2008 15:06:01 +0000 (15:06 +0000)]
Make gnt-* commands fail nicely on non-masters

This patch adds a check that we are on the master after failing to
connect to the socket, and log nicely the master name.

Reviewed-by: ultrotter

15 years agoParallelize LUFailoverInstance
Guido Trotter [Wed, 30 Jul 2008 15:04:48 +0000 (15:04 +0000)]
Parallelize LUFailoverInstance

Reviewed-by: iustinp

15 years agoChainOpCode is still BGL-only
Guido Trotter [Wed, 30 Jul 2008 15:04:27 +0000 (15:04 +0000)]
ChainOpCode is still BGL-only

Prevent mistakes with an assert.

Reviewed-by: iustinp

15 years agoFix a misuse of exc_info in logging.info
Iustin Pop [Wed, 30 Jul 2008 15:00:54 +0000 (15:00 +0000)]
Fix a misuse of exc_info in logging.info

This is my fault, sorry.

Reviewed-by: imsnah

15 years agoFix pylint-detected issues
Iustin Pop [Wed, 30 Jul 2008 14:04:36 +0000 (14:04 +0000)]
Fix pylint-detected issues

This is mostly:
  - whitespace fix (space at EOL in some files, not all, broken
    indentation, etc)
  - variable names overriding others (one is a real bug in there)
  - too-long-lines
  - cleanup of most unused imports (not all)

Reviewed-by: ultrotter

15 years agoFix some errors detected by pylint
Iustin Pop [Wed, 30 Jul 2008 13:27:25 +0000 (13:27 +0000)]
Fix some errors detected by pylint

Reviewed-by: imsnah

15 years agoUnify SetupDaemon/SetupLogging
Iustin Pop [Wed, 30 Jul 2008 12:32:42 +0000 (12:32 +0000)]
Unify SetupDaemon/SetupLogging

The 'old-style' info, error, debug logs do not make much sense. This
patch unifies the SetupLogging and SetupDaemon functions. As a result,
all the commands logs to a 'commands.log' file.

The patch also changes the log setup to keep going if there's an error
in setting up the file logging but we're logging to stderr.

Also, burnin now logs to its own file (burnin.log).

Reviewed-by: ultrotter