ganeti-local
16 years agoDo not install init script in PREFIX/bin.
Michael Hanselmann [Tue, 9 Oct 2007 13:01:20 +0000 (13:01 +0000)]
Do not install init script in PREFIX/bin.

Reviewed-by: ultrotter

16 years agoRefactor DiagnoseOS
Guido Trotter [Tue, 9 Oct 2007 11:15:23 +0000 (11:15 +0000)]
Refactor DiagnoseOS

The new version debugs Hidden OSes as well.

Reviewed-by: iustinp

16 years agoFix a wrong exception name
Iustin Pop [Tue, 9 Oct 2007 09:13:56 +0000 (09:13 +0000)]
Fix a wrong exception name

This was introduced in rev 208.

Reviewed-by: imsnah

16 years agoSeparate error formatting out of cli.GenericMain
Iustin Pop [Tue, 9 Oct 2007 09:13:38 +0000 (09:13 +0000)]
Separate error formatting out of cli.GenericMain

This patch moves the error formatting into a separate function that will
be exported so that scripts that execute multiple opcodes can create the
same output as for GenericMain. Also, GenericMain becomes more readable.

Reviewed-by: imsnah

16 years agoRevert a debugging 'raise' from rev 195
Iustin Pop [Tue, 9 Oct 2007 07:42:30 +0000 (07:42 +0000)]
Revert a debugging 'raise' from rev 195

As far as I understand, this was just a debugging aid. Remove it so that
configuration errors are nicely handled.

Reviewed-by: imsnah

16 years agoEnhance cli.SubmitOpcode to use custom parameters
Iustin Pop [Tue, 9 Oct 2007 07:39:34 +0000 (07:39 +0000)]
Enhance cli.SubmitOpcode to use custom parameters

This patch allows the SubmitOpcode function to take a pre-created
Processor instance and a different feedback function. This is helpful
when submitting more than one opcode from a shell script.

Reviewed-by: imsnah

16 years agoAdd boot id to “gnt-node list”.
Michael Hanselmann [Mon, 8 Oct 2007 15:18:54 +0000 (15:18 +0000)]
Add boot id to “gnt-node list”.

Reviewed-by: iustinp

16 years agoAdd handler for errors.TagError
Iustin Pop [Mon, 8 Oct 2007 15:12:28 +0000 (15:12 +0000)]
Add handler for errors.TagError

This patch adds a simple handler for TagError that prints the error
(better than having a stack dump).

Reviewed-by: imsnah

16 years agoAdd source file option for {add,remove}-tags
Iustin Pop [Mon, 8 Oct 2007 15:12:11 +0000 (15:12 +0000)]
Add source file option for {add,remove}-tags

This patch adds a '--from' option to the {add,remove}-tags commands that
allows the command to read from a file or from stdin (when passing a
dash for the filename).

Reviewed-by: imsnah

16 years agoUpdate man pages for the tags operations
Iustin Pop [Mon, 8 Oct 2007 15:11:45 +0000 (15:11 +0000)]
Update man pages for the tags operations

This adds documentation on the {list,add,remove}-tags commands to the
gnt-{cluster,node,instance} man pages.

Reviewed-by: imsnah

16 years agoChange gnt-cluster.sgml to use refsect2
Iustin Pop [Mon, 8 Oct 2007 15:11:28 +0000 (15:11 +0000)]
Change gnt-cluster.sgml to use refsect2

This brings this man page in conformity to gnt-node and (partially) to
gnt-instance.

Reviewed-by: imsnah

16 years agoImplement command-line tags support
Iustin Pop [Mon, 8 Oct 2007 15:11:14 +0000 (15:11 +0000)]
Implement command-line tags support

This patch adds generic functions for tag manipulations to cli.py and
modifies gnt-{cluster,node,instance} to export {list,add,remove}-tags
commands that use those.

Reviewed-by: imsnah

16 years agoChange tags add/remove to process multiple tags
Iustin Pop [Mon, 8 Oct 2007 15:10:52 +0000 (15:10 +0000)]
Change tags add/remove to process multiple tags

This patch changes the tags opcodes to work with multiple tags at once
instead of only one. As such, the opcodes and some parameters are
renamed.

Reviewed-by: imsnah

16 years agoFix super() calls for objects.Cluster
Iustin Pop [Mon, 8 Oct 2007 15:10:34 +0000 (15:10 +0000)]
Fix super() calls for objects.Cluster

Reviewed-by: imsnah

16 years agoFix tags operations for instances
Iustin Pop [Mon, 8 Oct 2007 15:10:18 +0000 (15:10 +0000)]
Fix tags operations for instances

Reviewed-by: imsnah

16 years agoExtend GenericMain with a way to override options
Iustin Pop [Mon, 8 Oct 2007 14:42:03 +0000 (14:42 +0000)]
Extend GenericMain with a way to override options

This allows scripts to pass options to generic functions (options that
are not visible in the command line).

Reviewed-by: imsnah

16 years agoDon't remove Makefile.in when doing maintainer-clean.
Michael Hanselmann [Mon, 8 Oct 2007 14:26:53 +0000 (14:26 +0000)]
Don't remove Makefile.in when doing maintainer-clean.

Reviewed-by: iustinp

16 years agoUse indenting if supported by simplejson.
Michael Hanselmann [Mon, 8 Oct 2007 10:48:35 +0000 (10:48 +0000)]
Use indenting if supported by simplejson.

Reviewed-by: iustinp

16 years agoFix “make distcheck”.
Michael Hanselmann [Mon, 8 Oct 2007 10:03:17 +0000 (10:03 +0000)]
Fix “make distcheck”.

- Move symlink to “ganeti” to top dir
- Add ganeti.config_unittest.py to tests to be run
- Make sure everything is built before tests are run

Reviewed-by: iustinp

16 years agoAdd function to list files in a directory, excluding those beginning with a
Michael Hanselmann [Mon, 8 Oct 2007 08:59:26 +0000 (08:59 +0000)]
Add function to list files in a directory, excluding those beginning with a
dot.

Reviewed-by: iustinp

16 years agoRemove redundant check.
Guido Trotter [Thu, 4 Oct 2007 15:49:40 +0000 (15:49 +0000)]
Remove redundant check.

This isdir() check leads to a broken error message. Even fixing it creates some
cases in which the error message is nebulous and unclear while removing it
makes this situation be dealt with a lot better by the _OSOndiskVersion checks.

Reviewed-by: iustinp

16 years agoForgotten files from last commit, NEWS and Makefile.am.
Michael Hanselmann [Thu, 4 Oct 2007 12:40:57 +0000 (12:40 +0000)]
Forgotten files from last commit, NEWS and Makefile.am.

Reviewed-by: iustinp, ultrotter

16 years agoShip (and display) path for InvalidOS errors too.
Guido Trotter [Thu, 4 Oct 2007 11:51:25 +0000 (11:51 +0000)]
Ship (and display) path for InvalidOS errors too.

- Document the expected change to errors.InvalidOS
- Always pass the additional argument
- Modify DiagnoseOS output to show the path

Reviewed-by: iustinp, imsnah

16 years agoChange configuration storage format from Pickle to JSON.
Michael Hanselmann [Thu, 4 Oct 2007 11:33:32 +0000 (11:33 +0000)]
Change configuration storage format from Pickle to JSON.

- Add NEWS file with major changes between versions.
- Bump RPC version number
- No longer serialize in RPC, but just convert to dict

Old Pickle based configuration files can be converted using the cfgupgrade
utility.

Reviewed-by: iustinp, ultrotter

16 years agoFix OS Diagnose in light of the new OS Search path (Part One).
Guido Trotter [Thu, 4 Oct 2007 10:41:28 +0000 (10:41 +0000)]
Fix OS Diagnose in light of the new OS Search path (Part One).

As of now only the last OS was taken into consideration by diagnose, fix by
storing them all and displaying for now only the first. Also display the source
path for valid OSes.

Reviewed-by: imsnah

16 years agoSecond part of the OS search path cleanup
Guido Trotter [Wed, 3 Oct 2007 14:11:44 +0000 (14:11 +0000)]
Second part of the OS search path cleanup

Abstract the _OSSearch function, to look for an OS in the search path
Make OSFromDisk accept an optional base_dir, rather than the os_dir itself

Reviewed-by: iustinp

16 years agoMake parameter os_dir mandatory for _OSOndiskversion.
Guido Trotter [Wed, 3 Oct 2007 11:21:14 +0000 (11:21 +0000)]
Make parameter os_dir mandatory for _OSOndiskversion.

First part of the OS search path cleanup. _OSOndiskversion is only ever called
once, and with that argument set, so let's make it mandatory.

Reviewed-by: iustinp

16 years agoAdd warning on gnt-node add operation.
Guido Trotter [Tue, 2 Oct 2007 12:50:59 +0000 (12:50 +0000)]
Add warning on gnt-node add operation.

People might not have read all the documentation and might not expect their ssh configuration
and specially keys to be changed. Adding this warning will inform them before it happens.

Reviewed-by: iustinp

16 years agoPrint automake warnings.
Michael Hanselmann [Tue, 2 Oct 2007 07:41:01 +0000 (07:41 +0000)]
Print automake warnings.

Reviewed-by: ultrotter

16 years agoImport utils into unittest.
Michael Hanselmann [Mon, 1 Oct 2007 14:31:28 +0000 (14:31 +0000)]
Import utils into unittest.

Reviewed-by: schreiberal

16 years agoChange constants.OS_DIR with constants.OS_SEARCH_PATH which includes all the
Guido Trotter [Fri, 28 Sep 2007 09:39:15 +0000 (09:39 +0000)]
Change constants.OS_DIR with constants.OS_SEARCH_PATH which includes all the
directories which can contain OS scripts.

The list defaults to the current one but can be changed at configure time.

Reviewed-by: imsnah

16 years agoMake the default export path configurable.
Guido Trotter [Thu, 27 Sep 2007 16:02:57 +0000 (16:02 +0000)]
Make the default export path configurable.

This is needed to improve FHS compliance for distribution integration.
The need was discussed on the alioth pkg-ganeti project.

Reviewed-by: imsnah

16 years agoPrevent race condition in CreateBackup().
Michael Hanselmann [Thu, 27 Sep 2007 13:03:08 +0000 (13:03 +0000)]
Prevent race condition in CreateBackup().

Reviewed-by: ultrotter

16 years agoAdd more QA tests.
Michael Hanselmann [Thu, 27 Sep 2007 13:00:10 +0000 (13:00 +0000)]
Add more QA tests.

Added tests:
- “gnt-cluster getmaster”
- “gnt-cluster version”
- “gnt-instance list”
- “gnt-instance reinstall”

Reviewed-by: schreiberal

16 years agoSpecify in the helpstring that --with-ssh-initscripts expects an argument
Guido Trotter [Thu, 27 Sep 2007 12:20:13 +0000 (12:20 +0000)]
Specify in the helpstring that --with-ssh-initscripts expects an argument

Reviewed-by: imsnah

16 years agoPass required ip_check parameter to OpCreateInstance in gnt-backup.
Michael Hanselmann [Thu, 27 Sep 2007 12:18:30 +0000 (12:18 +0000)]
Pass required ip_check parameter to OpCreateInstance in gnt-backup.

Reviewed-by: ultrotter

16 years agoEnhance QA.
Michael Hanselmann [Wed, 26 Sep 2007 18:27:58 +0000 (18:27 +0000)]
Enhance QA.

- Test “gnt-backup export” and “gnt-backup import”.
- Move “ResolveInstanceName” to qa_utils.py.
- Fix tests for “ganeti-watcher”.
- Make instance shutdown and startup configurable.

Reviewed-by: schreiberal

16 years agoIntegrate Leonardo's LSB init script patch
Guido Trotter [Tue, 25 Sep 2007 14:22:41 +0000 (14:22 +0000)]
Integrate Leonardo's LSB init script patch

Reviewed-By: imsnah

16 years agoRename constants for SSH init script by Iustin's request.
Michael Hanselmann [Tue, 25 Sep 2007 13:04:25 +0000 (13:04 +0000)]
Rename constants for SSH init script by Iustin's request.

Reviewed-by: iustinp

16 years agoIgnore man/*.in.
Michael Hanselmann [Tue, 25 Sep 2007 11:41:53 +0000 (11:41 +0000)]
Ignore man/*.in.

Reviewed-by: ultrotter

16 years agoAdd configure option for init.d/ssh script. This is useful for distributions
Michael Hanselmann [Tue, 25 Sep 2007 11:41:20 +0000 (11:41 +0000)]
Add configure option for init.d/ssh script. This is useful for distributions
with the script named differently than Debian.

Reviewed-by: ultrotter

16 years agoRemove mkdir from man/Makefile.am because mktemp creates the directory before.
Guido Trotter [Mon, 24 Sep 2007 15:03:14 +0000 (15:03 +0000)]
Remove mkdir from man/Makefile.am because mktemp creates the directory before.

Thanks to Christoph Rauch for reporting the problem.

Reviewed-By: iustinp

16 years agoReplace paths in ganeti-watcher.sgml.
Michael Hanselmann [Mon, 24 Sep 2007 12:03:14 +0000 (12:03 +0000)]
Replace paths in ganeti-watcher.sgml.

Reviewed-by: iustinp

16 years agoImplement to/from dict conversion for ConfigObject(s)
Iustin Pop [Mon, 24 Sep 2007 08:41:50 +0000 (08:41 +0000)]
Implement to/from dict conversion for ConfigObject(s)

This change allows instances of ConfigObject and its children to be
converted to and from standard python types. This will allow easier
upgrade of the configuration and use of any serialization protocol (not
only pickle).

The code is not very nice (a little too verbose, I think) but it works.
Tested on a 2-node, 3-instance cluster by doing repeated conversions and
checking consistency of results.

Reviewed-by: imsnah

16 years agoChange class hierarchy in objects.py
Iustin Pop [Fri, 21 Sep 2007 14:59:56 +0000 (14:59 +0000)]
Change class hierarchy in objects.py

It makes sense to make the TaggableObject a child of the ConfigObject,
since in this case we can derive the Instance, Node and Cluster objects
only from the TaggableObject and have a cleaner hierarchy.

For consistency child classes will have to declare their slots by adding
their parents on top.

Reviewed-by: imsnah,ultrotter

16 years agoRemove requirement that host names are FQDN
Iustin Pop [Fri, 21 Sep 2007 13:37:49 +0000 (13:37 +0000)]
Remove requirement that host names are FQDN

We currently require that hostnames are FQDN not short names
(node1.example.com instead of node1). We can allow short names as long
as:
  - we always resolve the names as returned by socket.gethostname()
  - we rely on having a working resolver

These issues are not as big as may seem, as we only did gethostname() in
a few places in order to check for the master; we already required
working resolver all over the code for the other nodes names (and thus
requiring the same for the current node name is normal).  The patch
moves some resolver calls from within execution path to the checking
path (which can abort without any problems). It is important that after
this patch is applied, no name resolving is called from the execution
path (LU.Exec() or other code that is called from within those methods)
as in this case we get much better code flow.

This patch also changes the functions for doing name lookups and
encapsulates all functionality in a single class.

The final change is that, by requiring working resolver at all times, we
can change the 'return None' into an exception and thus we don't have to
check manually each time; only some special cases will check
(ganeti-daemon and ganeti-watcher which are not covered by the
generalized exception handling in cli.py). The code is cleaner this way.

Reviewed-by: imsnah

16 years agoMove a constant from ganeti-master to constants.py
Iustin Pop [Fri, 21 Sep 2007 13:36:50 +0000 (13:36 +0000)]
Move a constant from ganeti-master to constants.py

The EXIT_NODESETUP_ERROR is a useful constant and ganeti-watcher could
use it too. This patch moves it to constants.py and modifed the
ganeti-master script to use it from there.

Reviewed-by: imsnah

16 years agoFix tools/burnin w.r.t. OpCreateInstance.ip_check
Iustin Pop [Fri, 21 Sep 2007 12:25:30 +0000 (12:25 +0000)]
Fix tools/burnin w.r.t. OpCreateInstance.ip_check

Since we added a new, required parameter to OpCreateInstance, we need to
update burnin to build the correct opcode.

Reviewed-by: schreiberal

16 years agoAdd __slots__ on TaggableObject
Iustin Pop [Fri, 21 Sep 2007 12:23:57 +0000 (12:23 +0000)]
Add __slots__ on TaggableObject

Unless we use __slots__ on all parents, we don't get the benefits that
__slots__ bring. This patch adds this attribute to the TaggableObject so
that Instances, Nodes and the Clusters behave as intended.

Reviewed-by: schreiberal,imsnah

16 years agoAsk for confirmation when touching multiple instances
Iustin Pop [Thu, 20 Sep 2007 07:26:20 +0000 (07:26 +0000)]
Ask for confirmation when touching multiple instances

This patch makes the new startup/shutdown multi-instance operations to
ask for confirmation when touching more than one instance (and unless
--force-multi is given).

The code is not very short, but it does present a nice (IMO) user
interface.

Reviewed-by: ultrotter

16 years agoImprove the cli.AskUser() function
Iustin Pop [Wed, 19 Sep 2007 14:24:52 +0000 (14:24 +0000)]
Improve the cli.AskUser() function

This patch improves the AskUser function by allowing it to:
 - choose from multiple choices (instead of only y/n)
 - give help to the user
 - preserve line breaks and whitespace formatting in the message

With this patch, an instance removal looks like this:
root@xen-test1-4:~# gnt-instance remove tsetest1
This will remove the volumes of the instance tsetest1 (including
mirrors), thus removing all the data of the instance. Continue?
y/[n]/?: ?
 y - Perform the operation
 n - Do not perform the operation

This will remove the volumes of the instance tsetest1 (including
mirrors), thus removing all the data of the instance. Continue?
y/[n]/?: y

The patch also removed the _ask_user member of the opts argument, since
external code was using it (and thus it makes no sense for it to be a
private member); now gnt-* scripts are using the AskUser function
directly.

Reviewed-by: ultrotter

16 years agoAllow 'add instance' to not start the new instance
Iustin Pop [Wed, 19 Sep 2007 13:52:34 +0000 (13:52 +0000)]
Allow 'add instance' to not start the new instance

This patch allows 'gnt-instance add' to not start the newly-created
instance. It also allow 'gnt-instance add' and 'gnt-backup import' to
not check for IP conflicts (only when not starting the instance).

Reviewed-by: ultrotter

16 years agoChange resolved hostname from dict to a class
Iustin Pop [Wed, 19 Sep 2007 06:56:49 +0000 (06:56 +0000)]
Change resolved hostname from dict to a class

The current result of utils.LookupHostname() is a dict, but this does
not allow static checkers to check the correctness of the code. This
patch introduces a new class names HostInfo and changes LookupHostname
to return an instance of this class; this allows better checking of the
code (and also the code is cleaner).

Reviewed-by: ultrotter

16 years agoImplement cluster rename operation
Iustin Pop [Tue, 18 Sep 2007 12:42:31 +0000 (12:42 +0000)]
Implement cluster rename operation

This patch adds a new OpCode (and corresponding LU) that implements the
cluster rename functionality.

This is done by shutting down the master role, making the needed sstore
modifications and distributing the changed files to all nodes, and then
re-enabling the master role.

The modification to the man page of gnt-cluster also moves the section
on gnt-cluster destroy in order to correct alphabetical ordering.

Reviewed-by: imsnah

16 years agoFix a docstring
Guido Trotter [Tue, 18 Sep 2007 08:06:27 +0000 (08:06 +0000)]
Fix a docstring

Reviewed-by: iustinp

16 years agoCleanup up selective imports for utils and utils unit test.
Alexander Schreiber [Mon, 17 Sep 2007 14:04:13 +0000 (14:04 +0000)]
Cleanup up selective imports for utils and utils unit test.

Reviewed-by: iustinp, imsnah

16 years agoA few minor fixes in backend.py
Iustin Pop [Mon, 17 Sep 2007 11:53:53 +0000 (11:53 +0000)]
A few minor fixes in backend.py

This uses the recently-added Instance.FindDisk() method instead of
hard coded find-disk code.

It also renames one parameter to AddNode from ssh to sshkey in order not
to shadow the ganeti.ssh module.

Reviewed-by: imsnah

16 years agoImplement instance rename operation
Iustin Pop [Mon, 17 Sep 2007 11:52:38 +0000 (11:52 +0000)]
Implement instance rename operation

This patch adds support for instance rename operation at all remaining
layers: RPC, OpCode/LU and CLI.

Reviewed-by: imsnah

16 years agoAdded TcpPing to do ping-alike via TCP connect(2) with defined source address.
Alexander Schreiber [Mon, 17 Sep 2007 11:18:49 +0000 (11:18 +0000)]
Added TcpPing to do ping-alike via TCP connect(2) with defined source address.
To be used to replace the currently fping(8) based reachability test.

Reviewed-by: imsnah

16 years agoAdd support for rename operation in the OS API
Iustin Pop [Mon, 17 Sep 2007 10:52:33 +0000 (10:52 +0000)]
Add support for rename operation in the OS API

This patch adds support for renaming at OS level. Because of this, we
need to bump up the version of the OS api from 4 to 5.

The patch also documents the new script interface in the
ganeti-os-interface(7) man page and adds a section on upgrading the OS
definitions to the new version.

Reviewed-by: imsnah

16 years agoAllow start/stop of multiple instances at once
Iustin Pop [Mon, 17 Sep 2007 09:12:45 +0000 (09:12 +0000)]
Allow start/stop of multiple instances at once

This is an initial version of the multi-instance start/stop, which
allows the gnt-instance startup and shutdown subcommands to work on
multiple instances at once.

The available selections are:
  - "gnt-instance startup --instance name..." which is the default, and
    if passed only one argument it behaves like the original command)
  - "gnt-instance startup --node name..." will work on all instances
    having either primary or secondary one of the passed names
  - "gnt-instance startup --primary name..." will work on all instances
    having primary node one of the passed names
  - "gnt-instance startup --secondary name..." will work on all
    instances having as secondary node one of the passed names
  - "gnt-instance startup --all" will work on all instances

This allows a simple cluster-wide shutdown or node shutdown (or
startup).

Note that this version stops at the first error - it will not try to
start the 2nd instance selected if there is a critical error with the
1st one.

Also note that this version is not faster than simply running manually
"gnt-instance shutdown NAME", because it doesn't parallelize the
shutdown/startup actions.

Reviewed-by: imsnah,roman.marxer

16 years agoAdd rename instance support to ConfigWriter
Iustin Pop [Mon, 17 Sep 2007 09:10:02 +0000 (09:10 +0000)]
Add rename instance support to ConfigWriter

This patch adds support for renaming instances to the ConfigWriter
class. It's needed in here in order to guarantee that we don't lose the
instance during the rename (the instance will be there, either with the
old name or with the new name).

Reviewed-by: imsnah

16 years agoDocumentation fix for missing dependencies
Iustin Pop [Sat, 15 Sep 2007 09:11:53 +0000 (09:11 +0000)]
Documentation fix for missing dependencies

I was getting into trouble with gnt-backup and discovered reading the
code of the debian-etch os image and the error logs that:
     1 - Debian os image shipped by ganeti depends on the availability
of dump and restore.

Based on that I had included in the section of "Installing the
Operating System support packages" the dependency of dump/restore and
the command to install dump/restore.

Author: Leonardo Rodrigues de Mello <l@lmello.eu.org>
Reviewed-by: iustinp

16 years agoChange OpQueryNodes nodes attribute to names
Iustin Pop [Fri, 14 Sep 2007 09:54:47 +0000 (09:54 +0000)]
Change OpQueryNodes nodes attribute to names

Change this to have the exact same parameters as OpQueryInstances.

Also fix burnin which is broken since r146.

Reviewed-by: imsnah

16 years agoEnable LUQueryInstances to work with a given list of instances
Iustin Pop [Fri, 14 Sep 2007 09:54:22 +0000 (09:54 +0000)]
Enable LUQueryInstances to work with a given list of instances

As per the changes to LUQueryNodes, the QueryInstances LU is modified to
accept a list of instances for which to compute and return information.

Reviewed-by: imsnah

16 years agoRemove OpQueryNodeData and LUQueryNodeData
Iustin Pop [Fri, 14 Sep 2007 09:03:12 +0000 (09:03 +0000)]
Remove OpQueryNodeData and LUQueryNodeData

Now that LUQueryNodes supports all the functionality of LUQueryNodeData,
let's migrate gnt-node.ShowNodeConfig to use it and remove all traces of
OpQueryNodeData and LUQueryNodeData.

Reviewed-by: imsnah

16 years agoChange LUQueryNodes to return raw values and support selective listing
Iustin Pop [Fri, 14 Sep 2007 09:02:56 +0000 (09:02 +0000)]
Change LUQueryNodes to return raw values and support selective listing

LUQueryNodes it's very similar to LUQueryNodeData, but it lacks two
features:
  - instance list (it has count though), both primary and secondary
  - selective node listing

In order to support these features, we change it to return raw values
instead of stringified ones (like the recent change to LUQueryInstances)
and to support query-ing of a restricted set of nodes.

This CL also modifies the gnt-node script to conform to the new protocol
and the opcode OpQueryNodes to support the new "nodes" attribute.

Reviewed-by: imsnah

16 years agoChange _GetWanted* to return names instead of objects
Iustin Pop [Fri, 14 Sep 2007 09:02:33 +0000 (09:02 +0000)]
Change _GetWanted* to return names instead of objects

On closer look, all except one of the current users of _GetWantedNodes are
using only the name of the nodes and throw away the other attributes. It makes
sense to make this function return only the name list (as in the future this
might be faster than computing all attributes).

Reviewed-by: imsnah

16 years agoSplit QA script into different modules.
Michael Hanselmann [Thu, 13 Sep 2007 12:46:25 +0000 (12:46 +0000)]
Split QA script into different modules.

Reviewed-by: iustinp

16 years agoMove string formatting out of LUQueryInstances
Iustin Pop [Thu, 13 Sep 2007 11:49:29 +0000 (11:49 +0000)]
Move string formatting out of LUQueryInstances

Currently, LUQueryInstances will provide strings for its results. This makes it
hard for other consumers than "gnt-instance list" to use the OpQueryInstances
opcode for whatever they wish to.

The change moves the formatting in five of the six cases where this happens to
the actual gnt-instance.ListInstances procedure and removes the unconditional
convert to string in LUQueryInstances.Exec()

Reviewed-by: imsnah

16 years agoFix the ssh change which breaks remote ssh commands
Iustin Pop [Thu, 13 Sep 2007 11:31:06 +0000 (11:31 +0000)]
Fix the ssh change which breaks remote ssh commands

Explanation: since we use lists and not a string, every argument we give
is passed unchanged to the remote shell. So, for example, passing
'/etc/init.d/ganeti restart' to the remote shell, it will try to run the
path /etc/init.d/ganeti\ restart. With the s space included. This
breaks, for example, gnt-node add and gnt-cluster command.

The original problem with the backup routines that led to the "'" change
is that they use a plain " ".join(list), but we don't need to quote the
whole ssh remote command for this. We can simply use the existing
utils.ShellQuoteCmd(list) which does the proper quoting of the ';' or
'&&' metacharacters.

With this change, both gnt-node add, gnt-cluster command and
export/import work.

This also improves the error-handling behaviour of one cat command by
making it conditional on the preceding mkdir.

Reviewed-by: ultrotter

16 years agoComplete rename of testing/ to test/.
Michael Hanselmann [Wed, 12 Sep 2007 17:46:47 +0000 (17:46 +0000)]
Complete rename of testing/ to test/.

Reviewed-by: iustin

16 years agoFix typo in last commit.
Michael Hanselmann [Wed, 12 Sep 2007 15:54:10 +0000 (15:54 +0000)]
Fix typo in last commit.

16 years agoRename testing/ to test/.
Michael Hanselmann [Wed, 12 Sep 2007 15:51:34 +0000 (15:51 +0000)]
Rename testing/ to test/.

16 years agoClean *.py[co] in testing/.
Michael Hanselmann [Wed, 12 Sep 2007 15:17:10 +0000 (15:17 +0000)]
Clean *.py[co] in testing/.

Reviewed-by: iustin

16 years agoMove QA script from testing/ to qa/.
Michael Hanselmann [Wed, 12 Sep 2007 15:12:27 +0000 (15:12 +0000)]
Move QA script from testing/ to qa/.

Reviewed-by: iustin

16 years agoChange the way how locales are overridden:
Michael Hanselmann [Wed, 12 Sep 2007 12:02:56 +0000 (12:02 +0000)]
Change the way how locales are overridden:
- Set only LC_ALL, it overrides any other variable
- Restore environment after unittest

Reviewed-by: iustinp

16 years agoClone cmdlib._GetWantedNodes into _GetWantedInstances
Iustin Pop [Wed, 12 Sep 2007 11:58:29 +0000 (11:58 +0000)]
Clone cmdlib._GetWantedNodes into _GetWantedInstances

This duplicates _GetWantedNodes to _GetWantedInstances, after doing some
changes to it:
  - fix an indentation error that should result in only the last node
    name passed being chosen
  - change the function to have a single return statement
  - remove a redundant 'is not None' check

Reviewed-by: imsnah

16 years agoFix docstrings of many opcodes
Iustin Pop [Wed, 12 Sep 2007 10:32:24 +0000 (10:32 +0000)]
Fix docstrings of many opcodes

Reviewed-by: imsnah

16 years agoFilters out LANG and LC_* on RunCmd
Iustin Pop [Tue, 11 Sep 2007 12:18:05 +0000 (12:18 +0000)]
Filters out LANG and LC_* on RunCmd

This filters out the LANG and LC_ variables from the environment of programs
executed by RunCmd, in order to get consistent output of execute programs like
lvs, etc.

Reviewed-by: imsnah

16 years ago- Don't build .tar.bz2, we only distribute .tar.gz anyway.
Michael Hanselmann [Tue, 11 Sep 2007 08:45:54 +0000 (08:45 +0000)]
- Don't build .tar.bz2, we only distribute .tar.gz anyway.
- Clean generated files on “make maintainer-clean”.
- Build _autoconf.py and ganeti.initd on “make all”.

Reviewed-by: iustinp

16 years agoMake import/export use the auxiliary ssh library to build the remote commands.
Guido Trotter [Fri, 7 Sep 2007 11:30:50 +0000 (11:30 +0000)]
Make import/export use the auxiliary ssh library to build the remote commands.

This avoids forgetting some parameters, as it's happening right now
(the correct known host file is not being passed)

In order to do so we split SSHCall into an auxiliary BuildSSHCmd which builds
the command but doesn't actually call it, and SSHCall itself which runs RunCmd
on top of BuildSSHCmd's result. BuildSSHCmd is then explicitely called by
import/export who has to build a more complex command to be run later.

16 years agoFix two errors in man page
Guido Trotter [Fri, 7 Sep 2007 08:09:19 +0000 (08:09 +0000)]
Fix two errors in man page

16 years agoAdd function to get all local IP addresses, will be used in cmdlib.py.
Michael Hanselmann [Wed, 5 Sep 2007 17:14:52 +0000 (17:14 +0000)]
Add function to get all local IP addresses, will be used in cmdlib.py.

Reviewed-by: schreiberal

16 years agoUse configure's paths in the init script example.
Michael Hanselmann [Tue, 4 Sep 2007 15:27:01 +0000 (15:27 +0000)]
Use configure's paths in the init script example.

Reviewed-by: schreiberal

16 years agoNow that we use configure's variables, add --sysconfdir to configure.
Michael Hanselmann [Tue, 4 Sep 2007 13:10:14 +0000 (13:10 +0000)]
Now that we use configure's variables, add --sysconfdir to configure.

Reviewed-by: ultrotter

16 years agoUse _autoconf.py instead of version.py, generated by Makefile with more
Michael Hanselmann [Tue, 4 Sep 2007 11:32:31 +0000 (11:32 +0000)]
Use _autoconf.py instead of version.py, generated by Makefile with more
variables. The underline is there to mark it as a private module.

Reviewed-by: iustinp

16 years agoCombine rules for manpages.
Michael Hanselmann [Tue, 4 Sep 2007 07:35:55 +0000 (07:35 +0000)]
Combine rules for manpages.

Reviewed-by: iustinp

16 years agoUse DESTDIR when creating additional directories.
Michael Hanselmann [Tue, 4 Sep 2007 07:35:12 +0000 (07:35 +0000)]
Use DESTDIR when creating additional directories.

Reviewed-by: iustinp

16 years ago- Generic automake cleanup
Michael Hanselmann [Mon, 3 Sep 2007 14:42:08 +0000 (14:42 +0000)]
- Generic automake cleanup
- Bump version number to 1.2b2
- Add version.py file generated from version.py.in by autoconf

Reviewed-by: schreiberal

16 years ago- Add Makefile in doc/examples/
Michael Hanselmann [Mon, 3 Sep 2007 13:28:54 +0000 (13:28 +0000)]
- Add Makefile in doc/examples/

16 years ago- Rename docs/ to doc/
Michael Hanselmann [Mon, 3 Sep 2007 13:23:20 +0000 (13:23 +0000)]
- Rename docs/ to doc/
- Add Makefile in doc/examples/

Reviewed-by: schreiberal

16 years agoSwitch utils.RunCmd from popen2 to subprocess
Iustin Pop [Mon, 3 Sep 2007 11:22:22 +0000 (11:22 +0000)]
Switch utils.RunCmd from popen2 to subprocess

This changes the implementation of RunCmd from using the popen2 module
to using the (new in 2.4) subprocess module.

This is helpful because the subprocess module has more advanced features
than popen2, the most important ones being the ability to run code in the
child process before the exec and ability to launch with modified
environment.

Reviewed-by: imsnah

16 years agoAdd a small unittext extension for utils.RunCmd
Iustin Pop [Mon, 3 Sep 2007 08:04:24 +0000 (08:04 +0000)]
Add a small unittext extension for utils.RunCmd

Reviewed-by: imsnah

16 years agoTest “gnt-node volumes”.
Michael Hanselmann [Fri, 31 Aug 2007 15:36:47 +0000 (15:36 +0000)]
Test “gnt-node volumes”.

Reviewed-by: iustinp

16 years agoAdd note about Debian default dbrd.conf
Iustin Pop [Fri, 31 Aug 2007 09:12:26 +0000 (09:12 +0000)]
Add note about Debian default dbrd.conf

Debian's default drbd configuration has some enabled directives, which make the
init script throw errors. Document how to disable the defaults and thus get rid
of the errors.

Reviewed-by: imsnah

16 years agoBump up version to beta1 v1.2b1
Iustin Pop [Thu, 30 Aug 2007 18:33:00 +0000 (18:33 +0000)]
Bump up version to beta1

16 years agoFix capitalization.
Michael Hanselmann [Thu, 30 Aug 2007 18:27:05 +0000 (18:27 +0000)]
Fix capitalization.

Reviewed-by: iustinp

16 years agoFix some spelling mistakes
Iustin Pop [Thu, 30 Aug 2007 18:19:24 +0000 (18:19 +0000)]
Fix some spelling mistakes

16 years agoAdd note about lvm.conf tuning
Iustin Pop [Thu, 30 Aug 2007 18:10:34 +0000 (18:10 +0000)]
Add note about lvm.conf tuning

Reviewed-by: imsnah