ganeti-local
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

16 years agoGive mac information to instance hooks
Guido Trotter [Thu, 31 Jan 2008 13:22:56 +0000 (13:22 +0000)]
Give mac information to instance hooks

Currently just the bridge and ip address are passed. Add an environment
variable for the mac address.

Reviewed-by: iustinp

16 years agoMake the mouse more usable in VNC for HVM.
Alexander Schreiber [Thu, 31 Jan 2008 12:38:17 +0000 (12:38 +0000)]
Make the mouse more usable in VNC for HVM.

Reviewed-by: imsnah

16 years agoExport bridge information too
Guido Trotter [Wed, 30 Jan 2008 11:14:36 +0000 (11:14 +0000)]
Export bridge information too

gnt-backup export used to export the ip and mac of each nic, but not which
bridge it was connected to. Adding this information.

Reviewed-by: iustinp

16 years agoFix online help for gnt-backup import
Guido Trotter [Wed, 30 Jan 2008 11:14:04 +0000 (11:14 +0000)]
Fix online help for gnt-backup import

The help string missed drbd as a disk template option. Adding it.

Reviewed-by: iustinp

16 years agoBump version numbers for the 1.2.2 release
Iustin Pop [Wed, 30 Jan 2008 10:54:22 +0000 (10:54 +0000)]
Bump version numbers for the 1.2.2 release

Reviewed-by: ultrotter

16 years agotiny typo fix
Alexander Schreiber [Mon, 28 Jan 2008 16:22:50 +0000 (16:22 +0000)]
tiny typo fix

Reviewed-by: iustinp

16 years agoImprove the documentation of query output fields
Iustin Pop [Mon, 28 Jan 2008 14:32:47 +0000 (14:32 +0000)]
Improve the documentation of query output fields

The gnt-node and gnt-instance list commands have a customizable list of
output fields, but the list is not up to date (in the man page) and not
easily understandable from the ‘--help’ output.

This patch updates the man pages and adds the available fields and
default fields in the ‘--help’ output, as part of the description.

Example:
Usage
=====
  gnt-node list

Lists the nodes in the cluster. The available fields are (see the man page for
details): name, pinst_cnt, pinst_list, sinst_cnt, sinst_list, pip, sip,
dtotal, dfree, mtotal, mnode, mfree, bootid. The default field list is (in
order): name, dtotal, dfree, mtotal, mnode, mfree, pinst_cnt, sinst_cnt.

Reviewed-by: imsnah,ultrotter

16 years agoFix a typo in a devel/upload comment
Guido Trotter [Mon, 28 Jan 2008 13:35:23 +0000 (13:35 +0000)]
Fix a typo in a devel/upload comment

Files are uploaded to $prefix/sbin, not $prefix/bin

Reviewed-by: iustinp

16 years agoAdd QA tests for gnt-instance modify
Iustin Pop [Mon, 28 Jan 2008 13:33:19 +0000 (13:33 +0000)]
Add QA tests for gnt-instance modify

This patch adds QA tests for most of the possible parameters in the
instance modify operation (exception being the MAC), and modifies the
sample QA file to run this test.

It also tests the no-modification test, but that is a weak one: we only
test that the exit code is one, not that the command gave a proper
response ("... please give at least one parameter") as opposed to a
traceback.

Reviewed-by: imsnah

16 years agoAdd option for the number of VCPUs in instance listing
Iustin Pop [Mon, 28 Jan 2008 11:51:47 +0000 (11:51 +0000)]
Add option for the number of VCPUs in instance listing

Reviewed-by: ultrotter

16 years agoAllow selection of hypervisor type in QA
Iustin Pop [Mon, 28 Jan 2008 10:43:38 +0000 (10:43 +0000)]
Allow selection of hypervisor type in QA

This patch allows the selection of the hypervisor type for the QA
process; this is useful when testing hypervisor-independent changes that
don't require a Xen setup.

The patch also fixes the OS name in the sample QA config file provided.

Reviewed-by: imsnah

16 years agoFix "gnt-instance modify --initrd"
Iustin Pop [Mon, 28 Jan 2008 09:03:03 +0000 (09:03 +0000)]
Fix "gnt-instance modify --initrd"

The new QA tests for instance modify uncovered a bug in the modify
initrd operation when setting the initrd to none.

Reviewed-by: imsnah

16 years agoFix gnt-instance modify breakage due to hvm_boot_order
Iustin Pop [Sun, 27 Jan 2008 17:08:53 +0000 (17:08 +0000)]
Fix gnt-instance modify breakage due to hvm_boot_order

As reported by hypnoce@gmail.com, this is missing a check on None. As we don't
care about uppercase, we keep the check simple by removing the lower() call.

Reviewed-by: ultrotter

16 years agoAdd a missing parenthesis
Guido Trotter [Fri, 25 Jan 2008 15:36:37 +0000 (15:36 +0000)]
Add a missing parenthesis

It was wrongly deleted when converting

if a in dict.keys():
to
if a in dict:

Reviewed-by: imsnah

16 years agoChange the install directory for the tools
Iustin Pop [Tue, 22 Jan 2008 07:12:04 +0000 (07:12 +0000)]
Change the install directory for the tools

Currently, the tools are installed under $prefix/share/ganeti. This
prevents installing other things in a nice way under share/ganeti (like
arch-independent OS definitions), therefore we want the tools to live
under share/ganeti/tools.

A second change is that since these are programs, they would better live
under libdir than datadir - we might have to change them later to
binaries in which case 'share' is definitely not the way to go.

This patch therefore changes the install directory for the tools to
$prefix/lib/ganeti/tools.

Reviewed-by: imsnah

16 years agoRemove qa tests for gnt-instance start/stop
Guido Trotter [Mon, 21 Jan 2008 16:57:28 +0000 (16:57 +0000)]
Remove qa tests for gnt-instance start/stop

Those tests were added in the wrong place. This patch removes them.  One day
we'll implement proper command line regression testing and they should go in
there.

Reviewed-by: iustinp

16 years agoTest start/stop aliases in qa
Guido Trotter [Mon, 21 Jan 2008 16:29:26 +0000 (16:29 +0000)]
Test start/stop aliases in qa

This tests both that those two aliases have not been removed and also that
aliases handling hasn't been broken.

Reviewed-by: iustinp

16 years agoAdd a few aliases for startup/shutdown
Guido Trotter [Mon, 21 Jan 2008 16:29:08 +0000 (16:29 +0000)]
Add a few aliases for startup/shutdown

These aliases are widely used to think of these operations and save some typing
too. Even though there is some thought to make start/stop the default operation
name I don't think this should happen for 1.2, for now adding it as an alias is
fine.

Reviewed-by: iustinp

16 years agoAdd the first command alias
Guido Trotter [Mon, 21 Jan 2008 16:28:48 +0000 (16:28 +0000)]
Add the first command alias

Alias activate_block_devs to activate-disks, for ganeti 1.1 compatibility.

Reviewed-by: iustinp

16 years agoAdd support for command aliases
Guido Trotter [Mon, 21 Jan 2008 16:28:30 +0000 (16:28 +0000)]
Add support for command aliases

Passing a new aliases dict to generic main we can easily support aliases for
compatibility reasons or simply useability.

Reviewed-by: iustinp

16 years agoAdd tool to ease testing of unsubmitted patches
Guido Trotter [Mon, 21 Jan 2008 16:18:53 +0000 (16:18 +0000)]
Add tool to ease testing of unsubmitted patches

The upload tool can be used to submit the current code to an arbitrary list of
nodes. This helps developers in easily testing their changes before submitting
them.

Reviewed-by: iustinp

16 years agoCheck that we have a valid export list
Guido Trotter [Mon, 21 Jan 2008 16:17:12 +0000 (16:17 +0000)]
Check that we have a valid export list

Before iterating over the list of exports present on a node, check that what
ganeti returned is actually a list. This solves the case when one of the nodes
is down, and an error value is returned.

This fixes issue 21

Reviewed-by: imsnah

16 years agoFix VG listing broken by r510
Iustin Pop [Mon, 21 Jan 2008 14:33:04 +0000 (14:33 +0000)]
Fix VG listing broken by r510

LVM code sometimes adds an extra separator at the end of the field list.
Make the code strip it if exists.

Reviewed-by: imsnah

16 years agoMake backend._GetVGInfo check the validity of 'vgs'
Iustin Pop [Sun, 20 Jan 2008 22:13:16 +0000 (22:13 +0000)]
Make backend._GetVGInfo check the validity of 'vgs'

Currently, the function backend._GetVGInfo only checks for errors via
the exit code of the 'vgs' command. However, there are other ways of
failure so we need to also check for valid output before parsing.

Furthermore, the checks on the exit code were reported via a 'raise
LVMError', however this exception is not handled anywhere and so the
remote caller will not get reasonable data.

This patch does two main things:
  - change the calling protocol for this function to not raise an error,
    and instead return the same type of argument always (dict) with the
    requested keys but values changed into None; this allows in the
    parent rpc call node_info to have valid memory information but
    "error" value for disk space, if there's an error with disks
  - check the validity of the output so that in case we fail to parse
    it, we don't abort with a backtrace in the node daemon but instead
    return the default result value (containing errors), and log these
    cases in the node daemon log file

We also bump the protocol version to 11.

Reviewed-by: ultrotter

16 years agoFix checking of node free disk in CreateInstance
Iustin Pop [Sun, 20 Jan 2008 22:12:55 +0000 (22:12 +0000)]
Fix checking of node free disk in CreateInstance

This patch does two things:
  - checks that the result values from call_node_info are valid integer
    values and aborts otherwise
  - skips disk space computation for the DT_DISKLESS case

The most important point of the patch is the verification of results
from the rpc call, as it prepares for a patch that allows failures to be
better reported from the remote node.

Reviewed-by: ultrotter

16 years agoAbstract node memory checking into a separate function
Iustin Pop [Sun, 20 Jan 2008 22:12:27 +0000 (22:12 +0000)]
Abstract node memory checking into a separate function

The checking of a node's free memory (via rpc.call_node_info) is done in
both start instance an failover. This patch abstracts this call,
together with the appropriate error handling, into a separate function
called _CheckNodeFreeMemory.

The patch also has some related changes:
  - the check is done in prereq and not in exec for start instance
  - the redundant check in exec for failover has been removed

Reviewed-by: ultrotter

16 years agoChange a hardcoded path into its proper constant
Iustin Pop [Sun, 20 Jan 2008 22:09:31 +0000 (22:09 +0000)]
Change a hardcoded path into its proper constant

The function backend.UploadFile still uses "/etc/hosts" directly instead
of the existing constant; this patch fixes this.

Reviewed-by: ultrotter

16 years agoAllow use of 'diskless' disk template in burnin
Iustin Pop [Sun, 20 Jan 2008 22:07:35 +0000 (22:07 +0000)]
Allow use of 'diskless' disk template in burnin

Even if this doesn't have any practical use for actually creating
instances, it can be used for very fast burnin and testing just the
add/start/stop/remove functionality.

This has also revealed a bug in export/import related to diskless
instances, so it's educational value is proved.

Reviewed-by: ultrotter

16 years agoFix run directory for the fake hypervisor
Iustin Pop [Sun, 20 Jan 2008 22:02:52 +0000 (22:02 +0000)]
Fix run directory for the fake hypervisor

Currently the fake hypervisor has hardcoded ‘/var/run’ as a base
directory for its store. This patch adds a constant RUN_DIR that is used
for both the fake hypervisor and for BDEV_CACHE_DIR.

Reviewed-by: ultrotter

16 years agoFix the init.d script
Iustin Pop [Sun, 20 Jan 2008 13:55:17 +0000 (13:55 +0000)]
Fix the init.d script

The script (which is geared towards Debian) is actually not fully
compliant, as lintian generates a warning on it - the S runlevel is not
a valid one in the "Stop" stanza. This patch removes "S" from the stop
list.

Reviewed-by: imsnah

16 years agoFix the make dist rule
Iustin Pop [Fri, 18 Jan 2008 16:07:26 +0000 (16:07 +0000)]
Fix the make dist rule

In revision 459 I added a bug in the make dist rule in the sense that
the archive will include *all* of test/data directory, including the
.svn directory if it exists.

This patch fixes that problem and adds a distcheck hook that tests for
such errors in the future (files/directories matching the .svn and .git
patterns).

It also fixes a typo in the NEWS file.

Reviewed-by: imsnah

16 years agoBump version numbers for the 1.2.1 release
Iustin Pop [Fri, 18 Jan 2008 15:19:07 +0000 (15:19 +0000)]
Bump version numbers for the 1.2.1 release

This a merge to trunk of revision 494.

Reviewed-by: imsnah

16 years agoShow the HVM boot order in instance info
Iustin Pop [Wed, 16 Jan 2008 16:01:33 +0000 (16:01 +0000)]
Show the HVM boot order in instance info

This is a merge from the 1.2 branch

Reviewed-by: imsnah

16 years agoTwo small style fixes
Iustin Pop [Wed, 16 Jan 2008 16:01:14 +0000 (16:01 +0000)]
Two small style fixes

This is a merge from the 1.2 branch

Reviewed-by: imsnah

16 years agoMake instance start/stop skippable at burnin time
Guido Trotter [Mon, 14 Jan 2008 16:03:39 +0000 (16:03 +0000)]
Make instance start/stop skippable at burnin time

Even though burnin was born just to do that test it now contains a lot more
things one might try, so it makes sense to make instance start/stop optional
too.

This creates a burnin that at the bare minimum tests instance create and
remove, if all the --no options are specified, but usually does a lot more.

Reviewed-by: iustinp

16 years agoDo instance export and import during burnin
Guido Trotter [Mon, 14 Jan 2008 16:01:51 +0000 (16:01 +0000)]
Do instance export and import during burnin

Instances get exported to a remote node, then removed and imported back to
their original nodes. This should be an idempotent option from the instance
point of view, and help making sure ImportExport is kept up to date.

It will also help making burnin take a lot longer, which is nice to take a nap.
"...but I'm doing a cluster burnin...". Unfortunately this subfeature is a bit
jeopardized by the fact that the new code can be skipped with the
--no-importexport option, but nobody needs to know that, do they?

Reviewed-by: iustinp

16 years agoAllow burnin to take "-t plain" as an option
Iustin Pop [Mon, 14 Jan 2008 15:11:08 +0000 (15:11 +0000)]
Allow burnin to take "-t plain" as an option

The burnin code deals with "-t plain", but the command line parser
doesn't allow that as an option. This patch fixes this issue.

Reviewed-by: ultrotter

16 years agoFix some misspellings
Iustin Pop [Mon, 14 Jan 2008 15:10:18 +0000 (15:10 +0000)]
Fix some misspellings

This patch fixes two name typos and a style issue (which makes pylint
complain).

Reviewed-by: ultrotter

16 years agoFix CreateInstance new optional parameters
Guido Trotter [Mon, 14 Jan 2008 14:19:11 +0000 (14:19 +0000)]
Fix CreateInstance new optional parameters

Some new paramenters of the CreateInstance opcode are optional (namely
kernel_path, initrd_path and hvm_boot_order) but their absence makes the code
crash. Fix this by initializing them to a default value if they're not present.

Reviewed-by: iustinp

16 years agoAdd mac="auto" at import time
Guido Trotter [Mon, 14 Jan 2008 12:22:39 +0000 (12:22 +0000)]
Add mac="auto" at import time

Mac is now a mandatory option for OpCreateInstance. Add it when we call this
opcode at import time too. This is a quick fix for the code, but probably more
work needs to be done to integrate mac addresses with the import/export
functionality in a nice way.

Reviewed-by: iustinp

16 years agoSupport selecting the boot device order for HVM.
Alexander Schreiber [Fri, 11 Jan 2008 12:13:22 +0000 (12:13 +0000)]
Support selecting the boot device order for HVM.

This patch adds support for specifying and changing the boot device order for
HVM instances. The boot device order specification is ignored for non HVM
instances.

Reviewed-by: iustinp

16 years agoComplete --node description for gnt-backup(8)
Guido Trotter [Thu, 10 Jan 2008 11:42:29 +0000 (11:42 +0000)]
Complete --node description for gnt-backup(8)

The second paramenter of --node was not described in gnt-backup. Add
information about it.

Reviewed-by: imsnah

16 years agoUpdate gnt-backup(8) -m option explanation
Guido Trotter [Thu, 10 Jan 2008 11:42:12 +0000 (11:42 +0000)]
Update gnt-backup(8) -m option explanation

Copy it from gnt-instance(8) for uniformity

Reviewed-by: imsnah

16 years agoAdd the --swap-size option gnt-backup(8)
Guido Trotter [Thu, 10 Jan 2008 11:41:56 +0000 (11:41 +0000)]
Add the --swap-size option gnt-backup(8)

Reviewed-by: imsnah

16 years agognt-backup import doesn't allow to chose the os
Guido Trotter [Thu, 10 Jan 2008 11:41:40 +0000 (11:41 +0000)]
gnt-backup import doesn't allow to chose the os

Since it's an import the os is implied to be the one which performed the
export. No -o option is accepted. Reflect this in the manpage.

Reviewed-by: imsnah

16 years agoFix gnt-backup import -s option
Guido Trotter [Thu, 10 Jan 2008 11:41:22 +0000 (11:41 +0000)]
Fix gnt-backup import -s option

Update gnt-backup import to be in line with gnt-instance add about the os disk
size option. Thanks to Gunnar Wagenknecht for spotting the issue.

Reviewed-by: imsnah

16 years agoAdd boot_order entry to Instance object.
Alexander Schreiber [Wed, 9 Jan 2008 13:02:21 +0000 (13:02 +0000)]
Add boot_order entry to Instance object.

First step to support custom boot device order for HVM instances, add a
location to actually store that information for the instance.

Reviewed-by: iustinp

16 years agoAdd the new OpCreateInstance parameters to burnin
Iustin Pop [Tue, 8 Jan 2008 16:16:43 +0000 (16:16 +0000)]
Add the new OpCreateInstance parameters to burnin

Reviewed-by: schreiberal

16 years agoFix gnt-instance modify breakage introduced in r462
Iustin Pop [Tue, 8 Jan 2008 16:16:23 +0000 (16:16 +0000)]
Fix gnt-instance modify breakage introduced in r462

Reviewed-by: schreiberal

16 years agoUpdate manpages with the kernel/initrd options
Iustin Pop [Tue, 8 Jan 2008 11:04:21 +0000 (11:04 +0000)]
Update manpages with the kernel/initrd options

This patch modifes the ‘gnt-instance’ instance manpage with the new
‘--kernel’ and ‘--initrd’ options.

Reviewed-by: imsnah