ganeti-local
15 years agoRelease ganeti 2.0~alpha1
Guido Trotter [Tue, 16 Dec 2008 16:24:46 +0000 (16:24 +0000)]
Release ganeti 2.0~alpha1

Reviewed-by: iustinp

15 years agoLUConnectConsole: fix primary_node online check
Guido Trotter [Tue, 16 Dec 2008 16:24:35 +0000 (16:24 +0000)]
LUConnectConsole: fix primary_node online check

The primary node is part of the instance, not of the opcode.

Reviewed-by: iustinp

15 years ago_RunCmdPipe: handle EINTR in poller.poll()
Guido Trotter [Tue, 16 Dec 2008 16:24:22 +0000 (16:24 +0000)]
_RunCmdPipe: handle EINTR in poller.poll()

poll() can be interrupted. rather than failing we retry until it
returns.

Reviewed-by: iustinp

15 years agoKVM: improve socat interface
Guido Trotter [Tue, 16 Dec 2008 16:24:08 +0000 (16:24 +0000)]
KVM: improve socat interface

Call socat with a full path specified at configure time, rather than
just by its name, and check for the binary to exist at hypervisor
verify.

Reviewed-by: iustinp

15 years agoKVM: use a different default kernel path
Guido Trotter [Tue, 16 Dec 2008 16:23:53 +0000 (16:23 +0000)]
KVM: use a different default kernel path

It makes sense for the default kvm kernel not to be called "xenU".

Reviewed-by: iustinp

15 years agoganeti.http: Add three TODOs for improvements
Michael Hanselmann [Mon, 15 Dec 2008 10:06:24 +0000 (10:06 +0000)]
ganeti.http: Add three TODOs for improvements

Reviewed-by: iustinp

15 years agoganeti.http: Explicitly initiate handshake
Michael Hanselmann [Mon, 15 Dec 2008 09:48:25 +0000 (09:48 +0000)]
ganeti.http: Explicitly initiate handshake

Otherwise it would be done on the first read/write operation, making
error handling more difficult (such as EOF during handshake).

Reviewed-by: iustinp

15 years agoganeti.http: Implement handshake socket operation
Michael Hanselmann [Mon, 15 Dec 2008 09:40:57 +0000 (09:40 +0000)]
ganeti.http: Implement handshake socket operation

Reviewed-by: iustinp

15 years agoganeti.http: Handle SSL_ERROR_ZERO_RETURN
Michael Hanselmann [Mon, 15 Dec 2008 09:40:42 +0000 (09:40 +0000)]
ganeti.http: Handle SSL_ERROR_ZERO_RETURN

Also add a comment next to the place where the SSL connection is shut
down.

Reviewed-by: iustinp

15 years agocleanup: ConfigWriter, initialize all attributes
Iustin Pop [Sun, 14 Dec 2008 12:05:30 +0000 (12:05 +0000)]
cleanup: ConfigWriter, initialize all attributes

We should initialized the _last_cluster_serial in the constructor too (just to
be consistent).

Reviewed-by: amishchenko

15 years agocleanup: rapi v2 instance tags wrong attribute
Iustin Pop [Sun, 14 Dec 2008 12:05:22 +0000 (12:05 +0000)]
cleanup: rapi v2 instance tags wrong attribute

This was changed in the past, but it seems this class was forgotten.

Reviewed-by: amishchenko

15 years agocleanup: http server, line too long
Iustin Pop [Sun, 14 Dec 2008 12:05:12 +0000 (12:05 +0000)]
cleanup: http server, line too long

Reviewed-by: amishchenko

15 years agocleanup: http client, line too long
Iustin Pop [Sun, 14 Dec 2008 12:05:03 +0000 (12:05 +0000)]
cleanup: http client, line too long

Reviewed-by: amishchenko

15 years agocleanup: xen hypervisor
Iustin Pop [Sun, 14 Dec 2008 12:04:54 +0000 (12:04 +0000)]
cleanup: xen hypervisor

Wrong indentation and uniformize one method signature.

Reviewed-by: amishchenko

15 years agocleanup: kvm code likes to redefine names
Iustin Pop [Sun, 14 Dec 2008 12:04:45 +0000 (12:04 +0000)]
cleanup: kvm code likes to redefine names

Reviewed-by: amishchenko

15 years agolib/ssh.py: import the logging module
Iustin Pop [Sun, 14 Dec 2008 12:04:36 +0000 (12:04 +0000)]
lib/ssh.py: import the logging module

This only means most of our error paths in this module were not working
(and generating exceptions).

Reviewed-by: amishchenko

15 years agoSshRunner: add docstring for _BuildSshOptions
Iustin Pop [Sun, 14 Dec 2008 12:04:29 +0000 (12:04 +0000)]
SshRunner: add docstring for _BuildSshOptions

Reviewed-by: amishchenko

15 years agoImprove _autoconf.py comments
Iustin Pop [Sun, 14 Dec 2008 12:04:20 +0000 (12:04 +0000)]
Improve _autoconf.py comments

This adds a docstring to the _autoconf.py file detailing how it's
generated (the other comment it's not visible in pydoc/epydoc).

Reviewed-by: amishchenko

15 years agocleanup: use _ for unused loop counter
Iustin Pop [Sun, 14 Dec 2008 12:04:13 +0000 (12:04 +0000)]
cleanup: use _ for unused loop counter

Reviewed-by: amishchenko

15 years agocleanup: WorkerPool, wrong variable name
Iustin Pop [Sun, 14 Dec 2008 12:04:05 +0000 (12:04 +0000)]
cleanup: WorkerPool, wrong variable name

Quoting Michael: "why is this even working?"

Reviewed-by: imsnah,amishchenko

15 years agocleanup: TcpPing, wrong variable name
Iustin Pop [Sun, 14 Dec 2008 12:03:56 +0000 (12:03 +0000)]
cleanup: TcpPing, wrong variable name

The default value of 'False' wasn't initialized properly. It doesn't
require initialization, but it's cleaner this way.

Reviewed-by: amishchenko

15 years agocleanup: SetEtcHostsEntry unused var
Iustin Pop [Sun, 14 Dec 2008 12:03:47 +0000 (12:03 +0000)]
cleanup: SetEtcHostsEntry unused var

Reviewed-by: amishchenko

15 years agocleanup: fix IAllocator hypervisor usage
Iustin Pop [Sun, 14 Dec 2008 12:03:38 +0000 (12:03 +0000)]
cleanup: fix IAllocator hypervisor usage

Two problems: the iallocator.hypervisor wasn't initialized to None in
the constructor, so pylint doesn't realize it's initialized later with
setattr.

Second, 'hypervisor' is a module, so we shouldn't use it as a variable.

Reviewed-by: amishchenko

15 years agocleanup: LUReplaceDisks unused vars
Iustin Pop [Sun, 14 Dec 2008 12:03:30 +0000 (12:03 +0000)]
cleanup: LUReplaceDisks unused vars

And a small whitespace fix.

Reviewed-by: amishchenko

15 years agocleanup: do not hide upper-scope name
Iustin Pop [Sun, 14 Dec 2008 12:03:20 +0000 (12:03 +0000)]
cleanup: do not hide upper-scope name

hypervisor is a module, so we shouldn't use it as an argument.

Reviewed-by: amishchenko

15 years agocleanup: fix use of _CheckNodeOnline
Iustin Pop [Sun, 14 Dec 2008 12:03:11 +0000 (12:03 +0000)]
cleanup: fix use of _CheckNodeOnline

A few cases of wrong variable name.

Reviewed-by: amishchenko

15 years agocleanup: LUAddNode, LUSetNodeParams unused variable
Iustin Pop [Sun, 14 Dec 2008 12:03:03 +0000 (12:03 +0000)]
cleanup: LUAddNode, LUSetNodeParams unused variable

This is a leftover from the abstraction of AdjustCandidatePool, and it
also requires the config lock, so it's better to remove it.

Reviewed-by: amishchenko

15 years agocleanup: LURenameCluster wrong variable name
Iustin Pop [Sun, 14 Dec 2008 12:02:53 +0000 (12:02 +0000)]
cleanup: LURenameCluster wrong variable name

Reviewed-by: amishchenko

15 years agocleanup: fix export NIC count the same way as disk
Iustin Pop [Sun, 14 Dec 2008 12:02:45 +0000 (12:02 +0000)]
cleanup: fix export NIC count the same way as disk

For safety, we use the same algorithm as in disk count.

Reviewed-by: amishchenko

15 years agocleanup: fix backend._RecursiveFindBD
Iustin Pop [Sun, 14 Dec 2008 12:02:36 +0000 (12:02 +0000)]
cleanup: fix backend._RecursiveFindBD

_RecursiveFindBD takes a parameter that isn't used; moreover, nowhere in
the SVN history can I find a case that it has been used.

As such, remove this parameter and fix its callers.

Reviewed-by: amishchenko

15 years agocleanup: more unused vars
Iustin Pop [Sun, 14 Dec 2008 12:02:27 +0000 (12:02 +0000)]
cleanup: more unused vars

Reviewed-by: amishchenko

15 years agocleanup: sanitize a default parameter
Iustin Pop [Sun, 14 Dec 2008 12:02:18 +0000 (12:02 +0000)]
cleanup: sanitize a default parameter

Instead of relying that the usage of the parameter is ok with mutable
default parameters, let's just make it safer..

Reviewed-by: amishchenko

15 years agocleanup: exceptions should derive from Exception
Iustin Pop [Sun, 14 Dec 2008 12:02:09 +0000 (12:02 +0000)]
cleanup: exceptions should derive from Exception

Reviewed-by: amishchenko

15 years agocleanup: fix GatherMasterVotes
Iustin Pop [Sun, 14 Dec 2008 12:02:01 +0000 (12:02 +0000)]
cleanup: fix GatherMasterVotes

Remove unused vars

Reviewed-by: amishchenko

15 years agocleanup: _InitSSHSetup doesn't need its argument
Iustin Pop [Sun, 14 Dec 2008 12:01:52 +0000 (12:01 +0000)]
cleanup: _InitSSHSetup doesn't need its argument

Reviewed-by: imsnah

15 years agocleanup: fix 'variable unused' warning
Iustin Pop [Sun, 14 Dec 2008 12:01:41 +0000 (12:01 +0000)]
cleanup: fix 'variable unused' warning

In the iteration we don't care about the node names, so we change the
for loop to be over the values (and not itervalues).

Reviewed-by: amishchenko

15 years agoganeti.http: Rename HttpBase._using_ssl to HttpBase.using_ssl
Michael Hanselmann [Fri, 12 Dec 2008 16:50:41 +0000 (16:50 +0000)]
ganeti.http: Rename HttpBase._using_ssl to HttpBase.using_ssl

It'll be queried from other classes.

Reviewed-by: iustinp

15 years agoganeti.http: Rename HttpSocketBase to HttpBase
Michael Hanselmann [Fri, 12 Dec 2008 16:50:27 +0000 (16:50 +0000)]
ganeti.http: Rename HttpSocketBase to HttpBase

It's more appropriate.

Reviewed-by: iustinp

15 years agoFix epydoc format warnings
Iustin Pop [Thu, 11 Dec 2008 17:13:30 +0000 (17:13 +0000)]
Fix epydoc format warnings

This patch should fix all outstanding epydoc parsing errors; as such, we
switch epydoc into verbose mode so that any new errors will be visible.

Reviewed-by: imsnah

15 years agoSwitch epydoc to parse only
Iustin Pop [Thu, 11 Dec 2008 14:58:01 +0000 (14:58 +0000)]
Switch epydoc to parse only

epydoc seems to be mightily confused by decorators and how they change
functions (it starts mixing the parameters of the decorated function
into the decorator itself); so we want it to parse only and not look at
the objects themselves.

Reviewed-by: ultrotter

15 years agoganeti.backend: Improve compression check
Michael Hanselmann [Wed, 10 Dec 2008 12:11:47 +0000 (12:11 +0000)]
ganeti.backend: Improve compression check

Reviewed-by: iustinp

15 years agoganeti.http: Docstring updates
Michael Hanselmann [Wed, 10 Dec 2008 12:06:35 +0000 (12:06 +0000)]
ganeti.http: Docstring updates

Reviewed-by: iustinp

15 years agoganeti.http: Remove _HttpClientError
Michael Hanselmann [Tue, 9 Dec 2008 18:42:53 +0000 (18:42 +0000)]
ganeti.http: Remove _HttpClientError

This is a leftover from old code.

Reviewed-by: iustinp

15 years agoganeti.http.server: Increase connection backlog to 1024
Michael Hanselmann [Tue, 9 Dec 2008 17:35:53 +0000 (17:35 +0000)]
ganeti.http.server: Increase connection backlog to 1024

This solves a problem with many concurrent requests. By default, 1024
is the maximum backlog on Linux kernels. We limit the number of clients
through MAX_CHILDREN, too. The idea of just increasing the backlog is
taken from lighttpd.

Reviewed-by: amishchenko

15 years agoRPC: Compress file upload data
Michael Hanselmann [Tue, 9 Dec 2008 13:24:26 +0000 (13:24 +0000)]
RPC: Compress file upload data

Adding compression to larger amounts of data is more efficient than
transferring it (len(nodes) - 1) times over the network without
compression. We were able to compress a 800KB config file to about
30 KB, which is about 40 KB with Base64 encoding (required due to
the way SimpleJson handles strings).

Reviewed-by: ultrotter

15 years agoWarn for instances living on offline nodes
Iustin Pop [Tue, 9 Dec 2008 09:33:32 +0000 (09:33 +0000)]
Warn for instances living on offline nodes

The patch also changes the result to error for non-reachable secondary nodes
(as for primary nodes).

Reviewed-by: ultrotter

15 years agoFix _AdjustCandidatePool
Iustin Pop [Mon, 8 Dec 2008 17:45:56 +0000 (17:45 +0000)]
Fix _AdjustCandidatePool

Currently the ConfigWriter.MaintainCandidatePool returns node names, and
_AdjustCandidatePool uses them as such, but then it passes these to
context.ReaddNode which in turn passes them to jqueue.JobQueue.AddNode which
uses them as objects.Node instances.

Since this is currently the only usage, we change return type from
ConfigWriter.MaintainCandidatePool to be objects and adjust the logging of
their names, so that the auto-adjusement works.

Reviewed-by: ultrotter

15 years agognt-node modify: add the offline attribute
Iustin Pop [Mon, 8 Dec 2008 11:46:51 +0000 (11:46 +0000)]
gnt-node modify: add the offline attribute

This patch changes gnt-node modify and the associated opcode/lu to allow
modification of the node offline attribute.

Setting a node into offline mode automatically demotes it from the
master role.

Reviewed-by: ultrotter

15 years agoRPC: do not make calls to offline nodes
Iustin Pop [Mon, 8 Dec 2008 09:10:48 +0000 (09:10 +0000)]
RPC: do not make calls to offline nodes

This patch changes the _MultNodeCall and _SingleNodeCall helpers to not
actually make calls to offline nodes, but instead generate fake
responses which have a parameter caller 'offline' set so that callers
can check for this value if they want (otherwise, it's just a failed RPC
call).

Reviewed-by: ultrotter

15 years agochmod ganeti.initd before uploading it
Guido Trotter [Sun, 7 Dec 2008 11:01:55 +0000 (11:01 +0000)]
chmod ganeti.initd before uploading it

When an upload is done to a node which doesn't have any version of
ganeti installed, this prevents a non-executable-initd error later in
the upload.

Reviewed-by: imsnah

15 years agoMake cluster verify understand offline nodes
Iustin Pop [Fri, 5 Dec 2008 11:41:33 +0000 (11:41 +0000)]
Make cluster verify understand offline nodes

This patch changes cluster verify to not alert on offline nodes, but
instead just show a note at the end with the number of such nodes.

It also removes warnings in verify-disks and hooks about failures to
make rpc calls to such nodes.

Reviewed-by: ultrotter

15 years agocmdlib: check node stats in prereqs
Iustin Pop [Fri, 5 Dec 2008 11:32:02 +0000 (11:32 +0000)]
cmdlib: check node stats in prereqs

This patch adds checks for offline nodes in most instance LUs so that we
can work with offline secondaries, but not with offline primaries. Some
cases (like grow disk, which needs both sides up) are not allowing
offline nodes at all.

Reviewed-by: ultrotter

15 years agoAdd two utility functions to cmdlib
Iustin Pop [Fri, 5 Dec 2008 11:20:20 +0000 (11:20 +0000)]
Add two utility functions to cmdlib

These will be used for parameter checking and node status checking.

Reviewed-by: ultrotter

15 years agoAdd function to compute the master candidates
Iustin Pop [Fri, 5 Dec 2008 11:14:19 +0000 (11:14 +0000)]
Add function to compute the master candidates

Since some nodes can be offline, we can't just take the length of the
node list as the maximum possible number of master candidates.

The patch adds an utility function to correctly compute this value and
replaces hardcoded computations with the use of this function. It then
adds utility functions to automate the maintenance of the node lists.

Reviewed-by: ultrotter

15 years agohttp: use slicing instead of string modification
Iustin Pop [Fri, 5 Dec 2008 10:12:58 +0000 (10:12 +0000)]
http: use slicing instead of string modification

The combination of the current buffer splitting method and (4KB) buffer
size is very inefficient when writing big amounts of data. Just walking
over a 16 megabyte string using a 4K buffer takes (on a random computer)
1m06s, whereas using slices will decrease this to 0.080s, and slicing
with 32 KB size decreases this to 0.073s.

This means that uploading a big config file (it nears 1MB for big
clusters) will take more and more time per the number of nodes, since it
needs lots of slicing.

I happened upon this by accidentally setting all nodes as master
candidates, at which point just uploading the config file to all nodes
took 40s. Applying the patch decreases this to 15s (this probably can
still be optimized).

The patch also removes a duplicate constant (the one actually used is in
http/client.py), and changes the receive buffer size to use the same
constant.

Reviewed-by: imsnah

15 years agoAdd the offline node list to ssconf
Iustin Pop [Fri, 5 Dec 2008 10:12:45 +0000 (10:12 +0000)]
Add the offline node list to ssconf

The patch also changes the various node list generation to be more
consistent.

Reviewed-by: imsnah

15 years agoCleanup the config file on demotion from candidate
Iustin Pop [Fri, 5 Dec 2008 03:01:21 +0000 (03:01 +0000)]
Cleanup the config file on demotion from candidate

This patch adds a simple rpc which makes a backup of the config file and
then removes it. This is done so that cluster verify doesn't complain
immediately after demoting a node.

Reviewed-by: imsnah

15 years agowatcher: handle offline nodes better
Iustin Pop [Fri, 5 Dec 2008 02:58:40 +0000 (02:58 +0000)]
watcher: handle offline nodes better

This patch changes the LUQueryInstances to show a different state for
offline nodes and also modifies the watcher to understand the offline
state in its checks.

Reviewed-by: ultrotter

15 years agonode list: add the offline field
Iustin Pop [Fri, 5 Dec 2008 02:53:33 +0000 (02:53 +0000)]
node list: add the offline field

Reviewed-by: ultrotter

15 years agoAdd a new node parameter 'offline'
Iustin Pop [Fri, 5 Dec 2008 02:53:21 +0000 (02:53 +0000)]
Add a new node parameter 'offline'

This patch adds a new node parameter called offline that will be used to
mark nodes which should be touched by commands.

We also add this flag at cluster init, node add, and export it to
iallocator scripts.

Reviewed-by: ultrotter

15 years agossconf: empty files should not add a newline
Iustin Pop [Fri, 5 Dec 2008 02:42:18 +0000 (02:42 +0000)]
ssconf: empty files should not add a newline

Currently we add a newline in the ssconf writeout process, even if the
file is empty. We chage this case so that lists of values (e.g. offline
nodes) are correct (not a list of one empty element).

Reviewed-by: imsnah

15 years agoganeti.http: Add constant for DELETE
Michael Hanselmann [Thu, 4 Dec 2008 15:25:26 +0000 (15:25 +0000)]
ganeti.http: Add constant for DELETE

Reviewed-by: amishchenko

15 years agoRemove old HTTP code
Michael Hanselmann [Thu, 4 Dec 2008 15:25:12 +0000 (15:25 +0000)]
Remove old HTTP code

Reviewed-by: amishchenko

15 years agoganeti.rpc: Convert to new HTTP server
Michael Hanselmann [Thu, 4 Dec 2008 15:24:52 +0000 (15:24 +0000)]
ganeti.rpc: Convert to new HTTP server

Reviewed-by: amishchenko

15 years agoganeti-rapi: Convert to new HTTP server
Michael Hanselmann [Thu, 4 Dec 2008 15:24:14 +0000 (15:24 +0000)]
ganeti-rapi: Convert to new HTTP server

Reviewed-by: amishchenko

15 years agoganeti-noded: Migrate to new HTTP server
Michael Hanselmann [Thu, 4 Dec 2008 15:23:50 +0000 (15:23 +0000)]
ganeti-noded: Migrate to new HTTP server

Reviewed-by: amishchenko

15 years agoganeti.http: Split HTTP server and client into separate files
Michael Hanselmann [Thu, 4 Dec 2008 15:23:38 +0000 (15:23 +0000)]
ganeti.http: Split HTTP server and client into separate files

This includes a large rewrite of the HTTP server code. The handling of
OpenSSL errors had some problems that were hard to fix with its
structure. When preparing all of this, I realized that actually HTTP
is a message protocol and that the same code can be used on both the
server and client side to parse requests/responses, with only a few
differences. There are still a few TODOs in the code, but none should
be a show stopper. Many pylint warnings have been fixed, too.

The old code will be removed once all users have been migrated.

Reviewed-by: amishchenko

15 years agoRename all HTTP classes to camel case
Michael Hanselmann [Thu, 4 Dec 2008 15:23:17 +0000 (15:23 +0000)]
Rename all HTTP classes to camel case

It should be consistent.

Reviewed-by: amishchenko

15 years agoganeti.http: Remove underline from two classes
Michael Hanselmann [Thu, 4 Dec 2008 15:22:54 +0000 (15:22 +0000)]
ganeti.http: Remove underline from two classes

This is a preparation step for splitting the HTTP client and server code
into two separate modules.

Reviewed-by: amishchenko

15 years agoMove HTTP code to subpackage
Michael Hanselmann [Thu, 4 Dec 2008 15:22:41 +0000 (15:22 +0000)]
Move HTTP code to subpackage

This is a preparation step for splitting the HTTP client and server code
into two separate modules.

Reviewed-by: amishchenko

15 years agoLURemoveNode, promote nodes to master candidates
Guido Trotter [Thu, 4 Dec 2008 14:52:40 +0000 (14:52 +0000)]
LURemoveNode, promote nodes to master candidates

If after the remove node there are not enough master candidates, we'll
try to promote them.

Reviewed-by: imsnah

15 years agoLUQueryExports: fix rpcresult handling
Guido Trotter [Wed, 3 Dec 2008 17:23:22 +0000 (17:23 +0000)]
LUQueryExports: fix rpcresult handling

call_export_list is a multi node call, so we need to go through the
results, extrapolate the good ones, and return a failure value for the
bad ones.

Reviewed-by: imsnah

15 years agoLUAddNode: Auto-make master candidates
Guido Trotter [Wed, 3 Dec 2008 17:23:08 +0000 (17:23 +0000)]
LUAddNode: Auto-make master candidates

When a node is added, if there are not enough master candidates, we'll
automatically promote it.

Reviewed-by: imsnah

15 years agoLUAddNode: Check the correct result
Guido Trotter [Wed, 3 Dec 2008 17:22:53 +0000 (17:22 +0000)]
LUAddNode: Check the correct result

This is a typo in the conversion to RpcResult

Reviewed-by: imsnah

15 years agoganeti.http: Fix copyright header
Michael Hanselmann [Wed, 3 Dec 2008 16:09:46 +0000 (16:09 +0000)]
ganeti.http: Fix copyright header

Reviewed-by: ultrotter

15 years agoganeti.http: Remove unused attribute "should_fork"
Michael Hanselmann [Wed, 3 Dec 2008 16:09:34 +0000 (16:09 +0000)]
ganeti.http: Remove unused attribute "should_fork"

This is a leftover from removed code.

Reviewed-by: ultrotter

15 years agoganeti.http: Move request handling logic from server to handler class
Michael Hanselmann [Wed, 3 Dec 2008 16:09:20 +0000 (16:09 +0000)]
ganeti.http: Move request handling logic from server to handler class

Reviewed-by: ultrotter

15 years agoganeti.http: Move _SocketOperation to module-level function
Michael Hanselmann [Wed, 3 Dec 2008 16:09:04 +0000 (16:09 +0000)]
ganeti.http: Move _SocketOperation to module-level function

This is a preparation step to move the HTTP server class to the
same model as the HTTP client (polling, non-blocking I/O, better
OpenSSL error handling).

Reviewed-by: ultrotter

15 years agoganeti.http: Move _WaitForCondition into module-level function
Michael Hanselmann [Wed, 3 Dec 2008 16:08:51 +0000 (16:08 +0000)]
ganeti.http: Move _WaitForCondition into module-level function

Reviewed-by: ultrotter

15 years agoganeti.http: Remove ApacheLogfile class
Michael Hanselmann [Wed, 3 Dec 2008 16:08:25 +0000 (16:08 +0000)]
ganeti.http: Remove ApacheLogfile class

We don't need it anymore and it wouldn't work as it is, anyway.

Reviewed-by: ultrotter

15 years agoInitCluster force a config file update
Guido Trotter [Wed, 3 Dec 2008 11:12:55 +0000 (11:12 +0000)]
InitCluster force a config file update

After the cluster is ready we'll load the ConfigWriter and force a
writeout of all config files.

Reviewed-by: imsnah

15 years agoMake sure the initial node is a master candidate
Guido Trotter [Wed, 3 Dec 2008 11:12:43 +0000 (11:12 +0000)]
Make sure the initial node is a master candidate

Reviewed-by: imsnah

15 years agognt-cluster init, handle candidate_pool_size
Guido Trotter [Wed, 3 Dec 2008 11:12:30 +0000 (11:12 +0000)]
gnt-cluster init, handle candidate_pool_size

- Add a new command line option, defaulting to the constant value
- Pass the value to bootstrap.InitCluster
- Use it to init the new Cluster object

Reviewed-by: imsnah

15 years agoAdd the MASTER_POOL_SIZE_DEFAULT constant
Guido Trotter [Wed, 3 Dec 2008 11:12:16 +0000 (11:12 +0000)]
Add the MASTER_POOL_SIZE_DEFAULT constant

This constant will be used at cluster init time.

Reviewed-by: imsnah

15 years agoCheckBEParams handle a bool BE_AUTO_BALANCE
Guido Trotter [Wed, 3 Dec 2008 11:12:04 +0000 (11:12 +0000)]
CheckBEParams handle a bool BE_AUTO_BALANCE

This only happens at cluster init, if the value is not user-specified.

Reviewed-by: imsnah

15 years agoExtract the ListNodes headers and use them in help
Guido Trotter [Wed, 3 Dec 2008 10:28:50 +0000 (10:28 +0000)]
Extract the ListNodes headers and use them in help

Currently we have to update both the ListNodes headers and the online
help for the full field list. This patch uses the headers keys for the
help, thus removing duplicating places to update, and adding hope that
we'll have things in sync. As a downside we lose ordering of the
non-default fields in the online help.

Reviewed-by: imsnah

15 years agoA few fixes related to master candidates
Iustin Pop [Wed, 3 Dec 2008 09:57:22 +0000 (09:57 +0000)]
A few fixes related to master candidates

This patch:
  - fixes cluster verify when all nodes are master candidates, but the
    candidate_pool_size is higher
  - warn when the master node is not marked as candidate
  - disable setting master node to regular node
  - don't pass the master node to context.ReaddNode since the job queue
    doesn't like getting our own node name

Reviewed-by: ultrotter

15 years agoFix cluster rename and known_hosts
Iustin Pop [Wed, 3 Dec 2008 09:55:59 +0000 (09:55 +0000)]
Fix cluster rename and known_hosts

This patch rewrites and distributes ganeti's known_hosts file in case of
a cluster rename.

We also fix a problem in the node add (from where I copied the
known_hosts file distribution).

Reviewed-by: ultrotter

15 years agoFix hooks_unittest with new rpc call structure
Guido Trotter [Tue, 2 Dec 2008 14:49:21 +0000 (14:49 +0000)]
Fix hooks_unittest with new rpc call structure

Reviewed-by: iustinp

15 years agoFix gnt-cluster verify w.r.t. rpc changes
Iustin Pop [Tue, 2 Dec 2008 14:35:02 +0000 (14:35 +0000)]
Fix gnt-cluster verify w.r.t. rpc changes

This partially reorganizes the cluster verify LU:
  - introduce constants for the node verify rpc call
  - move from additional rpc calls to a single rpc call, the
    call_node_info, which gaters all data needed

Also fix a small error (self.LogWarning instead of self.Warning).

Reviewed-by: imsnah

15 years agoFix cluster rename
Iustin Pop [Tue, 2 Dec 2008 12:58:42 +0000 (12:58 +0000)]
Fix cluster rename

With the recent configwriter/ssconf changes, cluster rename becomes
trivial. This patch gets rids of the code and just updates the cluster
object.

Reviewed-by: imsnah

15 years agoConvert rpc results to a custom type
Iustin Pop [Tue, 2 Dec 2008 12:58:31 +0000 (12:58 +0000)]
Convert rpc results to a custom type

For a long time we had the problem that both RPC-layer errors and
results from the remote node share the same "valuespace". This is
because we shouldn't raise an exception when only one node failed
(and lose the results from the other nodes).

This patch attempts to address this problem by returning a special
object from RPC calls, which separates the rpc-layer status and the
remote results into different attributes.

All the users of rpc (mainly cmdlib, but also bootstrap and the
HooksMaster in mcpu) have been converted to this new model. The code has
changed from, e.g. for boolean return types:

  if not self.rpc.call_...

to

  result = self.rpc.call_
  if result.failed or not result.data:
     ^ rpc-layer error    |
                          - result payload

While this is slightly more complicated, it will allow cleaner checks in
the future; right now the code is just a plain port, without
optimizations.

There's also a "result.Raise()" which raises an OpExecError if the
rpc-layer had errors.

One side-effect of the patch is that now all return types from the
rpc.call_ functions are of either RpcResult (single-node) or dicts of
(node name, RpcResult); previously, some functions were returning
different object types based on error status.

The code passes burnin (after many retries :).

Reviewed-by: imsnah

15 years agoburnin: add instance reinstall and reboot
Iustin Pop [Tue, 2 Dec 2008 12:58:15 +0000 (12:58 +0000)]
burnin: add instance reinstall and reboot

These two operations were missing from burnin. The reboot is done with
all valid modes (a new constant is added), and the reinstall is done
both with and without specifying the OS (to account for the two code
paths in the LU).

Reviewed-by: imsnah

15 years agoburnin: don't do export/import for file storage
Iustin Pop [Tue, 2 Dec 2008 12:58:00 +0000 (12:58 +0000)]
burnin: don't do export/import for file storage

This is currently not supported, so don't try to do export/import in
this case.

Reviewed-by: imsnah

15 years agoKVMHypervisor add two missing 'constants.'
Guido Trotter [Tue, 2 Dec 2008 10:54:37 +0000 (10:54 +0000)]
KVMHypervisor add two missing 'constants.'

Some calls to the HV parameters were missing them.

Reviewed-by: imsnah

15 years agoKVMHypervisor fix to case misspellings
Guido Trotter [Tue, 2 Dec 2008 10:54:21 +0000 (10:54 +0000)]
KVMHypervisor fix to case misspellings

Reviewed-by: imsnah

15 years agocluster init: don't discard the hypervisor
Guido Trotter [Tue, 2 Dec 2008 10:54:03 +0000 (10:54 +0000)]
cluster init: don't discard the hypervisor

On cluster init if the user specifies a default hypervisor (with -t)
which is not in the default list of enabled hypervisors (currently just
xen-pvm) without explicitely specifying the list we silently override
the choice.

With this patch we set the list by default to just the required one, and
we bail out should the list be hand-specified and not contain the
default one. This still has an issue when the user doesn't specify a
default hypervisor but specifies a list which doesn't include xen-pvm:
in this case though we give an error, rather than silently discarding
choices.

Reviewed-by: imsnah

15 years agoUse the new utils.CheckBEParams function
Guido Trotter [Tue, 2 Dec 2008 10:53:25 +0000 (10:53 +0000)]
Use the new utils.CheckBEParams function

Where we used/forgot to validate beparams we now use the new common function.

Reviewed-by: imsnah

15 years agoAdd utils.CheckBEParams
Guido Trotter [Tue, 2 Dec 2008 10:53:14 +0000 (10:53 +0000)]
Add utils.CheckBEParams

This function will be used in LUCreateInstance, LUSetInstanceParams,
LUSetClusterParams and InitCluster to check the backend parameters
validity and convert the relevant values to integer, without duplicating
code. It lives in utils as bootstrap.py is calling it too.

Reviewed-by: imsnah

15 years agoAdd constants.VALUE_TRUE and VALUE_FALSE
Guido Trotter [Tue, 2 Dec 2008 10:53:01 +0000 (10:53 +0000)]
Add constants.VALUE_TRUE and VALUE_FALSE

Reviewed-by: imsnah