ganeti-local
16 years agoparms->params Refactoring
Manuel Franceschini [Mon, 31 Mar 2008 12:04:01 +0000 (12:04 +0000)]
parms->params Refactoring

- Substitute all occurences of name 'parms' with 'params'
- Small codestyle fix

Reviewed-by: ultrotter

16 years agognt-cluster option to toggle lvm-storage
Manuel Franceschini [Mon, 31 Mar 2008 11:01:07 +0000 (11:01 +0000)]
gnt-cluster option to toggle lvm-storage

This patch does two things:
- Add gnt-cluster modify
- Add --no-lvm-storage option to gnt-cluster init

Reviewed-by: iustinp

16 years agoMap OpSetClusterParams to correponding LU
Manuel Franceschini [Mon, 31 Mar 2008 11:00:24 +0000 (11:00 +0000)]
Map OpSetClusterParams to correponding LU

Reviewed-by: iustinp

16 years agoAdd OpSetClusterParams to opcodes
Manuel Franceschini [Mon, 31 Mar 2008 11:00:10 +0000 (11:00 +0000)]
Add OpSetClusterParams to opcodes

Reviewed-by: iustinp

16 years agoSkip HasValidVG when --no-lvm-storage on cluster init
Manuel Franceschini [Mon, 31 Mar 2008 10:59:54 +0000 (10:59 +0000)]
Skip HasValidVG when --no-lvm-storage on cluster init

This patch does two things:
- Remove "vg_name" from _OP_REQP due to the introduction of
  --no-lvm-storage. Since vg_name option has as default now None and is
  only set to the DEFAULT_VG if lvm_storage is enabled, this is needed
- It changes LUInitCluster.CheckPrereq() to skip _HasValidVG check
  initializing the cluster with --no-lvm-storage. Furthermore it adds to
  the help message the statement of the possibility to use
  --no-lvm-storage if no 'xenvg' volume group is found.

Reviewed-by: iustinp

16 years agoAdd LUSetClusterParams to cmdlib
Manuel Franceschini [Mon, 31 Mar 2008 10:59:17 +0000 (10:59 +0000)]
Add LUSetClusterParams to cmdlib

Add LUSetClusterParams, which is the LU to modify cluster options.
This includes checks:
- not to disable lvm storage when it's already disabled
- not to enable lvm storage when it is already enabled
- not to disable lvm when lvm-based instances are present
- that the specified volume group is valid on all cluster-nodes
  when lvm-storage is going to be enabled

Reviewed-by: iustinp

16 years agoAdd method SetVGName() to config.py
Manuel Franceschini [Mon, 31 Mar 2008 10:58:16 +0000 (10:58 +0000)]
Add method SetVGName() to config.py

Reviewed-by: iustinp

16 years agoAdd lvm-storage check when creating instances
Manuel Franceschini [Mon, 31 Mar 2008 10:57:58 +0000 (10:57 +0000)]
Add lvm-storage check when creating instances

This adds a check to fail instance creation if lvm-storage is disabled
(cluster-wide). If lvm-storage is disabled (by initializing the cluster
with --no-lvm-storage) only instances with disk template in frozenset
DTS_NOT_LVM are allowed to create.

Reviewed-by: iustinp

16 years agoAdd DEFAULT_VG and DTS_NOT_LVM to constants.py
Manuel Franceschini [Mon, 31 Mar 2008 10:57:21 +0000 (10:57 +0000)]
Add DEFAULT_VG and DTS_NOT_LVM to constants.py

DTS_NOT_LVM:
This constant is needed when checking if an instance can be created with
the given disk template if no lvm-storage is available, i.e. the ganeti
cluster does not have a volume group

DEFAULT_VG:
'xenvg' has been hardcoded before.

Reviewed-by: iustinp

16 years agoChange the order of config updates in some LUs
Iustin Pop [Sun, 30 Mar 2008 14:54:34 +0000 (14:54 +0000)]
Change the order of config updates in some LUs

In the start and stop instance LUs, the configuration update is done
right at the end. This means that if, for example, the instance shutdown
succeeds, but the drive deactivation fails, the next run of the watcher
will start the instance again, as it's still marked in running mode.

This patch changes these two LUs so that first the update the
configuration to the desired state, and only then we proceed to update
the config. This ensures that the state saved is the desired state.

Because the config might be updated even though the LU failed, this
patch also modifies the mcpu.Processor.ExecOpCode method to run the
RunConfigUpdate hook in a finally: phase while the lu.Exec is done in
its try phase. This ensures that config update hooks (tries to) run at
all times when the config is updated.

Reviewed-by: schreiberal

16 years agoFix a bug in interactive confirmation of instances
Iustin Pop [Thu, 27 Mar 2008 15:52:21 +0000 (15:52 +0000)]
Fix a bug in interactive confirmation of instances

This oneliner fixes a bug in listing more than twenty instances for
multiple operations (shutdown, startup, etc.).

Reviewed-by: imsnah

16 years agoReduce log noise for the new http-based rpc
Iustin Pop [Thu, 27 Mar 2008 15:46:50 +0000 (15:46 +0000)]
Reduce log noise for the new http-based rpc

This patch just removes an extraneous \n from the log message making it
nicer to view.

Reviewed-by: schreiberal

16 years agoAdd QA test for “gnt-instance console”
Michael Hanselmann [Thu, 27 Mar 2008 14:40:08 +0000 (14:40 +0000)]
Add QA test for “gnt-instance console”

Reviewed-by: iustinp

16 years agoAdd --print parameter to “gnt-instance console”
Michael Hanselmann [Thu, 27 Mar 2008 14:39:47 +0000 (14:39 +0000)]
Add --print parameter to “gnt-instance console”

This enables us to run automated tests on “gnt-instance console”, at least
to some degree.

Reviewed-by: iustinp

16 years agoReturn first parameter of console command only once
Michael Hanselmann [Thu, 27 Mar 2008 14:39:25 +0000 (14:39 +0000)]
Return first parameter of console command only once

Reviewed-by: iustinp

16 years agoModify Disk.GetNodes() to support LD_FILE
Manuel Franceschini [Tue, 25 Mar 2008 17:48:41 +0000 (17:48 +0000)]
Modify Disk.GetNodes() to support LD_FILE

Reviewed-by: iustinp

16 years agoAdd constants for file-based storage
Manuel Franceschini [Tue, 25 Mar 2008 17:48:09 +0000 (17:48 +0000)]
Add constants for file-based storage

Reviewed-by: iustinp

16 years agoRemove the option to create md/drbd7 instances
Iustin Pop [Tue, 25 Mar 2008 16:30:28 +0000 (16:30 +0000)]
Remove the option to create md/drbd7 instances

This patch removes the options that allow to create local_raid1 or
remote_raid1 instances. It also modifies the documentation and removes
these disk templates from burnin and from qa.

Reviewed-by: imsnah

16 years agoRemove the add/remove mirror operations
Iustin Pop [Tue, 25 Mar 2008 16:30:01 +0000 (16:30 +0000)]
Remove the add/remove mirror operations

These two operations are related to md/drbd7 code (remote_raid1). Remove
them as part of the md/drbd7 removal.

Reviewed-by: imsnah

16 years agoModify cluster-init to create file-storage-dir
Manuel Franceschini [Thu, 20 Mar 2008 15:55:17 +0000 (15:55 +0000)]
Modify cluster-init to create file-storage-dir

This patch adds three things:
- it normalizes the file storage directory path passed to gnt-cluster init
- if the file-storage-path doesn't exist on the master node, ganeti
  tries to create it
- adds additional check if the passed file-storage-dir is not a directory

Reviewed-by: iustinp

16 years agoRemove some deprecated code in bdev.py
Iustin Pop [Thu, 20 Mar 2008 10:51:55 +0000 (10:51 +0000)]
Remove some deprecated code in bdev.py

The BlockDev.GetStatus() method and some associated constants were never
used in the rest of the code. This patch removes them.

Reviewed-by: imsnah

16 years agoChange the opcode hierarchy and implementation
Iustin Pop [Wed, 19 Mar 2008 16:55:05 +0000 (16:55 +0000)]
Change the opcode hierarchy and implementation

This patch adds a new top-level class (BaseJO) that is used for both
opcodes and a new Job class.

This new class and the related changes to the OpCode abstract class are
used to implement simple to-dict/from-dict transformations, so that we
can easily serialize the classes using json.

Reviewed-by: imsnah

16 years agoAdd option to change default file_storage_dir
Manuel Franceschini [Wed, 19 Mar 2008 10:47:30 +0000 (10:47 +0000)]
Add option to change default file_storage_dir

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd support for file_storage_dir to LUInitCluster
Manuel Franceschini [Wed, 19 Mar 2008 10:47:10 +0000 (10:47 +0000)]
Add support for file_storage_dir to LUInitCluster

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd file_storage_dir to opcodes.OpInitCluster
Manuel Franceschini [Wed, 19 Mar 2008 10:46:50 +0000 (10:46 +0000)]
Add file_storage_dir to opcodes.OpInitCluster

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd SS_FILE_STORAGE_DIR to ssconf
Manuel Franceschini [Wed, 19 Mar 2008 10:46:28 +0000 (10:46 +0000)]
Add SS_FILE_STORAGE_DIR to ssconf

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd DEFAULT_FILE_STORAGE_DIR to constants
Manuel Franceschini [Wed, 19 Mar 2008 10:45:22 +0000 (10:45 +0000)]
Add DEFAULT_FILE_STORAGE_DIR to constants

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd FILE_STORAGE_DIR to be in lib/_autoconf.py
Manuel Franceschini [Wed, 19 Mar 2008 10:45:03 +0000 (10:45 +0000)]
Add FILE_STORAGE_DIR to be in lib/_autoconf.py

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd file-storage-dir to configure.ac
Manuel Franceschini [Wed, 19 Mar 2008 10:44:28 +0000 (10:44 +0000)]
Add file-storage-dir to configure.ac

This adds the possibility to specify at configure-time the default file-storage-dir.

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoMake ganeti-noded create BDEV_CACHE_DIR automatically
Iustin Pop [Wed, 19 Mar 2008 10:17:36 +0000 (10:17 +0000)]
Make ganeti-noded create BDEV_CACHE_DIR automatically

Currently in order to deal with tmpfs /var/run, we create the
BDEV_CACHE_DIR in the init script. However, that does not cover all the
cases, and it's not a proper place to deal with it: for example, dealing
with not initialized clusters and the master node is more complicated.

Therefore, this patch does:
  - make ganeti-noded create the directory automatically
  - make ganeti-noded error out if it can't create it or it's already
    there but not a directory
  - remove the creation from the init.d script

Reviewed-by: ultrotter

16 years agoUse constants for “ssh” and “scp” binaries instead of magic values
Michael Hanselmann [Tue, 18 Mar 2008 13:04:33 +0000 (13:04 +0000)]
Use constants for “ssh” and “scp” binaries instead of magic values

Reviewed-by: ultrotter

16 years agoUse new ssh.WriteKnownHostsFile function
Michael Hanselmann [Tue, 18 Mar 2008 13:04:12 +0000 (13:04 +0000)]
Use new ssh.WriteKnownHostsFile function

This replaces very old code.

Reviewed-by: ultrotter

16 years agoUse new cluster alias in known_hosts file
Michael Hanselmann [Tue, 18 Mar 2008 13:03:59 +0000 (13:03 +0000)]
Use new cluster alias in known_hosts file

Reviewed-by: ultrotter

16 years agoUse new “tty” parameter on SshRunner.BuildCmd for “gnt-instance console”
Michael Hanselmann [Tue, 18 Mar 2008 13:03:40 +0000 (13:03 +0000)]
Use new “tty” parameter on SshRunner.BuildCmd for “gnt-instance console”

Reviewed-by: ultrotter

16 years agoAdd “tty” parameter to SshRunner.BuildCmd
Michael Hanselmann [Tue, 18 Mar 2008 13:03:21 +0000 (13:03 +0000)]
Add “tty” parameter to SshRunner.BuildCmd

This allows callers to allocate a pseudo-TTY easily.

Reviewed-by: ultrotter

16 years agoOrder SSH options alphabetically
Michael Hanselmann [Tue, 18 Mar 2008 13:03:07 +0000 (13:03 +0000)]
Order SSH options alphabetically

Reviewed-by: ultrotter

16 years agoMove SSH functions into a class
Michael Hanselmann [Tue, 18 Mar 2008 13:02:53 +0000 (13:02 +0000)]
Move SSH functions into a class

This renames some functions and does some minor codestyle cleanup.

Reviewed-by: ultrotter

16 years agoAdd function to write cluster SSH key to known_hosts file
Michael Hanselmann [Tue, 18 Mar 2008 13:02:14 +0000 (13:02 +0000)]
Add function to write cluster SSH key to known_hosts file

The whole Ganeti cluster has a single SSH key. Its fingerprint is
written to Ganeti's known_hosts file, together with an alias. This
allows us to always use that alias instead of the real hostname,
making management of the known_hosts file much easier.

This patch does not handle an upgrade from an earlier version.

Reviewed-by: ultrotter

16 years agoLocking: remove an empty space at End Of Line
Guido Trotter [Tue, 18 Mar 2008 10:09:04 +0000 (10:09 +0000)]
Locking: remove an empty space at End Of Line

Reviewed-by: imsnah

16 years agoIncrease SharedLock fairness
Guido Trotter [Tue, 18 Mar 2008 10:08:45 +0000 (10:08 +0000)]
Increase SharedLock fairness

Previously if a shared thread was notified, together with the rest, and was not
fast enough in waking up and acquiring the lock, another one could release it,
decide there were no more sharers, and let an exclusive one in instead. With
this patch we make sure all the shared holders which were waiting have passed,
before declaring it's time to make an exclusive one pass.

This also allows us to reintroduce a slight variation of the assertion removed
in r665, which makes our code safer.

Reviewed-by: imsnah

16 years agoSpecify better gnt-instance(8) replace-disks
Guido Trotter [Tue, 11 Mar 2008 10:33:04 +0000 (10:33 +0000)]
Specify better gnt-instance(8) replace-disks

The -s option when changing secondary node on a drbd template is implied, and
thus optional. Specify this in the manpage.

Reviewed-by: iustinp

16 years agoDisable cluster init with a reachable IP
Iustin Pop [Tue, 11 Mar 2008 07:44:49 +0000 (07:44 +0000)]
Disable cluster init with a reachable IP

Make the cluster init fail if the IP to which the cluster name resolved
is already reachable by the master node. This is not a foolproof
solution, but it allows a cheap method of detecting simple mistakes.

It will also disallow using the master node name as cluster name (which
is something good).

The only drawbacks that I see are:
  - you are not allowed to do this, which might come in handy in cluster
    upgrades; but since we support rename, this is mitigated
  - cluster init takes longer now (+the timeout value, set to 5
    seconds), but since this is a one-off operation, it should be ok

Reviewed-by: ultrotter

16 years agoModify utils.TcpPing to make source address optional
Iustin Pop [Tue, 11 Mar 2008 07:44:36 +0000 (07:44 +0000)]
Modify utils.TcpPing to make source address optional

This patch modifies TcpPing and its callers to make the source address
selection optional. Usually, the kernel will know better what
source address to use, just in some cases we want to enforce a given
source address so it makes sense to make this optional.

Reviewed-by: ultrotter

16 years agoFix gnt-instance replace-disks online help
Guido Trotter [Thu, 6 Mar 2008 16:34:08 +0000 (16:34 +0000)]
Fix gnt-instance replace-disks online help

The "quick" online help just reported the option to change secondary node. Add
the ones to just replace the disk locally on-primary or on-secondary. It is of
course impossible to espress in one line everything needed to use this command,
but at least now the most common options are spelled out immediately.

Reviewed-by: iustinp, imsnah

16 years agoReplace custom file writing code with utils.WriteFile
Michael Hanselmann [Wed, 5 Mar 2008 16:48:39 +0000 (16:48 +0000)]
Replace custom file writing code with utils.WriteFile

Reviewed-by: ultrotter

16 years agoCodestyle fixes: adding a few empty lines
Michael Hanselmann [Wed, 5 Mar 2008 14:39:41 +0000 (14:39 +0000)]
Codestyle fixes: adding a few empty lines

Reviewed-by: ultrotter

16 years agoLockSet: handle empty case
Guido Trotter [Tue, 4 Mar 2008 17:12:55 +0000 (17:12 +0000)]
LockSet: handle empty case

A LockSet is mostly useful when it has some locks in it. On the other hand
there are cases in which it must function even when empty. For example if a
cluster has no instances in it there's no reason why locking all of them
shouldn't work anyway. This patch adds test code for that situation and
implements the necessary fixes to make it work.

Reviewed-by: imsnah

16 years agoLockSet: add missing check code
Guido Trotter [Tue, 4 Mar 2008 17:12:33 +0000 (17:12 +0000)]
LockSet: add missing check code

This check that no operation had been performed before release() was missing in
the test code. Adding it.

Reviewed-by: imsnah

16 years agoLockSet: collapse two try/except into one
Guido Trotter [Tue, 4 Mar 2008 17:12:14 +0000 (17:12 +0000)]
LockSet: collapse two try/except into one

Reviewed-by: imsnah

16 years agoSharedLock: remove wrong assertion in code
Guido Trotter [Tue, 4 Mar 2008 17:11:47 +0000 (17:11 +0000)]
SharedLock: remove wrong assertion in code

r644 contained some cleanup code for LockSet. Among other things it removed a
syntax error that allowed an assertion that previously wan't really checked to
trigger. It turns out that even though the spirit of that assertion was correct
its actual implementation was wrong.

While it's true that no sharers must be waiting if an exclusive holder is not
present it might happen that when all the sharers wake up one of them releases
the lock before some other even has had a chance to run. In this case
__shr_wait would still be greater than 0, even if the sharer is not actually
waiting, just pending a wakeup to proceed.

Thus, removing the assertion in question.

Reviewed-by: imsnah

16 years agoCodestyle updates for locking code
Michael Hanselmann [Tue, 4 Mar 2008 14:46:37 +0000 (14:46 +0000)]
Codestyle updates for locking code

Reviewed-by: ultrotter

16 years agoLockSet: make acquire() able to get the whole set
Guido Trotter [Tue, 4 Mar 2008 13:18:22 +0000 (13:18 +0000)]
LockSet: make acquire() able to get the whole set

This new functionality makes it possible to acquire a whole set, by passing
"None" to the acquire() function as the list of elements. This will avoid new
additions to the set, and then acquire all the current elements. The list of
all elements acquired will be returned at the end.

Deletions can still happen during the acquire process and we'll deal with it by
just skipping the deleted elements: it's effectively as if they were deleted
before we called the function. After we've finished though we hold all the
elements, so no more deletes can be performed before we release them.

Any call to release() will then first of all release the "set-level" lock if
we're holding it, and then all or some of the locks we have.

Some new tests checks that this feature works as intended.

Reviewed-by: imsnah

16 years agoLockSet: encapsulate acquire() in try-except
Guido Trotter [Tue, 4 Mar 2008 13:18:03 +0000 (13:18 +0000)]
LockSet: encapsulate acquire() in try-except

This patch adds a try/except area around most of the acquire() code (everything
after the intial condition checks). Since the except: clause contains just a
'raise' nothing really changes except the indentation of the code.

This is done in a separate commit to insulate and make clearer what the real
code changes done in the upcoming patch are.

Reviewed-by: imsnah

16 years agoMake LockSet.__names() return a list, not a set
Guido Trotter [Tue, 4 Mar 2008 13:17:48 +0000 (13:17 +0000)]
Make LockSet.__names() return a list, not a set

Previously the private version of the __names function returned directly a set.
We'll keep this in the public interface but change the private version to a
list in order to be able to sort() its result and then loop on it, even though
we'll need to do this with the usual care that some keys may disappear in
between.

Reviewed-by: imsnah

16 years agoLockSet: improve remove() api
Guido Trotter [Tue, 4 Mar 2008 13:17:31 +0000 (13:17 +0000)]
LockSet: improve remove() api

Lockset's remove() function used to return a list of locks we failed to remove.
Rather than doing this we'll return a list of removed locks, so it's more
similar to how acquire() behaves. This patch also fixes the relevant unit tests.

Reviewed-by: imsnah

16 years agoLockSet: make acquire() return the set of names
Guido Trotter [Tue, 4 Mar 2008 13:17:09 +0000 (13:17 +0000)]
LockSet: make acquire() return the set of names

In a LockSet acquire() returned True on success. This code changes that to
return a set containing the names of the elements acquired. This is still a
true value if we acquired any lock but is slightly more useful (because if
needed one has access to this data without querying for it). The only change
happens if acquiring no locks, which though is a usage which should not
normally happen because it has no practical use.

The patch also changes a some tests to check that the new format is respected.

Reviewed-by: imsnah

16 years agoLockSet: invert try/for nesting in acquire()
Guido Trotter [Tue, 4 Mar 2008 13:16:44 +0000 (13:16 +0000)]
LockSet: invert try/for nesting in acquire()

This patch changes nothing to the functionality of a LockSet. Rather than
trying to do the whole for loop we try each of its steps. This opens the way to
handle differently a single failure.

Reviewed-by: imsnah

16 years agoInitial GanetiLockManager implementation
Guido Trotter [Tue, 4 Mar 2008 10:09:05 +0000 (10:09 +0000)]
Initial GanetiLockManager implementation

Includes some locking-related constants and explanations on how the
LockManager should be used, the class itself and its test cases.

The class includes:
  - a basic constructor
  - functions to acquire and release lists of locks at the same level
  - functions to add and remove list of locks at modifiable levels
  - dynamic checks against out-of-order acquisitions and other illegal ops

Its testing library checks that the LockManager behaves correctly and that the
external assumptions it relies on are respected.

Reviewed-by: imsnah

16 years agoFix master role stop on cluster destroy
Iustin Pop [Fri, 29 Feb 2008 16:32:39 +0000 (16:32 +0000)]
Fix master role stop on cluster destroy

Currently the cluster destroy doesn't remove the master role, which
means that the IP address of the cluster remains assigned to the master
node.

This patch fixes this and also a docstring in backend.StopMaster().

Reviewed-by: imsnah

16 years agoImplement QA tests for gnt-cluster rename
Iustin Pop [Fri, 29 Feb 2008 15:33:27 +0000 (15:33 +0000)]
Implement QA tests for gnt-cluster rename

Reviewed-by: imsnah

16 years agoFix cluster rename operation
Iustin Pop [Fri, 29 Feb 2008 12:32:59 +0000 (12:32 +0000)]
Fix cluster rename operation

This one-liner fixes the cluster rename operation. As a side note, we
should have a QA test for this too.

Reviewed-by: imsnah

16 years agoLockSet: make acquire() fail faster on wrong locks
Guido Trotter [Thu, 28 Feb 2008 18:53:30 +0000 (18:53 +0000)]
LockSet: make acquire() fail faster on wrong locks

This patch makes acquire() first look up all the locks in the dict and then try
to acquire them later. The advantage is that if a lockname is already wrong
since the beginning we won't need to first queue and acquire other locks to
find this out.

Of course since there is no locking between the two steps a delete() could
still happen in between, but SharedLocks are safe in this regard and will just
make the .acquire() operation fail if this unfortunate condition happens.

Since the right way to check if an instance/node exists and make sure it won't
stop existing after that is acquiring its lock this improves the common case
(checking for an incorrect name) while not penalizing correctness, or
performance as would happen if we kept a lock for the whole process.

Reviewed-by: iustinp

16 years agoLockSet implementation and unit tests
Guido Trotter [Thu, 28 Feb 2008 15:06:19 +0000 (15:06 +0000)]
LockSet implementation and unit tests

A LockSet represents locking for a set of resources of the same type. A thread
can acquire multiple resources at the same time, and release some or all of
them, but cannot acquire more resources incrementally at different times
without releasing all of them in between.

Internally a LockSet uses a SharedLock for each resource to be able to grant
both exclusive and shared acquisition. It also supports safe addition and
removal of resources at runtime. Acquisitions are ordered alphabetically in
order to grant them to be deadlock-free. A lot of assumptions about how the
code interacts are made in order to grant both safety and speed; in order to
document all of them the code features pretty lenghty comments.

The test suit tries to catch most common interactions but cannot really tests
tight race conditions, for which we still need to rely on human checking.

This is the second basic building block for the Ganeti Lock Manager. Instance
and Node locks will be put in LockSets to manage their acquisition and release.

Reviewed-by: imsnah

16 years agoFix the gnt-cluster init man page
Guido Trotter [Thu, 28 Feb 2008 11:20:56 +0000 (11:20 +0000)]
Fix the gnt-cluster init man page

Some options were missing in the gnt-cluster init man page.  This patch adds
them, removes an empty line, and clarifies a bit more some requirements.

Reviewed-by: schreiberal

16 years agoDon't allow renaming to an existing instance
Guido Trotter [Thu, 28 Feb 2008 11:20:26 +0000 (11:20 +0000)]
Don't allow renaming to an existing instance

Even if the target instance is down or we are not checking for IP conflicts
changing an instance name to a new one which is already in the cluster is
doomed to fail, because in a lot of places (among which figures the mind of
most users/admins) instance names are assumed to be unique.

Reviewed-by: imsnah

16 years agoClarify online help for xc-instance reinstall.
Alexander Schreiber [Thu, 28 Feb 2008 10:33:13 +0000 (10:33 +0000)]
Clarify online help for xc-instance reinstall.

Reviewed-by: imsnah

16 years agoUse constants.ETC_HOSTS instead of string for /etc/hosts
Michael Hanselmann [Wed, 27 Feb 2008 13:05:03 +0000 (13:05 +0000)]
Use constants.ETC_HOSTS instead of string for /etc/hosts

Reviewed-by: iustinp

16 years agoDistribute lib/locking.py
Michael Hanselmann [Wed, 27 Feb 2008 12:22:55 +0000 (12:22 +0000)]
Distribute lib/locking.py

Reviewed-by: ultrotter

16 years agoSplit GanetiUnitTest into testutils.py
Michael Hanselmann [Tue, 26 Feb 2008 20:15:53 +0000 (20:15 +0000)]
Split GanetiUnitTest into testutils.py

Reviewed-by: iustinp

16 years agoUpdate svn:ignore properties
Michael Hanselmann [Tue, 26 Feb 2008 14:14:38 +0000 (14:14 +0000)]
Update svn:ignore properties

Reviewed-by: iustin

16 years agoSome changes on disk failure tests
Michael Hanselmann [Mon, 25 Feb 2008 13:54:53 +0000 (13:54 +0000)]
Some changes on disk failure tests

Change comments to printed information, some cleanup. These changes
are from November 2007. The test is not perfect yet.

Reviewed-by: iustinp

16 years agoThis patch replaces some hardcoded strings with their corresponding constant in ...
Manuel Franceschini [Mon, 25 Feb 2008 09:17:51 +0000 (09:17 +0000)]
This patch replaces some hardcoded strings with their corresponding constant in `_GenerateDiskTemplate()`.

Reviewed-by: iustinp

16 years agoImprove ganeti example cron file
Guido Trotter [Sat, 23 Feb 2008 10:48:22 +0000 (10:48 +0000)]
Improve ganeti example cron file

The cron file in ganeti's example directory is now static, and executes
ganeti-watcher in /usr/local/sbin no matter where it's really installed. With
this patch we generate it at build time substituting the right value of
@SBINDIR@ from ganeti.cron.in. We also make sure ganeti-watcher exists and is
executable before running it.

This is targeted at 1.2 as well.

Reviewed-by: iustinp

16 years agoSmall comment fix.
Manuel Franceschini [Fri, 22 Feb 2008 16:12:49 +0000 (16:12 +0000)]
Small comment fix.

16 years agoFixes small spell mistakes and comments
Manuel Franceschini [Fri, 22 Feb 2008 16:12:27 +0000 (16:12 +0000)]
Fixes small spell mistakes and comments

16 years agoBreak trunk by removing twisted
Iustin Pop [Fri, 22 Feb 2008 12:39:34 +0000 (12:39 +0000)]
Break trunk by removing twisted

This patch switches from the twisted usage for inter-node protocol to
simple BaseHTTPServer/httplib. The patch has more deletions because we
use no authentication, no encryption at all.

As such, this is just for trunk, and only for testing. What it brings is
the ability to use the rpc library from within multiple threads in
parallel (or it should so).

Since the changes are very few and non-intrusive, they can be reverted
without impacting the rest of the code.

This passes burnin. QA was not tested.

Reviewed-by: imsnah

16 years agoAdd a few SharedLock delete() tests
Guido Trotter [Thu, 21 Feb 2008 13:45:27 +0000 (13:45 +0000)]
Add a few SharedLock delete() tests

- Check that even a shared acquire() fails on a deleted lock
- Check that delete() fails on a lock you share (must own it or nothing)

These are assumptions I build on in future code, so better check for them.
Currently no code change is necessary for them to be valid.

Reviewed-by: iustinp

16 years agoSharedLock: fix a wrong unit-test helper code
Guido Trotter [Wed, 20 Feb 2008 13:47:37 +0000 (13:47 +0000)]
SharedLock: fix a wrong unit-test helper code

The _doItDelete helper code was supposed to be used to dispatch threads that
deleted the SharedLock. It actually just acquired it exclusively. This remained
unnoticed as the helper thread is just used to test interaction, not the delete
code by itself, and delete requires an exclusive acquire anyway.

Reviewed-by: imsnah

16 years agoAdd another 1.1->1.2 compatibility alias
Guido Trotter [Wed, 20 Feb 2008 11:17:52 +0000 (11:17 +0000)]
Add another 1.1->1.2 compatibility alias

gnt-instance replace-disks used to be called replace_disks.

Reviewed-by: iustinp

16 years agoAdd the delete() operation to SharedLock
Guido Trotter [Tue, 19 Feb 2008 13:50:57 +0000 (13:50 +0000)]
Add the delete() operation to SharedLock

This new operation lets a lock be cleanly deleted. The lock will be exclusively
held before deletion, and after it pending and future acquires will raise an
exception. Other SharedLock operations are modify to deal with delete() and to
avoid code duplication.

This patch also adds unit testing for the new function and its interaction with
the other lock features. The helper threads are sligtly modified to handle and
report the condition of a deleted lock. As a bonus a non-related unit test
about not supporting non-blocking mode yet has been added as well.

This feature will be used by the LockSet in order to support deadlock-free
delete of resources. This in turn will be useful to gracefully handle the
removal of instances and nodes from the cluster dealing with the fact that
other operations may be pending on them.

Reviewed-by: iustinp

16 years agoFix a couple of SharedLock docstrings
Guido Trotter [Mon, 18 Feb 2008 16:58:37 +0000 (16:58 +0000)]
Fix a couple of SharedLock docstrings

Use the actual class name rather than a spaced version of it.

Reviewed-by: iustinp

16 years agoUpdate version numbers for the 1.2.3 release
Iustin Pop [Mon, 18 Feb 2008 13:36:09 +0000 (13:36 +0000)]
Update version numbers for the 1.2.3 release

Note: we don't update for now the install.sgml file with the new version
number, as there are no other changes. We'll update the web site to
indicate that the current install.html document is valid for 1.2.3 too.

Reviewed-by: imsnah,ultrotter

16 years agoRevert "Include the DRBD upgrade tool in the dist archive"
Iustin Pop [Mon, 18 Feb 2008 10:59:21 +0000 (10:59 +0000)]
Revert "Include the DRBD upgrade tool in the dist archive"

This reverts commit 604 as the upgrade tool should not be in the 1.3 branch.

Reviewed-by: schreiberal

16 years agoUpdate online help and manpage to include drbd disk type.
Alexander Schreiber [Mon, 18 Feb 2008 10:44:37 +0000 (10:44 +0000)]
Update online help and manpage to include drbd disk type.

Reviewed-by: imsnah

16 years agoInclude the DRBD upgrade tool in the dist archive
Iustin Pop [Mon, 18 Feb 2008 10:42:50 +0000 (10:42 +0000)]
Include the DRBD upgrade tool in the dist archive

This patch adds the DRBD upgrade tool in the archive and in the
installed tools dir, and its associated README in the doc_DATA target.

Reviewed-by: ultrotter

16 years agoFix gnt-instance info i1 i2 ...
Guido Trotter [Sat, 16 Feb 2008 13:06:37 +0000 (13:06 +0000)]
Fix gnt-instance info i1 i2 ...

Due to an indentation error only the last instance queried got returned by
LUQueryInstanceData. Moving the append() call inside the for cycle to fix this
issue.

This is a one-liner targeted at 1.2.3

Reviewed-by: iustinp

16 years agoReplace version number in install.sgml during build time
Michael Hanselmann [Fri, 15 Feb 2008 12:41:03 +0000 (12:41 +0000)]
Replace version number in install.sgml during build time

Reviewed-by: iustinp

16 years agoFurther fixes for the 'export MAC in hooks' change
Iustin Pop [Fri, 15 Feb 2008 09:53:11 +0000 (09:53 +0000)]
Further fixes for the 'export MAC in hooks' change

QA suite which tests gnt-instance modify has uncovered another issue related to
mac export.

Reviewed-by: imsnah

16 years agoAlter the device activation code
Iustin Pop [Thu, 14 Feb 2008 15:54:05 +0000 (15:54 +0000)]
Alter the device activation code

This tiny patch fixes the breakage that the previous patch about
activation did by removing the Close() call after activation.

The initial reason for that call was that if the device is already
active and open, but we need it closed, we close it automatically.

This however conflicts with the 2-step open in the case the instance is
already open.

It makes sense to remove the call since in the current Ganeti setup,
just doing Close() is not enough to change the device from (e.g.)
primary to secondary, as some devices (e.g. md) might need Shutdown not
Close.

It also gets rid of a Close() in the CreateBlockDevice function, due to
the same reasoning (although in Create the child should not have a
different status anyway).

Reviewed-by: imsnah

16 years agoTwo small improvements to burnin
Iustin Pop [Thu, 14 Feb 2008 15:53:54 +0000 (15:53 +0000)]
Two small improvements to burnin

This tiny patch fixes the verbose option to actually work, and also when
creating instances it logs the secondary node too (even if this doesn't
apply for plain templates, it doesn't create an error).

Reviewed-by: imsnah

16 years agoModify the default output of gnt-instance list
Iustin Pop [Thu, 14 Feb 2008 15:53:36 +0000 (15:53 +0000)]
Modify the default output of gnt-instance list

This patch adds a new field available for selection in gnt-instance list
names "status" which represents the combined value of "admin_state" and
"oper_state". Since this is much easier to parse (e.g. gnt-instance list
|grep ERROR), we also modify the default field list to use this instead
of the admin/oper state fields.

Reviewed-by: imsnah

16 years agoCode style updates for QA code.
Michael Hanselmann [Thu, 14 Feb 2008 15:39:33 +0000 (15:39 +0000)]
Code style updates for QA code.

Reviewed-by: iustinp

16 years agoParse double protocol version in drbd8.2
Guido Trotter [Tue, 12 Feb 2008 17:06:11 +0000 (17:06 +0000)]
Parse double protocol version in drbd8.2

DRBD 8.2 uses a double integer field ad protocol version, rather than a single
one. This patch fixes the ganeti parsing code, allowing both the old and the
new version type. In order to do so the internal _GetVersion function is
changed to return a dict, rather than a list, and the second protocol field is
added, only if present, as proto2.

This is a fix for issue 24.

Reviewed-by: iustinp

16 years agoFix a wrong OP_ID added in r261
Iustin Pop [Sun, 10 Feb 2008 12:10:26 +0000 (12:10 +0000)]
Fix a wrong OP_ID added in r261

Reviewed-by: ultrotter

16 years agoShared Lock implementation and unit tests.
Guido Trotter [Fri, 8 Feb 2008 11:23:40 +0000 (11:23 +0000)]
Shared Lock implementation and unit tests.

Adding a locking.py file for the ganeti locking library. Its first component is
the implementation of a non-recursive blocking shared lock complete with a
testing library.

Reviewed-by: imsnah, iustinp

16 years agoDocument the client API protocol, first version
Iustin Pop [Wed, 6 Feb 2008 11:29:07 +0000 (11:29 +0000)]
Document the client API protocol, first version

This patch adds some documentation about the proposed client API. It's
not yet complete, but should be a usable draft for the initial
implementation.

Reviewed-by: ultrotter

16 years agoAdd a test opcode that sleeps for a given duration
Iustin Pop [Tue, 5 Feb 2008 14:12:09 +0000 (14:12 +0000)]
Add a test opcode that sleeps for a given duration

This can be used for testing purposes.

Reviewed-by: ultrotter,imsnah

16 years agoReduce the chance of DRBD errors with stale primaries
Iustin Pop [Tue, 5 Feb 2008 13:33:00 +0000 (13:33 +0000)]
Reduce the chance of DRBD errors with stale primaries

This patch is a first step in reducing the chance of causing DRBD
activation failures when the primary node has not-perfect data.

This issue is more seen with DRBD8, which has an 'outdate' state (in
which it can get more often). But it can (and before this patch, usually
will) happen with both 7 and 8 in the case the primary has data to sync.

The error comes from the fact that, before this patch, we activate the
primary DRBD device and immediately (i.e. as soon as we can run another
shell command) we try to make it primary. This might fail - since the
primary knows it has some data to catch up to - but we ignored this
error condition. The failure was visible later, in either md failing to
activate over a read-only storage or by instance failing to start.

The patch has two parts: one affecting bdev.py, which changes failures
in BlockDev.Open() from returning False to raising
errors.BlockDeviceError; noone (except a generic method inside bdev.py)
checked this return value and we logged it but the master didn't know
about it; now all classes raise errors from Open if they have a failure.

The other part, affecting cmdlib.py, changes the activation sequence
from:
  - activate on primary node as primary and secondary as secondary, in
    whatever order a function returns the nodes
to the following:
  - activate all drives as secondaries, on both the primary and the
    secondary nodes of the instance
  - after that, on the primary node, re-activate the device stack as
    primary

This is in order to give the chance to DRBD to connect and make the
handshake. As noted in the comments, this just increases the chances of
a handshake/connect, not fixing entirely the problem. However, it is a
good first step and it passes all tests of starting with stale (either
full or partial) primaries, with both drbd 7 and 8, and also passes a
burnin.

Note that the patch might make the device activation a little bit
slower, but it is a reasonable trade-off.

Reviewed-by: imsnah

16 years agoFix some indendation issues
Iustin Pop [Mon, 4 Feb 2008 14:33:15 +0000 (14:33 +0000)]
Fix some indendation issues

Reviewed-by: imsnah

16 years agoFix incomplete mac address export to hooks
Iustin Pop [Mon, 4 Feb 2008 14:28:15 +0000 (14:28 +0000)]
Fix incomplete mac address export to hooks

This patch completes the change introduced in r566 (trunk) and r568
(branch-1.2).

Reviewed-by: imsnah