ganeti-local
15 years agoAdd simple configuration reader/writer classes
Michael Hanselmann [Wed, 1 Oct 2008 17:33:18 +0000 (17:33 +0000)]
Add simple configuration reader/writer classes

This will be used to read the configuration file in the node daemon.
The write functionality is needed for master failover.

Reviewed-by: iustinp

15 years agoFix the watcher with down nodes
Iustin Pop [Wed, 1 Oct 2008 09:27:27 +0000 (09:27 +0000)]
Fix the watcher with down nodes

The watcher didn't handle the down nodes, fix this by ignoring (in
secondary node reboot checks) any node that doesn't return a boot id.

Reviewed-by: imsnah

15 years agoFix the watcher not restarting instance bug
Iustin Pop [Wed, 1 Oct 2008 09:27:17 +0000 (09:27 +0000)]
Fix the watcher not restarting instance bug

The watcher was using conflicting attributes of the instance:
  - it queried the admin_/oper_state, which are booleans
  - but it compared those to the status (which is a text field)

The code was changed to query the aggregated 'status' field, as that
will also return indication of node problems, and we can use this only
one field for all decisions. We still ask for the admin_state field as
that is needed for the activate disks check (in secondary node restart).

The patch also touches the watcher in some other parts:
  - log exceptions nicer
  - convert a method to @staticmethod
  - remove unused imports

Reviewed-by: imsnah

15 years agoRemove last use of utils.RunCmd from the watcher
Iustin Pop [Wed, 1 Oct 2008 09:27:07 +0000 (09:27 +0000)]
Remove last use of utils.RunCmd from the watcher

The watcher has one last use of ganeti commands as opposed to sending
requests via luxi. The patch changes this to use the cli functions.

The patch also has two other changes:
  - fix the docstring for OpVerifyDisks (found out while converting
    this)
  - enable stderr logging on the watcher when “-d” is passes

Reviewed-by: imsnah

15 years agoFix unittests broken by revision 1727
Michael Hanselmann [Wed, 1 Oct 2008 09:24:18 +0000 (09:24 +0000)]
Fix unittests broken by revision 1727

Reviewed-by: iustinp

15 years agoAdd cluster options from ssconf to configuration
Michael Hanselmann [Wed, 1 Oct 2008 09:03:22 +0000 (09:03 +0000)]
Add cluster options from ssconf to configuration

ssconf will become write-only from ganeti-masterd's point of view,
therefore all settings in there need to go into the main configuration
file.

Reviewed-by: iustinp

15 years agoMove instantiation of config into bootstrap.py
Michael Hanselmann [Wed, 1 Oct 2008 09:03:06 +0000 (09:03 +0000)]
Move instantiation of config into bootstrap.py

Future patches will add even more variables to the cluster config.
Adding more parameters wouldn't make the function easier to use and
it doesn't make sense to pass them to another function, as it's
only done once in bootstrap.py on cluster initialization.

Reviewed-by: iustinp

15 years agoChange the results from cli.PollJob
Iustin Pop [Wed, 1 Oct 2008 08:29:16 +0000 (08:29 +0000)]
Change the results from cli.PollJob

Curently PollJob accepts a generic job, but will return (history
artifact) only the first opcode result. This is wrong, as it doesn't
allow polling of a job with multiple results.

Its only caller (for now) is also changed, so no functional changes
should happen.

Reviewed-by: ultrotter, amishchenko

15 years agoAdd list of build dependencies
Michael Hanselmann [Tue, 30 Sep 2008 15:01:54 +0000 (15:01 +0000)]
Add list of build dependencies

Reviewed-by: iustinp

15 years agoBuild HTML from RST input
Michael Hanselmann [Tue, 30 Sep 2008 12:28:14 +0000 (12:28 +0000)]
Build HTML from RST input

This patch also adds the design documents to Makefile.am.

Reviewed-by: iustinp

15 years agoFix ‘gnt-job info’ with no arguments
Iustin Pop [Tue, 30 Sep 2008 12:22:13 +0000 (12:22 +0000)]
Fix ‘gnt-job info’ with no arguments

I didn't realize that my zip will break when no args are passed...

Reviewed-by: imsnah

15 years agoAdd output of job/opcode timestamps
Iustin Pop [Tue, 30 Sep 2008 12:13:26 +0000 (12:13 +0000)]
Add output of job/opcode timestamps

This patch adds posibility of selection of job/opcode timestamps in
gnt-job list and info.

The code handling the possible cases (None or a valid timestamps) are
ugly though...

Reviwed-by: imsnah

15 years agoEnhance the job-related timestamps
Iustin Pop [Tue, 30 Sep 2008 12:04:31 +0000 (12:04 +0000)]
Enhance the job-related timestamps

This patch adds start, stop, and received timestamp for jobs (and allows
querying of them), and allows querying of the opcode timestamps.

Reviewed-by: imsnah

15 years agoSmall fixes for master daemon design document
Michael Hanselmann [Tue, 30 Sep 2008 11:36:46 +0000 (11:36 +0000)]
Small fixes for master daemon design document

It said CLI/RAPI will talk to master using HTTP, which isn't true. Add
a reference to job queue design document. Small typos.

Reviewed-by: iustinp

15 years agoImport design doc for commandline arguments
Alexander Schreiber [Tue, 30 Sep 2008 11:16:15 +0000 (11:16 +0000)]
Import design doc for commandline arguments

Reviewed-by: iustinp

15 years agolocking design: code path and declarations
Guido Trotter [Tue, 30 Sep 2008 10:21:21 +0000 (10:21 +0000)]
locking design: code path and declarations

Reviewed-by: iustinp

15 years agolocking design: explain use of async mode
Guido Trotter [Tue, 30 Sep 2008 10:21:10 +0000 (10:21 +0000)]
locking design: explain use of async mode

Before we were discussing this possible future feature, and its
drawbacks, but not its usefulness. This patch corrects this.

Reviewed-by: iustinp

15 years agolocking design: talk about removing locks
Guido Trotter [Tue, 30 Sep 2008 10:20:58 +0000 (10:20 +0000)]
locking design: talk about removing locks

Reviewed-by: iustinp

15 years agoImport (and update) granular locking design doc
Guido Trotter [Tue, 30 Sep 2008 10:07:08 +0000 (10:07 +0000)]
Import (and update) granular locking design doc

Reviewed-by: iustinp

15 years agoAbstract the timestamp formatting into cli.py
Iustin Pop [Tue, 30 Sep 2008 09:36:49 +0000 (09:36 +0000)]
Abstract the timestamp formatting into cli.py

Currently we format the timestamp inside the gnt-job info function. We
will need this more times in the future, so move it to cli.py as a
separate, exported function.

Reviewed-by: imsnah

15 years agoAdd job queue design document
Michael Hanselmann [Mon, 29 Sep 2008 17:55:49 +0000 (17:55 +0000)]
Add job queue design document

Reviewed-by: iustinp

15 years agoAdd an 'index' of design documents
Iustin Pop [Mon, 29 Sep 2008 16:18:30 +0000 (16:18 +0000)]
Add an 'index' of design documents

This will be an overview document, enumerating the changes without going
into details and pointing to the actual documents.

Reviewed-by: ultrotter

15 years agoAdd opcode execution log in job info
Iustin Pop [Mon, 29 Sep 2008 15:38:40 +0000 (15:38 +0000)]
Add opcode execution log in job info

This patch adds the job execution log in “gnt-job info” and also allows
its selection in “gnt-job list” (however here it's not very useful as
it's not easy to parse). It does this by adding a new field in the query
job call, named ‘oplog’.

With this, one can get a very clear examination of the job. What remains
to be added would be timestamps for start/stop of the processing for the
job itself and its opcodes.

Reviewed-by: imsnah

15 years agoMove a hardcoded constant to constants.py
Iustin Pop [Mon, 29 Sep 2008 13:15:33 +0000 (13:15 +0000)]
Move a hardcoded constant to constants.py

For now we only use the ‘C’ protocol so we can put it in constants.py
instead of hardcoding it.

Reviewed-by: imsnah

15 years agoEnable the use of shared secrets
Iustin Pop [Mon, 29 Sep 2008 13:15:20 +0000 (13:15 +0000)]
Enable the use of shared secrets

This patch enables the use of the shared secrets for DRBD8 disks, using
(hardcoded in constants.py) the md5 digest algorithm.

For making this more flexible, either we implement a cluster parameter
(once the new model is in place), or we can make it ./configure-time
selectable.

Reviewed-by: imsnah

15 years agoExtend DRBD disks with shared secret attribute
Iustin Pop [Mon, 29 Sep 2008 13:15:08 +0000 (13:15 +0000)]
Extend DRBD disks with shared secret attribute

This patch, which is similar to r1679 (Extend DRBD disks with minors
attribute), extends the logical and physical id of the DRBD disks with a
shared secret attribute. This is generated at disk creation time and
saved in the config file.

The generation of the secret is done so that we don't have duplicates in
the configuration (otherwise the goal of preventing cross-connection
will not be reached), so we add to config.py more than just a simple
call to utils.GenerateSecret().

The patch does not yet enable the use of the secrets.

Reviewed-by: imsnah

15 years agoAdd a info subcommand to gnt-job
Iustin Pop [Mon, 29 Sep 2008 13:09:53 +0000 (13:09 +0000)]
Add a info subcommand to gnt-job

Currently, it is hard to examine a job in detail; the output of ‘gnt-job
list’ is not easy to parse.

The patch adds a ‘gnt-job info’ command that is (vaguely) similar to
‘gnt-instance info’ in that it shows in a somewhat easy to understand
format the details of a job.

The result formatter is the most complicated part, since the results are
not standardized; the code attempts to format nicely the most common
result types (as taken from a random job list), via a generic algorithm.

Reviewed-by: imsnah

15 years agoImplement job summary in gnt-job list
Iustin Pop [Mon, 29 Sep 2008 13:09:34 +0000 (13:09 +0000)]
Implement job summary in gnt-job list

It is not currently possibly to show a summary of the job in the output
of “gnt-job list”. The closes is listing the whole opcode(s), but that
is too verbose. Also, the default output (id, status) is not very
useful, unless one looks for (and knows about) an exact job ID.

The patch adds a “summary” description of a job composed of the list of
OP_ID of the individual opcodes. Moreover, if an opcode has a ‘logical’
target in a certain opcode field (e.g. start instance has the instance
name as the target), then it is included in the formatting also. It's
easier to explain via a sample output:

gnt-job list
ID Status  Summary
1  error   NODE_QUERY
2  success NODE_ADD(gnta2)
3  success CLUSTER_QUERY
4  success NODE_REMOVE(gnta2.example.com)
5  error   NODE_QUERY
6  success NODE_ADD(gnta2)
7  success NODE_QUERY
8  success OS_DIAGNOSE
9  success INSTANCE_CREATE(instance1.example.com)
10 success INSTANCE_REMOVE(instance1.example.com)
11 error   INSTANCE_CREATE(instance1.example.com)
12 success INSTANCE_CREATE(instance1.example.com)
13 success INSTANCE_SHUTDOWN(instance1.example.com)
14 success INSTANCE_ACTIVATE_DISKS(instance1.example.com)
15 error   INSTANCE_CREATE(instance2.example.com)
16 error   INSTANCE_CREATE(instance2.example.com)
17 success INSTANCE_CREATE(instance2.example.com)
18 success INSTANCE_ACTIVATE_DISKS(instance1.example.com)
19 success INSTANCE_ACTIVATE_DISKS(instance2.example.com)
20 success INSTANCE_SHUTDOWN(instance1.example.com)
21 success INSTANCE_SHUTDOWN(instance2.example.com)

This is done by a simple change to the opcode classes, which allows an
opcode to format itself. The additional function is small enough that it
can go in opcodes.py, where it could also be used by a client if needed.

Reviewed-by: imsnah

15 years agoNicely sort the job list
Iustin Pop [Mon, 29 Sep 2008 13:08:44 +0000 (13:08 +0000)]
Nicely sort the job list

Unless we decide to change the job identifiers to integer, we should at
least sort the list returned by _GetJobIDsUnlocked.

Reviewed-by: imsnah

15 years agoMove the pseudo-secret generation to utils.py
Iustin Pop [Sun, 28 Sep 2008 14:44:52 +0000 (14:44 +0000)]
Move the pseudo-secret generation to utils.py

The bootstrap code needs a pseudo-secret and this is currently generated
inside the InitGanetiServerSetup function. Since more users will need
this, move it to utils.py

Reviewed-by: ultrotter

15 years agoFix a bug related to static minors
Iustin Pop [Sun, 28 Sep 2008 14:43:30 +0000 (14:43 +0000)]
Fix a bug related to static minors

When the node does not yet have any minors allocated, the first minor
(0) will not be entered in the ConfigWriter._temporary_drbds structure.
This does not happen for our current usage, since we always ask for two
minors (so the next call will not match this case), but it will be
triggered if we only ask for one minor, and then ask again before adding
the instance to the config file.

Reviewed-by: ultrotter

15 years agoAdd checks for tcp/udp port collisions
Iustin Pop [Sat, 27 Sep 2008 20:45:01 +0000 (20:45 +0000)]
Add checks for tcp/udp port collisions

In case the config file is manually modified, or in case of bugs, the
tcp/udp ports could be reused, which will create various problems
(instances not able to start, or drbd disks not able to communicate).

This patch extends the ConfigWriter.VerifyConfig() method (which is used
in cluster verify) to check for duplicates between:
  - the ports used for DRBD disks
  - the ports used for network console
  - the ports marked as free in the config file

Also, if the cluster parameter ‘highest_used_port’ is actually lower
than the computed highest used port, this is also flagged as an error.

The output from gnt-cluster verify will show (output manually wrapped):

node1 # gnt-cluster verify
* Verifying global settings
  - ERROR: tcp/udp port 11006 has duplicates: instance3.example.com/network port,
instance2.example.com/drbd disk sda
  - ERROR: tcp/udp port 11017 has duplicates: instance3.example.com/drbd disk sda,
instance3.example.com/drbd disk sdb, cluster/port marked as free
  - ERROR: Highest used port mismatch, saved 11010, computed 11017
* Gathering data (2 nodes)
...

Reviewed-by: ultrotter

15 years agoUpdate the cluster serial_no on certain operations
Iustin Pop [Sat, 27 Sep 2008 15:58:51 +0000 (15:58 +0000)]
Update the cluster serial_no on certain operations

This patch adds update of the cluster serial number for:
  - add/remove node (as the cluster's node list is changed)
  - add/remove/rename instance (as the cluster's instance list is changed)
  - change the volume group name

The rule for updating this attribute is when cluster-wide properties are
changed, but not individual node/instance ones.

There are other remaining cases to handle, pending on the ssconf
changes.

Reviewed-by: ultrotter

15 years agoAllow listing of the serial_no via gnt-* list
Iustin Pop [Sat, 27 Sep 2008 15:58:41 +0000 (15:58 +0000)]
Allow listing of the serial_no via gnt-* list

This patch adds listing of the serial_no attribute in gnt-instance and
gnt-node list, and updates to the manpages to reflect the change.

Reviewed-by: ultrotter

15 years agoInitialize and update the serial_no on objects
Iustin Pop [Sat, 27 Sep 2008 15:58:22 +0000 (15:58 +0000)]
Initialize and update the serial_no on objects

This patch add initialization of the serial_no on instance and nodes,
and update of the field whenever an object is updated in the generic
case, via ConfigWriter.Update(obj) and in the specific case of
instances' state being modified manually.

Reviewed-by: ultrotter

15 years agoSwitch the global serial_no to the top object
Iustin Pop [Sat, 27 Sep 2008 15:58:13 +0000 (15:58 +0000)]
Switch the global serial_no to the top object

Currently the serial_no that is incremented every time the configuration
file is written is located on the 'cluster' object in the configuration
structure. However, this is wrong as the cluster serial_no should be
incremented only when the cluster state is changed (for whatever
definition of “changed” we will use), not simply because the
configuration file is written.

This patch changes so that the ConfigWriter._BumpSerialNo affects the
top-level ConfigData object.

Reviewed-by: ultrotter

15 years agoAdd serial_no attributes to objects
Iustin Pop [Sat, 27 Sep 2008 15:58:03 +0000 (15:58 +0000)]
Add serial_no attributes to objects

This patch adds the ‘serial_no’ attribute to the other top-level objects
(the configuration object itself, the nodes and the instances).

Reviewed-by: ultrotter

15 years agoReplace a cfg.AddInstance with UpdateInstance
Iustin Pop [Sat, 27 Sep 2008 15:57:52 +0000 (15:57 +0000)]
Replace a cfg.AddInstance with UpdateInstance

This seems to be the last (deprecated) use of AddInstance in order to
update an instance.

The patch also removes a whitespace-at-eol case.

Reviewed-by: ultrotter

15 years agoAdd design doc for the disk changes
Iustin Pop [Sat, 27 Sep 2008 11:32:52 +0000 (11:32 +0000)]
Add design doc for the disk changes

Reviewed-by: imsnah

15 years agoFix iallocator name
René Nussbaumer [Thu, 25 Sep 2008 09:40:13 +0000 (09:40 +0000)]
Fix iallocator name

port forward of patch from revision 1690 with following message:

Patch on revision 1686 used the wrong field: ial.name, which is the instance
name and not the iallocator name. self.op.iallocator is the right field.

Sorry for this inconvenience.

Reviewed-by: imsnah

15 years agoFix a broken format string
René Nussbaumer [Thu, 25 Sep 2008 08:42:14 +0000 (08:42 +0000)]
Fix a broken format string

This patch fixes a broken format string. It's expecting 3 parameters, but only
gets 2. This change will add the missing parameter. This is a forward-port
of the fix in Ganeti 1.2

Reviewed-by: imsnah

15 years agoDesign doc for the master daemon
Iustin Pop [Wed, 24 Sep 2008 17:35:31 +0000 (17:35 +0000)]
Design doc for the master daemon

It's not complete, but I hope it's up to date. It's restructured text,
but no make rules or such for html output are needed, it's readable
as-is.

Reviewed-by: imsnah

15 years agoSwitch config.py to logging
Iustin Pop [Wed, 24 Sep 2008 13:43:32 +0000 (13:43 +0000)]
Switch config.py to logging

A couple of more modules are using the obsolete logger functions, config
being one of them.

Reviewed-by: imsnah

15 years agoSwitch to static minors for DRBD
Iustin Pop [Tue, 23 Sep 2008 12:10:44 +0000 (12:10 +0000)]
Switch to static minors for DRBD

With some todos remaining, this patch switches the DRBD devices to use
the passed minors, and the cmdlib code (add instance and replace disks)
to request and assign minors to the DRBD disks.

Todos:
  - look at the disk RPC calls to see which can be optimized away, since
    we now know the minor beforehand
  - remove the _FindUnusedMinor usage from the few places it's still
    used (not for actual disks, but for temporary use in meta devs) and
    eventually replace with _CheckMinorUnused or such

Of course, this and/or the previous two patches break existing clusters.
Again.

Reviewed-by: imsnah

15 years agoImplement config support for drbd static minors
Iustin Pop [Tue, 23 Sep 2008 12:10:35 +0000 (12:10 +0000)]
Implement config support for drbd static minors

This patch adds support for allocating static minors.

Like for the LVM uuids, we add a new cache for the temporarily allocated
requests, and the users of the new methods must manually clear the
cache. If this doesn't happen, at worst we lose some minors.

Todos remaining:
  - implement duplicate check at configuration load, and at instance
    add/instance update
  - investigate automatically cleaning the cache on instance add/update
    if the minors/instance/node pairs match

Reviewed-by: imsnah

15 years agoFix disk replace secondary with static minors
Iustin Pop [Tue, 23 Sep 2008 12:10:26 +0000 (12:10 +0000)]
Fix disk replace secondary with static minors

The code in 'updating instance configuration' section of the replace
disks with change secondary node was setting a wrong new logical_id for
the drbd devices (only set the new node, not the new minor). The patch
fixes this by remembering the new logical_id that we use for activating
the drbd and reusing it (instead of recomputing).

Since the minors are not needed to be allocated before the LVs are
created, we also move the minor allocation step (currently as None)
after this step.

Reviewed-by: imsnah

15 years agoExtend DRBD disks with minors attribute
Iustin Pop [Mon, 22 Sep 2008 11:32:16 +0000 (11:32 +0000)]
Extend DRBD disks with minors attribute

This patch converts the DRBD disks to contain also a minor (per each
node) attribute. This minor is not yet used and is always initialized
with None, so the patch does not have any real-world impact - except for
automatically upgrading config files (it adds the minors as None, None).

Reviewed-by: imsnah

15 years agoApply filter properly in LUQuery{Nodes, Instances} v2.0.0alpha0
Guido Trotter [Thu, 18 Sep 2008 11:13:10 +0000 (11:13 +0000)]
Apply filter properly in LUQuery{Nodes, Instances}

Currently when not locking all nodes/instances are returned, regardless
if the user asked only for some of them. With this patch we return to
the previous behaviour:
  - if no names are specified return info on all current ones
  - if some names are specified and are not found give an error
  - otherwise return only info on the specified names

Reviewed-by: iustinp

15 years agoRemove auto_balance from burnin/cmdlib
Guido Trotter [Thu, 18 Sep 2008 11:12:50 +0000 (11:12 +0000)]
Remove auto_balance from burnin/cmdlib

There is no such feature in trunk yet.

Reviewed-by: iustinp

15 years agoAdd utils.ReadFile function
Michael Hanselmann [Wed, 17 Sep 2008 16:07:40 +0000 (16:07 +0000)]
Add utils.ReadFile function

It abstracts exception handling and is like a complement to
utils.WriteFile.

Reviewed-by: iustinp

15 years agodoc/locking.txt: Job queue functions can be called from LUs
Michael Hanselmann [Wed, 17 Sep 2008 14:51:49 +0000 (14:51 +0000)]
doc/locking.txt: Job queue functions can be called from LUs

The previous description was unclear. Reported by Guido Trotter.

Reviewed-by: ultrotter

15 years agoMake burnin aware of hvm device type flags.
Alexander Schreiber [Fri, 12 Sep 2008 08:23:09 +0000 (08:23 +0000)]
Make burnin aware of hvm device type flags.

Merged from branches/ganeti/ganeti-1.2 r1648
Use static values for new hvm instance flags

Reviewed-by: iustinp

15 years agoGetAllInstancesInfo, change internal iterator name
Guido Trotter [Thu, 11 Sep 2008 17:45:55 +0000 (17:45 +0000)]
GetAllInstancesInfo, change internal iterator name

GetAllInstancesInfo used "node" as an iterator name. Change it to
instance to make it less confusing.

Reviewed-by: iustinp

15 years agognt-instance: fix tags commands online help
Guido Trotter [Thu, 11 Sep 2008 17:45:39 +0000 (17:45 +0000)]
gnt-instance: fix tags commands online help

It used to refer to "nodes", which was confusing.

Reviewed-by: iustinp

15 years agoParallelize Tag operations
Guido Trotter [Thu, 11 Sep 2008 17:45:26 +0000 (17:45 +0000)]
Parallelize Tag operations

For now we lock the instance/node for adding/deleting tags from it, but
we could probably in the future do without, with more support from the
config for atomic operations.

Reviewed-by: iustinp

15 years agoParallelize LUSetClusterParams (and add a FIXME)
Guido Trotter [Thu, 11 Sep 2008 17:44:52 +0000 (17:44 +0000)]
Parallelize LUSetClusterParams (and add a FIXME)

Reviewed-by: imsnah

15 years agoFix a typo in gnt-instance.sgml
Guido Trotter [Thu, 11 Sep 2008 09:46:10 +0000 (09:46 +0000)]
Fix a typo in gnt-instance.sgml

Reviewed-by: imsnah

15 years agoParallelize LURemoveExport
Guido Trotter [Thu, 11 Sep 2008 09:44:58 +0000 (09:44 +0000)]
Parallelize LURemoveExport

Reviewed-by: imsnah

15 years agoParallelize LURemoveInstance
Guido Trotter [Thu, 11 Sep 2008 09:44:46 +0000 (09:44 +0000)]
Parallelize LURemoveInstance

Using the new add/remove infrastructure this becomes pretty easy! :)

Reviewed-by: imsnah

15 years agoParallelize LUCreateInstance
Guido Trotter [Thu, 11 Sep 2008 09:44:33 +0000 (09:44 +0000)]
Parallelize LUCreateInstance

Finally, instance create on different node, without iallocator, can run
in parallel. Iallocator usage still needs all nodes to be locked,
unfortunately. As a bonus most checks which could have been moved to
ExpandNames, before any locking is done.

Reviewed-by: imsnah

15 years agoImplement adding/removal of locks by declaration
Guido Trotter [Thu, 11 Sep 2008 09:44:21 +0000 (09:44 +0000)]
Implement adding/removal of locks by declaration

With this patch LUs can declare locks to be added when they start and/or
removed after they finish. For now locks can only be added in the
acquired state, and removed if owned, and added locks default to be
removed again, unless some action is taken.

Reviewed-by: imsnah

15 years agoLockSet: forbid add() on a partially owned set
Guido Trotter [Thu, 11 Sep 2008 09:44:08 +0000 (09:44 +0000)]
LockSet: forbid add() on a partially owned set

This patch bans add() on a half-acquired set. This behavior was
previously possible, but created a deadlock if someone tried to acquire
the set-lock in the meantime, and thus is now forbidden. The
testAddRemove unit test is fixed for this new behavior, and includes a
few more lines of testing and a new testConcurrentSetLockAdd function
tests its behavior in the concurrent case.

Reviewed-by: imsnah

15 years agoFix typo in a locking.py comment
Guido Trotter [Thu, 11 Sep 2008 09:43:54 +0000 (09:43 +0000)]
Fix typo in a locking.py comment

Reviewed-by: imsnah

15 years agoUse is_owned to determine whether to unlock
Guido Trotter [Thu, 11 Sep 2008 09:43:41 +0000 (09:43 +0000)]
Use is_owned to determine whether to unlock

Now that is_owned is public we don't need to play games at the end of an
LU. If we're still owning anything we just release it.

Reviewed-by: imsnah

15 years agoAdd GanetiLockManager.is_owned function
Guido Trotter [Thu, 11 Sep 2008 09:43:25 +0000 (09:43 +0000)]
Add GanetiLockManager.is_owned function

This is a public version of the private function we already had.
We don't just change the previous version because it had lots of users
in the library itself and in the testing code.

Reviewed-by: imsnah

15 years agoFix LockSet._names() to work with the set-lock
Guido Trotter [Thu, 11 Sep 2008 09:43:04 +0000 (09:43 +0000)]
Fix LockSet._names() to work with the set-lock

If the set-lock is acquired, currently, the _names function will fail on
a double acquire of a non-recursive lock. This patch fixes the behavior,
and some lines of code added to the testAcquireSetLock test check that
this and other functioins behave properly.

Reviewed-by: imsnah

15 years agoAdd gnt-instance (start|stop) --submit
Iustin Pop [Thu, 11 Sep 2008 08:25:33 +0000 (08:25 +0000)]
Add gnt-instance (start|stop) --submit

Finish the --submit changes with these two, which (because they are
multi-opcode commands) require special handling.

Reviewed-by: ultrotter

15 years agojqueue: Add common RPC error handling function
Michael Hanselmann [Wed, 10 Sep 2008 17:46:47 +0000 (17:46 +0000)]
jqueue: Add common RPC error handling function

We didn't decide yet what exactly it should do with failed nodes.

Reviewed-by: ultrotter

15 years agoRemove locking of instances in certain queries
Iustin Pop [Wed, 10 Sep 2008 17:07:17 +0000 (17:07 +0000)]
Remove locking of instances in certain queries

This patch is similar to the node patch (rev 1650). We disable locking
of instance (and nodes) if we only query static information.

Reviewed-by: ultrotter

15 years agoAdd an atomic ConfigWrite.GetAllInstanceInfo()
Iustin Pop [Wed, 10 Sep 2008 17:07:03 +0000 (17:07 +0000)]
Add an atomic ConfigWrite.GetAllInstanceInfo()

In order to be able to query instance without locking them, we need the
same atomic query of multiple instances as for nodes.

Reviewed-by: ultrotter

15 years agoAdd ConfigWriter._UnlockedGetInstanceList/Info()
Iustin Pop [Wed, 10 Sep 2008 17:06:50 +0000 (17:06 +0000)]
Add ConfigWriter._UnlockedGetInstanceList/Info()

This patch splits the GetInstanceInfo and GetInstanceList methods into
two parts, one locked one _Unlocked similar to the way nodes are
queried.

Reviewed-by: ultrotter

15 years agoDo not use jobs in gnt-instance _ExpandNames()
Iustin Pop [Wed, 10 Sep 2008 17:06:39 +0000 (17:06 +0000)]
Do not use jobs in gnt-instance _ExpandNames()

In the gnt-instance script, _ExpandNames() uses jobs to query instance
names. This is not optimal, so we change it to use queries.

Reviewed-by: ultrotter

15 years agoImplement "--submit" on gnt-instance
Iustin Pop [Wed, 10 Sep 2008 17:06:27 +0000 (17:06 +0000)]
Implement "--submit" on gnt-instance

This patch adds support for the “--submit” parameter in the gnt-instance
script, for the commands where it makes sense.

Reviewed-by: ultrotter

15 years agoRewrite the 'only submit job' handling in scripts
Iustin Pop [Wed, 10 Sep 2008 15:43:27 +0000 (15:43 +0000)]
Rewrite the 'only submit job' handling in scripts

The "sys.exit(0)" was not nice as you couldn't differentiate it from
other exit codes. We change this to a specially defined exception for
this, so that multi-opcode commands can handle this nicely.

Reviewed-by: imsnah

15 years agoOptimize the OpQueryNodes for names only
Iustin Pop [Wed, 10 Sep 2008 11:03:00 +0000 (11:03 +0000)]
Optimize the OpQueryNodes for names only

Currently, OpQueryNodes is locking all nodes (in shared mode), which
will also block the special case of querying only for the node names
(this is needed for gnt-cluster command, for example). There is no
logical requirement to not give the administrator enough power if she/he
knows what to do, so it would be logical that querying the node names
works without a lock.

The patch changes the LUQuerytNodes.ExpandNodes to only request locking
when the selected fields contain dynamic attributes, and a small change
in the Exec() method to use the new, atomic query method from
ConfigWriter.

Reviewed-by: ultrotter

15 years agoAdd a way to export all node information at once
Iustin Pop [Wed, 10 Sep 2008 11:02:45 +0000 (11:02 +0000)]
Add a way to export all node information at once

The patch adds a new function to export all node information at once
(i.e. atomically with respect to the configuration lock).

Reviewed-by: ultrotter

15 years agoganeti-noded: Add constant for queue lock timeout
Michael Hanselmann [Tue, 9 Sep 2008 12:57:15 +0000 (12:57 +0000)]
ganeti-noded: Add constant for queue lock timeout

Reviewed-by: iustinp

15 years agoNever remove job queue lock in node daemon
Michael Hanselmann [Tue, 9 Sep 2008 12:47:16 +0000 (12:47 +0000)]
Never remove job queue lock in node daemon

Otherwise, corruption could occur in some corner cases. E.g. when
LeaveNode is running in a child and is in the process of removing
queue files, the main process gets killed, started again and gets
a request to update the queue. This is rather extreme corner case,
but we should opt for safety.

Reviewed-by: iustinp

15 years agoImplement master startup safety check
Iustin Pop [Tue, 9 Sep 2008 12:25:01 +0000 (12:25 +0000)]
Implement master startup safety check

This is an initial version of the master startup checks. It's a very
rudimentary change, however in normal usage (an old master was started,
the rest of the cluster is functioning normally) it will succeed in
preventing wrong startups.

Reviewed-by: imsnah

15 years agoExport backend.GetMasterInfo over the rpc layer
Iustin Pop [Tue, 9 Sep 2008 12:24:50 +0000 (12:24 +0000)]
Export backend.GetMasterInfo over the rpc layer

We create a multi-node call so that querying all nodes for agreement
will be fast.

Reviewed-by: imsnah

15 years agoChange backend._GetMasterInfo to return more data
Iustin Pop [Tue, 9 Sep 2008 12:24:12 +0000 (12:24 +0000)]
Change backend._GetMasterInfo to return more data

The _GetMasterInfo() function needs to export the master name too to be
useful in master safety checks. This patch makes it a public (no _)
function and adds a third element in the return tuple. Its callers are
modified too.

Reviewed-by: imsnah

15 years agoParallelize LUQueryInstanceData
Guido Trotter [Tue, 9 Sep 2008 10:42:16 +0000 (10:42 +0000)]
Parallelize LUQueryInstanceData

Reviewed-by: iustinp

15 years agoParallelize LUVerify{Cluster,Disks}
Guido Trotter [Tue, 9 Sep 2008 10:42:03 +0000 (10:42 +0000)]
Parallelize LUVerify{Cluster,Disks}

These are two easy querying LUs which require shared access to all
nodes/instances.

Reviewed-by: iustinp

15 years agoParallelize LUReplaceDisks
Guido Trotter [Tue, 9 Sep 2008 10:41:50 +0000 (10:41 +0000)]
Parallelize LUReplaceDisks

This is the most complex parallelization so far. We have to lock one
instance (and its nodes) plus one more node if doing a remote replace,
or all nodes if doing a remote replace with iallocator.

Reviewed-by: iustinp

15 years ago_LockInstancesNodes: support append mode
Guido Trotter [Tue, 9 Sep 2008 10:41:38 +0000 (10:41 +0000)]
_LockInstancesNodes: support append mode

This will be used to lock the instance's nodes in addition to some more.

Reviewed-by: iustinp

15 years agoProcessor: remove ChainOpCode
Guido Trotter [Tue, 9 Sep 2008 10:41:25 +0000 (10:41 +0000)]
Processor: remove ChainOpCode

This function was incompatible with the new locking system, and its
usage has been removed from the code. For now LUs share code by calling
common module-private functions in cmdlib.py, in the future they will
use tasklets (when those will be implemented).

Reviewed-by: iustinp

15 years agoParallelize LU{A,Dea}ctivateInstanceDisks
Guido Trotter [Tue, 9 Sep 2008 10:41:10 +0000 (10:41 +0000)]
Parallelize LU{A,Dea}ctivateInstanceDisks

Now that they are not used in other opcodes by chaining,
this can easily be done.

Reviewed-by: iustinp

15 years agoLUReplaceDisks: remove use of ChainOpCode
Guido Trotter [Tue, 9 Sep 2008 10:40:58 +0000 (10:40 +0000)]
LUReplaceDisks: remove use of ChainOpCode

The calls to OpActivateInstanceDisks and OpDeactivateInstanceDisks has
been replaced by _StartInstanceDisks and _SafeShutdownInstanceDisks
respectively. This is the last usage of ChainOpCode.

Reviewed-by: iustinp

15 years agoCreate new _SafeShutdownInstanceDisks function
Guido Trotter [Tue, 9 Sep 2008 10:40:39 +0000 (10:40 +0000)]
Create new _SafeShutdownInstanceDisks function

This new function checks whether an instance is running, before shutting
down its disks. This is what the Exec() of LUDeactivateInstanceDisks
did, so that is replaced by a call to this function.

Reviewed-by: iustinp

15 years agoFix a typo in LogicalUnit.ExpandNames docstring
Guido Trotter [Tue, 9 Sep 2008 10:40:27 +0000 (10:40 +0000)]
Fix a typo in LogicalUnit.ExpandNames docstring

s/locking.LEVEL_INSTANCES/locking.LEVEL_INSTANCE/

Reviewed-by: iustinp

15 years agoUse constants.LOCKS_REPLACE instead of hardcoding
Guido Trotter [Tue, 9 Sep 2008 10:40:09 +0000 (10:40 +0000)]
Use constants.LOCKS_REPLACE instead of hardcoding

This constant replaces what we used to write in recalculate_locks, and
represents the lock recalculation mode. It lives in constants.py because
it's used only in cmdlib, and thus doesn't deal with the locking library
by itself.

Reviewed-by: iustinp

15 years agoFix LUReplaceDisks with iallocator
Guido Trotter [Tue, 9 Sep 2008 09:39:25 +0000 (09:39 +0000)]
Fix LUReplaceDisks with iallocator

self._RunAllocator() sets self.op.remote_node, but doesn't return the
new remote node. If we set it to the return value of the function we
basically reset it to None, and iallocator is never run.

Reviewed-by: imsnah

15 years agoUse lock timeout for queue updates in ganeti-noded
Michael Hanselmann [Tue, 9 Sep 2008 09:01:53 +0000 (09:01 +0000)]
Use lock timeout for queue updates in ganeti-noded

This helps to prevent complete deadlocks.

Reviewed-by: iustinp

15 years agoFix LUGrowDisk
Guido Trotter [Mon, 8 Sep 2008 15:54:03 +0000 (15:54 +0000)]
Fix LUGrowDisk

The rpc library returns a list, not a tuple, so we'll accept both.

Reviewed-by: iustinp

15 years agoFix iallocator run
Guido Trotter [Mon, 8 Sep 2008 15:53:16 +0000 (15:53 +0000)]
Fix iallocator run

The rpc library returns a list, not a tuple, so we'll accept both.

Reviewed-by: iustinp

15 years agoOpVerifyDisks returns a list, not a tuple
Guido Trotter [Mon, 8 Sep 2008 15:53:01 +0000 (15:53 +0000)]
OpVerifyDisks returns a list, not a tuple

Fixing the check in gnt-cluster, or gnt-cluster verify-disks is broken.
Since the version in 1.2 used to return a tuple we'll accept both.

Reviewed-by: iustinp

15 years agoParallelize LUExportInstance
Guido Trotter [Mon, 8 Sep 2008 13:44:24 +0000 (13:44 +0000)]
Parallelize LUExportInstance

Unfortunately for the first version we need to lock all nodes. The patch
discusses why this is and discuss ways to improve this in the future.

Reviewed-by: iustinp

15 years agoParallelize LUGrowDisk
Guido Trotter [Mon, 8 Sep 2008 13:44:10 +0000 (13:44 +0000)]
Parallelize LUGrowDisk

Reviewed-by: iustinp

15 years agoLURebootInstance: lock only primary when possible
Guido Trotter [Mon, 8 Sep 2008 13:43:56 +0000 (13:43 +0000)]
LURebootInstance: lock only primary when possible

When rebooting an instance and we're not changing it's disks status (all
the cases except in a "full" reboot) we can lock just its primary node.

Reviewed-by: iustinp

15 years agoAdd primary_only flag to _LockInstancesNodes
Guido Trotter [Mon, 8 Sep 2008 13:43:43 +0000 (13:43 +0000)]
Add primary_only flag to _LockInstancesNodes

As the name says when the flag is on (the default is off) only the
primary nodes are locked, as opposed to all of them.

Reviewed-by: iustinp