ganeti-local
11 years agoensure-dirs: Don't convert list to tuple
Michael Hanselmann [Thu, 27 Sep 2012 14:42:33 +0000 (16:42 +0200)]
ensure-dirs: Don't convert list to tuple

Tuples are data structures, not containers.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agodaemon-util: Use function to determine if confd is enabled
Michael Hanselmann [Thu, 27 Sep 2012 14:28:29 +0000 (16:28 +0200)]
daemon-util: Use function to determine if confd is enabled

… instead of comparing with two different values in two placse.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agocfgshell: Remove pylint disable line
Michael Hanselmann [Thu, 27 Sep 2012 12:52:38 +0000 (14:52 +0200)]
cfgshell: Remove pylint disable line

Commit 326830963 removed the use of a private member function. Also
replace '' with "" in one place.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdding RAPI client for instance multi allocation
René Nussbaumer [Wed, 26 Sep 2012 12:47:41 +0000 (14:47 +0200)]
Adding RAPI client for instance multi allocation

It was very easy to refactor CreateInstance to repurpose some part of it
for the instance multi allocation request. So we do this.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoPopulate the instance dict with opcode infos
René Nussbaumer [Thu, 27 Sep 2012 08:06:25 +0000 (10:06 +0200)]
Populate the instance dict with opcode infos

This is needed so we can load it as an opcode. However, this information
should not be available on the client, so we inject that info when we
receive the request.

Provided unittest to verify behaviour.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoRevert unintentional change of daemon log file names
Michael Hanselmann [Tue, 25 Sep 2012 13:35:40 +0000 (15:35 +0200)]
Revert unintentional change of daemon log file names

Commit 3329f4dea6 unintentionally changed the filenames of all daemon
log files. This patch reverts part of those changes.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoFix bad wording in 2.3 design document
Michael Hanselmann [Wed, 26 Sep 2012 17:05:05 +0000 (19:05 +0200)]
Fix bad wording in 2.3 design document

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoInstanceInfo RPC call
Agata Murawska [Tue, 18 Sep 2012 08:20:56 +0000 (10:20 +0200)]
InstanceInfo RPC call

This patch implements single instance info call - somewhat similar to
all_instances_info, except we give a specific instance name.

Current implementation of reading the InstanceInfo value is somewhat
counter-intuitive because when we query a node on thich there is
no instance with such name, this is not considered an error - but
it does produce an empty answer. Therefore the resulting type is
optional.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoinstance_info now returns vcpus
Agata Murawska [Tue, 18 Sep 2012 08:20:06 +0000 (10:20 +0200)]
instance_info now returns vcpus

instance_info and all_instances_info calls had different per-instance
return types, this commit fixes the mismatch.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoChange RpcResult typeclass
Agata Murawska [Mon, 24 Sep 2012 11:51:10 +0000 (13:51 +0200)]
Change RpcResult typeclass

For storage_list call, the result type depends on the call parameters.
Therefore, we have to add call as an argument for rpcResultFill - and
by extension, to the typeclass.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoVersion RPC call
Agata Murawska [Fri, 21 Sep 2012 09:11:03 +0000 (11:11 +0200)]
Version RPC call

Implementation of node version query.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoNode query now uses live data
Agata Murawska [Mon, 24 Sep 2012 09:09:05 +0000 (11:09 +0200)]
Node query now uses live data

Added support for NodeInfo RPC call as source of data for node query.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoNode query now collects live fields
Agata Murawska [Wed, 26 Sep 2012 15:21:26 +0000 (17:21 +0200)]
Node query now collects live fields

We make use of the parameter added in the previous patch and add
option to add live parameters to the query.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdd live parameter to query
Agata Murawska [Wed, 26 Sep 2012 13:00:41 +0000 (15:00 +0200)]
Add live parameter to query

The tests we currently have assume, that all the data required for
running the query is available - once we add live data, this will no
longer be the case.

This patch adds boolean parameter to query function, which tells it
whether to ignore live parameters gathering.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoConversion from RPC error to query status
Agata Murawska [Mon, 24 Sep 2012 13:48:18 +0000 (15:48 +0200)]
Conversion from RPC error to query status

Simple conversion for queries that use live fields gathered from
RPC calls.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoJson helper for node query
Agata Murawska [Mon, 24 Sep 2012 13:45:57 +0000 (15:45 +0200)]
Json helper for node query

This is a helper function that gets the JSON encoding of the first
element of the list (if possible).

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoCreate ResulT for monad transformations
Agata Murawska [Fri, 21 Sep 2012 08:44:07 +0000 (10:44 +0200)]
Create ResulT for monad transformations

This patch creates ResultT, a monad transformation used later in
RPC <-> query integration.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoTests for NodeGroup query
Agata Murawska [Thu, 20 Sep 2012 15:16:53 +0000 (17:16 +0200)]
Tests for NodeGroup query

This adds tests similar to those used for node query. For now the
prop_queryGroup_noUnknown is disabled and commented out, as it is
fasifiable with ndparams and ipolicy. It may be removed or fixed
later on.

Also, prop_queryGrooup_types has one less property checked - it is
not the case that number of result rows should be equal to number
of nodes.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoNodeGroup query in Haskell
Agata Murawska [Thu, 20 Sep 2012 13:16:21 +0000 (15:16 +0200)]
NodeGroup query in Haskell

Implementation of nodegroup queries in Haskell. This is not yet
complete as we are missing merged disk parameters and option
want_diskparams is not implemented.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoConfig support for NodeGroup query
Agata Murawska [Thu, 20 Sep 2012 13:15:11 +0000 (15:15 +0200)]
Config support for NodeGroup query

For some results in nodegroup queries we need agregation similar to
one that is done for nodes.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoFix RPC call and result (de)serialization
Agata Murawska [Fri, 21 Sep 2012 09:25:31 +0000 (11:25 +0200)]
Fix RPC call and result (de)serialization

Previous version of RPC calls implementation in Haskell did not take
into account that the actual result type for queries is a list, not
a dictionary.

This patch aims at fixing the problem "for now" - it is not a pretty
solution, but it does work. Note that parsing of the result is now
split into two parts - first, we check if server's aswer is positive,
then if it is, we procede with decoding the actual result.

Values and order of some fields in the result type were changed to
reflect actual order of arguments from server responses.

AllInstancesInfo call was particularly tricky, because it returns a
dictionary where keys are instance names - and the response from
a given node is correct if all the instances were deserialized, not
just some.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdd alias for Either RpcError a
Agata Murawska [Tue, 25 Sep 2012 15:18:07 +0000 (17:18 +0200)]
Add alias for Either RpcError a

This was repeated a lot, so we should abstract this into a type.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoCleanup for RPC errors
Agata Murawska [Fri, 21 Sep 2012 09:20:34 +0000 (11:20 +0200)]
Cleanup for RPC errors

Curl error messages are self contained and don't need "error" prefix;
added RpcResult Error which will be used once proper deserialization
of rpc response is in place.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoChange cluster's hypervisors type
Agata Murawska [Fri, 21 Sep 2012 08:44:41 +0000 (10:44 +0200)]
Change cluster's hypervisors type

We now have Hypervisor type in Objects, might just as well use it.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoCorrect top comment in Query/Server
Agata Murawska [Thu, 13 Sep 2012 08:34:25 +0000 (10:34 +0200)]
Correct top comment in Query/Server

I assumed this was a copy-paste+forgetting to change the header comment.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdd nodedCertFile to Path
Agata Murawska [Thu, 20 Sep 2012 14:15:17 +0000 (16:15 +0200)]
Add nodedCertFile to Path

This patch adds missing Path entry and uses it in Rpc. It was not in
place before due to different build settings - i.e. if curl was
disabled, there were no problems.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoVerify the node count just if the allocation was successful
René Nussbaumer [Wed, 26 Sep 2012 12:53:53 +0000 (14:53 +0200)]
Verify the node count just if the allocation was successful

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoEnable bash completion for htools scripts
Iustin Pop [Tue, 25 Sep 2012 10:30:07 +0000 (12:30 +0200)]
Enable bash completion for htools scripts

This patch ties together the previous commits, by extending
build-bash-completion to call all htools scripts and get their
completion information, then use that to build fake cli_options
representing them and finally generate the bash completion
information.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoAdd option for displaying completion information
Iustin Pop [Tue, 25 Sep 2012 09:42:49 +0000 (11:42 +0200)]
Add option for displaying completion information

This patch adds support for a --help-completion option, which will
display the defined options and their completion information, in a
format designed to be parsed easily from Python, for integration into
build-bash-completion.

The alternative would have been to duplicate the build-bash-completion
functionality on the Haskell side, but that would have been lots of
duplication for not enough gain (since that is only run at build
time).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

11 years agoAnnotate options with completion information
Iustin Pop [Tue, 25 Sep 2012 09:33:13 +0000 (11:33 +0200)]
Annotate options with completion information

This is a quite boring patch, just adding annotation information to
all existing options. Some of the annotations are not very good; but
we don't have support for more precise completion in
build-bash-completion, so this is good enough.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

11 years agoAdd a data type for completion information
Iustin Pop [Tue, 25 Sep 2012 09:30:29 +0000 (11:30 +0200)]
Add a data type for completion information

This can be used for either option or argument completion (although
OptComplNone doesn't make sense for an argument :).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

11 years agoRemove generic options from individual programs
Iustin Pop [Tue, 25 Sep 2012 08:37:48 +0000 (10:37 +0200)]
Remove generic options from individual programs

Currently, we test and require that each individual program (hbal,
etc.) defines/supports the generic options (currently --help and
--version). Even with the test, this is not optimal, since it requires
changes in many places whenever we modify the list of generic options,
hence we move these out of the individual programs and into the
generic CLI handling code.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

11 years agoAdd printing of group score in hinfo
Iustin Pop [Tue, 25 Sep 2012 14:54:12 +0000 (16:54 +0200)]
Add printing of group score in hinfo

The global cluster score is less interesting than individual group
scores, for multi-group allocation purposes.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoReplace a big tuple with a custom data type
Iustin Pop [Tue, 25 Sep 2012 14:49:09 +0000 (16:49 +0200)]
Replace a big tuple with a custom data type

This will make it easier to add new parameters.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

11 years agoImplement virtual cluster support in Python code
Michael Hanselmann [Thu, 20 Sep 2012 16:52:31 +0000 (18:52 +0200)]
Implement virtual cluster support in Python code

- pathutils: Prepend node-specific prefix path
- RPC: Use virtual paths (see vcluster.py)
- SSH: Pass environment variables, use destination's node directory when
  copying files using scp, use GANETI_HOSTNAME to determine hostname

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agovcluster: Add more details to docstrings
Michael Hanselmann [Tue, 25 Sep 2012 13:28:45 +0000 (15:28 +0200)]
vcluster: Add more details to docstrings

As requested by René Nussbaumer. Hopefully things are more clear now.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agoAdd tests for bash completion
Michael Hanselmann [Tue, 25 Sep 2012 09:48:46 +0000 (11:48 +0200)]
Add tests for bash completion

Given the number of settings that need to be controlled a plain bash
script was a better choice over shelltestrunner. Just a few completions
are attempted, but among them should be the most critical ones (e.g.
“gnt-instance add --node …”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoFix shelltests for ganeti-*
Michael Hanselmann [Mon, 24 Sep 2012 14:06:45 +0000 (16:06 +0200)]
Fix shelltests for ganeti-*

They were never run.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agobash_completion: Enable extglob while parsing file
Michael Hanselmann [Mon, 24 Sep 2012 13:03:53 +0000 (15:03 +0200)]
bash_completion: Enable extglob while parsing file

In older versions of GNU Bash extended patterns, such as “@(…)”, are only
available with the “extglob” shell option. As pointed out in [1] and [2],
“extglob” must be enabled while parsing the code. Therefore the flag must be
enabled at the beginning of the script and be reset to its original value at
the end as to not interfere with other code on shell initialization.

[1] http://unix.stackexchange.com/questions/45957
[2] http://mywiki.wooledge.org/glob

Reported by Sascha Lucas.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoRevert "bash_completion: Always enable extglob"
Michael Hanselmann [Mon, 24 Sep 2012 12:43:20 +0000 (14:43 +0200)]
Revert "bash_completion: Always enable extglob"

This reverts commit 94014b6328f813b674a1126ffd221705d7e315b3. Turns out
I misunderstood the “extglob” shell option.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoAdding RAPI resource for multi-allocation
René Nussbaumer [Wed, 19 Sep 2012 11:45:59 +0000 (13:45 +0200)]
Adding RAPI resource for multi-allocation

This is straightforward.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoAdding multi-allocation logic
René Nussbaumer [Mon, 17 Sep 2012 12:23:20 +0000 (14:23 +0200)]
Adding multi-allocation logic

This patch adds the Logical Unit for the instance multi allocation
opcode.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoAdding the new opcode for multi-allocation
René Nussbaumer [Thu, 13 Sep 2012 11:18:57 +0000 (13:18 +0200)]
Adding the new opcode for multi-allocation

Skeleton for the multi-allocation opcode

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoRefactor shared code
René Nussbaumer [Fri, 14 Sep 2012 12:41:18 +0000 (14:41 +0200)]
Refactor shared code

We've some work which we need to do for the multi allocation request as
well, so lets refactor it to separate functions.

_ComputeNics is kinda ugly, as it reserves the MAC. I added a TODO to
think more about how we factor this behaviour out.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoAdding some fundamental unittests for iallocator
René Nussbaumer [Wed, 19 Sep 2012 09:14:14 +0000 (11:14 +0200)]
Adding some fundamental unittests for iallocator

This test covers the bug fixes found in the previous two patches

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoFix REQ_RESULT for MultiInstanceAllocRequest
René Nussbaumer [Tue, 18 Sep 2012 14:58:54 +0000 (16:58 +0200)]
Fix REQ_RESULT for MultiInstanceAllocRequest

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoFix a validation issue
René Nussbaumer [Tue, 18 Sep 2012 14:11:28 +0000 (16:11 +0200)]
Fix a validation issue

We want to validate the result only if the iallocation run was a
success.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agonetutils: Use virtual hostname if set
Michael Hanselmann [Thu, 20 Sep 2012 16:50:56 +0000 (18:50 +0200)]
netutils: Use virtual hostname if set

This enables the hostname seen by other code through Hostname.GetFqdn to
be changed through the environment variable “GANETI_HOSTNAME”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agodaemon-util: Support virtual clusters
Michael Hanselmann [Thu, 20 Sep 2012 16:49:32 +0000 (18:49 +0200)]
daemon-util: Support virtual clusters

GANETI_ROOTDIR contains the root directory for the current “virtual node”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agoAdd new module for virtual clusters
Michael Hanselmann [Thu, 20 Sep 2012 16:47:28 +0000 (18:47 +0200)]
Add new module for virtual clusters

This module will take care of managing paths for virtual clusters.
Unittests are included (100% coverage).

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agobootstrap.SetupNodeDaemon: Stop hardcoding bind address
Michael Hanselmann [Thu, 20 Sep 2012 16:52:49 +0000 (18:52 +0200)]
bootstrap.SetupNodeDaemon: Stop hardcoding bind address

Commit b43dcc5a11 added support for IPv6. To have the node daemon bind
to an IPv6 address on startup it changed the code to pass a static bind
address (0.0.0.0 or ::0). If a user had configured another bind address
using /etc/default/ganeti, that address would not be used until the
daemons were restarted.

By copying ssconf files before attempting to start the daemons we can
ensure that the built-in IP family detection in daemon.py works.

This fixes issue 267.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agohv_kvm: Use pu.CONF_DIR variable
Michael Hanselmann [Thu, 20 Sep 2012 16:44:21 +0000 (18:44 +0200)]
hv_kvm: Use pu.CONF_DIR variable

… instead of using SYSCONFDIR directly.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoutils.filelock: Remove executable bit from lock files
Michael Hanselmann [Thu, 20 Sep 2012 16:42:49 +0000 (18:42 +0200)]
utils.filelock: Remove executable bit from lock files

There's no need for lock files to be executable.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoLUInstanceCreate: Include group name in error message
Michael Hanselmann [Thu, 20 Sep 2012 16:45:50 +0000 (18:45 +0200)]
LUInstanceCreate: Include group name in error message

“pnode.group” contains the UUID, which isn't very user-friendly.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agobash_completion: Generate more compact version
Michael Hanselmann [Tue, 18 Sep 2012 13:25:07 +0000 (15:25 +0200)]
bash_completion: Generate more compact version

First the numbers:
$ stat --format '%s %n' doc/examples/bash_completion*
77847 doc/examples/bash_completion
86492 doc/examples/bash_completion-debug

The non-debug version doesn't use indentation and does not have some
(primitive) facilities for debugging. The savings are about 8.5 kB or
10 %. The “-debug” version is used by “devel/upload”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agoShellWriter: Add parameter to disable indentation
Michael Hanselmann [Tue, 18 Sep 2012 13:06:25 +0000 (15:06 +0200)]
ShellWriter: Add parameter to disable indentation

This will be used to write a more compact bash completion script.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agobash_completion: Always enable extglob
Michael Hanselmann [Tue, 18 Sep 2012 12:56:52 +0000 (14:56 +0200)]
bash_completion: Always enable extglob

In older versions of GNU Bash extended patterns, such as “@(…)” are only
available with the “extglob” shell option. This patch adds a wrapper
function so that extglob is always enabled while doing any completion.
Due to early returns inside the main completion function this seemed
like the best option.

Reported by Sascha Lucas.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoconstants: Stop using wildcard import for pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:38 +0000 (18:28 +0200)]
constants: Stop using wildcard import for pathutils

It still needs to be imported for hypervisor parameter defaults, but
after this change paths are no longer exported from constants.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoUse autoconf-based paths from Haskell instead of constants
Michael Hanselmann [Mon, 17 Sep 2012 17:19:28 +0000 (19:19 +0200)]
Use autoconf-based paths from Haskell instead of constants

Future changes will change Path.hs to use an environment variable.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate tools/* from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:57 +0000 (18:28 +0200)]
Migrate tools/* from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate test/ganeti.*.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:57 +0000 (18:28 +0200)]
Migrate test/ganeti.*.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/watcher/__init__.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:57 +0000 (18:28 +0200)]
Migrate lib/watcher/__init__.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/utils/*.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:56 +0000 (18:28 +0200)]
Migrate lib/utils/*.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/uidpool.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:56 +0000 (18:28 +0200)]
Migrate lib/uidpool.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/tools/ensure_dirs.py to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:56 +0000 (18:28 +0200)]
Migrate lib/tools/ensure_dirs.py to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/ssh.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:56 +0000 (18:28 +0200)]
Migrate lib/ssh.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/ssconf.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:56 +0000 (18:28 +0200)]
Migrate lib/ssconf.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/server/*.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:56 +0000 (18:28 +0200)]
Migrate lib/server/*.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/rpc.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:56 +0000 (18:28 +0200)]
Migrate lib/rpc.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/rapi/baserlib.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:56 +0000 (18:28 +0200)]
Migrate lib/rapi/baserlib.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/ovf.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:55 +0000 (18:28 +0200)]
Migrate lib/ovf.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/mcpu.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:55 +0000 (18:28 +0200)]
Migrate lib/mcpu.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/masterd/instance.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:55 +0000 (18:28 +0200)]
Migrate lib/masterd/instance.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/luxi.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:55 +0000 (18:28 +0200)]
Migrate lib/luxi.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/{jqueue,jstore}.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:55 +0000 (18:28 +0200)]
Migrate lib/{jqueue,jstore}.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/hypervisor/*.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:55 +0000 (18:28 +0200)]
Migrate lib/hypervisor/*.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/config.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:54 +0000 (18:28 +0200)]
Migrate lib/config.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/confd/*.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:54 +0000 (18:28 +0200)]
Migrate lib/confd/*.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/cmdlib.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:54 +0000 (18:28 +0200)]
Migrate lib/cmdlib.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/client/*.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:54 +0000 (18:28 +0200)]
Migrate lib/client/*.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/cli.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:54 +0000 (18:28 +0200)]
Migrate lib/cli.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/bootstrap.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:54 +0000 (18:28 +0200)]
Migrate lib/bootstrap.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate lib/backend.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:54 +0000 (18:28 +0200)]
Migrate lib/backend.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate build-bash-completion from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:53 +0000 (18:28 +0200)]
Migrate build-bash-completion from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoMigrate qa/*.py from constants to pathutils
Michael Hanselmann [Mon, 17 Sep 2012 16:28:53 +0000 (18:28 +0200)]
Migrate qa/*.py from constants to pathutils

File system paths moved from constants to pathutils.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoconstants: Move most paths to separate module
Michael Hanselmann [Mon, 17 Sep 2012 14:26:03 +0000 (16:26 +0200)]
constants: Move most paths to separate module

This is inpreparation for the implementation of virtual clusters. Many
paths will change based on an environment variable and are no longer
constant and should no longer be in “constants.py”. Since “constants.py”
is already huge a number of other paths are also moved in the process.

For now a wildcard import is used to re-export all paths from
“constants.py” (this will change over coming patches). Daemon log paths
have been changed to use a function. “RUN_GANETI_DIR” was moved to
“RUN_DIR” as the latter was only used in “constants.py”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoconfigure: Provide options to change default user/group
Michael Hanselmann [Mon, 17 Sep 2012 12:24:00 +0000 (14:24 +0200)]
configure: Provide options to change default user/group

This is needed for virtual clusters where a non-root user is used to run
the daemons.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoconstants: Add missing word in comment
Michael Hanselmann [Mon, 17 Sep 2012 15:40:50 +0000 (17:40 +0200)]
constants: Add missing word in comment

It was missing in commit 243cdbcc on May 7, 2008.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

11 years agoQA for instance migration made more compact
Bernardo Dal Seno [Thu, 13 Sep 2012 21:15:15 +0000 (23:15 +0200)]
QA for instance migration made more compact

Also, the value of always_failover is not hard-coded any more, and it's
possible to disable changing the always_failover parameter, if needed.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoAlways_failover doesn't require --allow-failover anymore
Bernardo Dal Seno [Thu, 13 Sep 2012 20:25:32 +0000 (22:25 +0200)]
Always_failover doesn't require --allow-failover anymore

If an administrator sets always_failover, it means that there is no need
for another explicit approval to failover instead of migrating.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoRemove useless lock in recreate-disks
Bernardo Dal Seno [Mon, 3 Sep 2012 08:26:36 +0000 (10:26 +0200)]
Remove useless lock in recreate-disks

The old primary node was being locked to do RPC, but we don't lock nodes
for RPC anymore, so the lock is useless.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoUpdate design for virtual clusters
Michael Hanselmann [Wed, 12 Sep 2012 11:47:10 +0000 (13:47 +0200)]
Update design for virtual clusters

The biggest change is going from a command line parameter for specifying
a daemon's directory to using an environment variable. Some other things
are clarified.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agoSmall style adjustment
René Nussbaumer [Wed, 12 Sep 2012 12:43:08 +0000 (14:43 +0200)]
Small style adjustment

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoMake iallocator request types more strict
René Nussbaumer [Wed, 12 Sep 2012 12:41:25 +0000 (14:41 +0200)]
Make iallocator request types more strict

This adapts the type of some request input fields to more stricter ones.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoRework the required_nodes field
René Nussbaumer [Wed, 12 Sep 2012 11:43:28 +0000 (13:43 +0200)]
Rework the required_nodes field

This was used to verify the result of instance allocation. However, this
is not logic which belongs to the cmdlib rather than to the iallocator
request itself. So abstract it by its own function. And update the
ValidateResult accordingly.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoobjects, rpc: Code cleanup
Michael Hanselmann [Wed, 12 Sep 2012 12:42:40 +0000 (14:42 +0200)]
objects, rpc: Code cleanup

objects.Disk.ComputeLDParams: Simplify structure, don't use and
overwrite local variables.

rpc.AnnotateDiskParams: Replace explicit loop.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agoRAPI client: Fix typo in docstring
Michael Hanselmann [Wed, 12 Sep 2012 09:53:09 +0000 (11:53 +0200)]
RAPI client: Fix typo in docstring

Also update the copyright header.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoDisable pylint warnings for unknown members
René Nussbaumer [Tue, 11 Sep 2012 08:37:59 +0000 (10:37 +0200)]
Disable pylint warnings for unknown members

For some reason pylint can't determine, that the members are calculated
upon runtime and complains. This is weird as the same mechanism works on
opcode/objects. I haven't found the issue for it yet, so let's just
ignore the warnings for now.

This is a separate patch for easier revert later on, once it's fixed.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoAdapt gnt-debug iallocator
René Nussbaumer [Thu, 6 Sep 2012 14:18:05 +0000 (16:18 +0200)]
Adapt gnt-debug iallocator

Add the new multi-alloc request to the test allocation framework. For
now we just create --count identical instances. This might need further
improvements later.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoAdding new multi-allocation request
René Nussbaumer [Thu, 6 Sep 2012 14:17:21 +0000 (16:17 +0200)]
Adding new multi-allocation request

Now that we've the refactoring done, we can easily add the new mode and
everything works.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>