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

15 years agoHandle default/none values in hv/be params
Guido Trotter [Tue, 2 Dec 2008 10:25:48 +0000 (10:25 +0000)]
Handle default/none values in hv/be params

When a value is set to constants.VALUE_DEFAULT we have to remove it from
the specific instance dict, as this way it will be populated from the
cluster before. If instead it's specified as constants.VALUE_NONE we'll
explicitely set it to None, to override its presence with a different
values in such defaults. However, currently, we handle None values only
for hvparams, that have a real use case for them.

Reviewed-by: imsnah

15 years agoSetInstanceParams: handle default/none values
Guido Trotter [Tue, 2 Dec 2008 10:25:34 +0000 (10:25 +0000)]
SetInstanceParams: handle default/none values

If the hv/be parameter lowercase value is set to "default" we'll pass
constants.VALUE_DEFAULT, if it's set to "none" we'll pass
constants.VALUE_NONE.

Reviewed-by: imsnah

15 years agoUpdate gnt-backup online help
Guido Trotter [Tue, 2 Dec 2008 10:19:43 +0000 (10:19 +0000)]
Update gnt-backup online help

--src-node and --src-dir are not mandatory anymore

Reviewed-by: iustinp

15 years agoImportExport: make src_node and src_path optional
Guido Trotter [Tue, 2 Dec 2008 10:19:30 +0000 (10:19 +0000)]
ImportExport: make src_node and src_path optional

If src_node is not there we'll default to using the currently exported
instance name as src_path. Also, if src_path is not absolute we'll look
for it in EXPORT_DIR.

Reviewed-by: iustinp

15 years agoLUCreateInstance: handle import without src_node
Guido Trotter [Tue, 2 Dec 2008 10:19:16 +0000 (10:19 +0000)]
LUCreateInstance: handle import without src_node

If we get called with no source node we'll thread src_path as an
instance name exported in EXPORT_DIR in one of the nodes and look for
it with the export_list rpc call.

Reviewed-by: iustinp

15 years agoLUCreateInstance: keep src node lock on import
Guido Trotter [Tue, 2 Dec 2008 10:19:02 +0000 (10:19 +0000)]
LUCreateInstance: keep src node lock on import

Currently the node lock also guards against removing the import at the
wrong time, so if we're importing an instance image we want to keep the
source node locked. In the future we might want to put export locks at a
different level than node locks.

Reviewed-by: iustinp

15 years agoFix master failover
Iustin Pop [Tue, 2 Dec 2008 05:07:01 +0000 (05:07 +0000)]
Fix master failover

The ssconf files were not updated by the master failover. We need to
push them, and since we already have RPC initialized, we can use the
standard ConfigWriter to do so - this will take care of both the config
file and the ssconf files.

Reviewed-by: imsnah

15 years agoAdjust cluster-verify to check for candidate role
Iustin Pop [Tue, 2 Dec 2008 05:06:47 +0000 (05:06 +0000)]
Adjust cluster-verify to check for candidate role

Currently cluster verify checks all nodes for the same set of files,
even if the nodes are not master candidates.

This patch adds back checking of ssconf files for consistency and splits
the checksum check into different error reporting messages based on
candidate role.

Reviewed-by: imsnah

15 years agoAdd candidate pool size checks in verify
Iustin Pop [Tue, 2 Dec 2008 05:06:34 +0000 (05:06 +0000)]
Add candidate pool size checks in verify

Reviewed-by: imsnah

15 years agoPrevent demotion from candidate based on pool size
Iustin Pop [Tue, 2 Dec 2008 05:06:21 +0000 (05:06 +0000)]
Prevent demotion from candidate based on pool size

In gnt-cluster modify we prevent demotion from the candidate role if
there are not enough master candidates left.

Reviewed-by: imsnah

15 years agoAdd cluster candidate pool size parameter
Iustin Pop [Tue, 2 Dec 2008 05:06:08 +0000 (05:06 +0000)]
Add cluster candidate pool size parameter

This patch adds a new cluster paramater "candidate_pool_size" which
tracks the desired size of the list of nodes with the master_candidate
flag set.

Reviewed-by: imsnah

15 years agoPrevent master failover to a non candidate node
Iustin Pop [Tue, 2 Dec 2008 05:05:53 +0000 (05:05 +0000)]
Prevent master failover to a non candidate node

Reviewed-by: imsnah

15 years agoAdd the list of master candidates to ssconf
Iustin Pop [Tue, 2 Dec 2008 05:05:40 +0000 (05:05 +0000)]
Add the list of master candidates to ssconf

Reviewed-by: imsnah

15 years agoRestrict job propagation to master candidates only
Iustin Pop [Tue, 2 Dec 2008 05:05:25 +0000 (05:05 +0000)]
Restrict job propagation to master candidates only

This patch restricts the job propagation to master candidates only, by
not registering non-candidates in the job queue node lists.

Note that we do intentionally purge the job queue if a node is toggled
to non-master status.

Reviewed-by: imsnah

15 years agoRestrict config replication to master candidates
Iustin Pop [Tue, 2 Dec 2008 05:05:12 +0000 (05:05 +0000)]
Restrict config replication to master candidates

This patch restricts the config data replication to master candidates
only.

Reviewed-by: imsnah

15 years agoAdd a gnt-node modify operation
Iustin Pop [Tue, 2 Dec 2008 05:05:01 +0000 (05:05 +0000)]
Add a gnt-node modify operation

This patch adds the OpCode, LogicalUnit and gnt-node command for
modifying node parameters, more specifically the master candidate flag
for a node.

Reviewed-by: imsnah

15 years agoAdd master/master_candidate fields to node list
Iustin Pop [Tue, 2 Dec 2008 05:04:44 +0000 (05:04 +0000)]
Add master/master_candidate fields to node list

This patch adds listing of the master_candidate field (as Y/N) and of
the master role (again Y/N) for nodes.

Reviewed-by: imsnah

15 years agoIntroduce a new 'master_candidate' node attribute
Iustin Pop [Tue, 2 Dec 2008 05:04:28 +0000 (05:04 +0000)]
Introduce a new 'master_candidate' node attribute

The field is not yet used.

Reviewed-by: imsnah

15 years agoSimplify a little the ssconf update
Iustin Pop [Tue, 2 Dec 2008 05:04:17 +0000 (05:04 +0000)]
Simplify a little the ssconf update

We have (again) the KeyToFilename function, so we move the writing of
the files to a method under SimpleStore.

Reviewed-by: imsnah

15 years agoReplicate the node list in ssconf
Iustin Pop [Tue, 2 Dec 2008 05:04:05 +0000 (05:04 +0000)]
Replicate the node list in ssconf

This patch adds node_list in the list of replicated values from
ConfigWriter.

Reviewed-by: imsnah

15 years agoRevert "Get rid of ssconf"
Iustin Pop [Tue, 2 Dec 2008 05:03:52 +0000 (05:03 +0000)]
Revert "Get rid of ssconf"

This partially reverts the "Get rid of ssconf" patch.

It adds back a simpler version of the SimpleStore class, and drops the
WritableSimpleStore class. The new version of the class also has
node_list as a new key, and increases the size of the keys so that big
clusters will fit the node list. Also, the SS_* constants are moved to
constants.py, since the ConfigWriter class will need them too in order
to generate the values dictionary.

It also changes the GetMasterAndMyself function to use the SimpleStore
by default, and the backend._GetConfig to use it too (it has all the
needed keys).

Reviewed-by: imsnah

15 years agoburnin: fix usage of diskless template
Iustin Pop [Tue, 2 Dec 2008 01:41:00 +0000 (01:41 +0000)]
burnin: fix usage of diskless template

This allows burnin to work with diskless instances (since we cannot pass
right now no disks to it).

Reviewed-by: imsnah

15 years agoUpdate QA scripts to new cluster parameters
Michael Hanselmann [Mon, 1 Dec 2008 20:52:31 +0000 (20:52 +0000)]
Update QA scripts to new cluster parameters

There are still issues, especially with "gnt-instance modify" and
resetting values. However, this is a start.

Reviewed-by: ultrotter

15 years agognt-instance add: Remove "--os-size" and "--swap-size"
Michael Hanselmann [Mon, 1 Dec 2008 20:52:17 +0000 (20:52 +0000)]
gnt-instance add: Remove "--os-size" and "--swap-size"

They're not used anymore.

Reviewed-by: ultrotter

15 years agoFix RpcRunner._StaticSingleNodeCall
Michael Hanselmann [Mon, 1 Dec 2008 20:52:03 +0000 (20:52 +0000)]
Fix RpcRunner._StaticSingleNodeCall

Unfortunately, a rpc.Client object was passed as the first parameter,
causing the function to always fail.

Found during QA testing.

Reviewed-by: ultrotter

15 years agoInitCluster: initialize master node serial_no
Guido Trotter [Mon, 1 Dec 2008 15:47:12 +0000 (15:47 +0000)]
InitCluster: initialize master node serial_no

Currently it was left alone, and thus its value was "null".

Reviewed-by: imsnah

15 years agoFix errors when the node info RPC is incomplete
Iustin Pop [Mon, 1 Dec 2008 06:02:06 +0000 (06:02 +0000)]
Fix errors when the node info RPC is incomplete

[Forward-port from the 1.2 branch]

If ganeti starts before xend, the node information will not have all the
fields filled in. The patch changes so that missing keys will be treated
as unknown (this applies to other cases as well, not only xend not
started).

Reviewed-by: ultrotter

15 years agoRAPI:Fix root list and unittest for it.
Oleksiy Mishchenko [Fri, 28 Nov 2008 13:58:58 +0000 (13:58 +0000)]
RAPI:Fix root list and unittest for it.

Reviewed-by: imsnah

15 years agoRAPI: Switch from opcodes to no native 2.0 queries.
Oleksiy Mishchenko [Fri, 28 Nov 2008 12:02:16 +0000 (12:02 +0000)]
RAPI: Switch from opcodes to no native 2.0 queries.

Reviewed-by: imsnah

15 years agojqueue: Always print message for 100% when inspecting queue
Michael Hanselmann [Fri, 28 Nov 2008 10:29:04 +0000 (10:29 +0000)]
jqueue: Always print message for 100% when inspecting queue

Reviewed-by: iustinp

15 years agognt-job: Print message from CancelJob to standard output
Michael Hanselmann [Fri, 28 Nov 2008 10:28:43 +0000 (10:28 +0000)]
gnt-job: Print message from CancelJob to standard output

Reviewed-by: iustinp

15 years agojqueue: Allow jobs waiting for locks to be canceled
Michael Hanselmann [Fri, 28 Nov 2008 10:28:31 +0000 (10:28 +0000)]
jqueue: Allow jobs waiting for locks to be canceled

- Add new "canceling" status
- Notify clients when job is canceled
- Give a return value from CancelJob
- Handle it in the client library

Reviewed-by: iustinp

15 years agoImprove the node add operation
Iustin Pop [Thu, 27 Nov 2008 10:38:41 +0000 (10:38 +0000)]
Improve the node add operation

Currently, the node add operation uses a job to query the node name and
the bootstrap function directly reads the config file for the cluster
name.

This patch changes to that both the cluster name and the verification of
the node is done via queries to the master.

Reviewed-by: ultrotter

15 years agoFix logic bug in rev 2072
Iustin Pop [Thu, 27 Nov 2008 10:21:46 +0000 (10:21 +0000)]
Fix logic bug in rev 2072

In revision 2072 "ConfigWriter: change cluster serial meaning" I misread
the serial_no update logic: it was about updating the serial number on
the object itself, not on the cluster.

So we don't actually have at all cluster serial number increase when a
node is changed (not removed/added).

This patch revers to the original always increase the target serial
number and adds increase of the cluster serial number in case a node has
been changed.

Reviewed-by: ultrotter

15 years agojqueue: fix a bug in an error path
Iustin Pop [Thu, 27 Nov 2008 03:13:49 +0000 (03:13 +0000)]
jqueue: fix a bug in an error path

Dictionaries raise KeyError, and not ValueError when invalid keys are
passes to del.

Reviewed-by: imsnah

15 years agoConfigWriter: change cluster serial meaning
Iustin Pop [Thu, 27 Nov 2008 03:13:37 +0000 (03:13 +0000)]
ConfigWriter: change cluster serial meaning

Currently, we increase the cluster serial number for instance additions,
removals and renames. This is conforming with the REST paradigm, however
it means that for each of these operations, we need to push ssconf
updates to all nodes.

In order to support future cases with reduced set of master-eligible
nodes, we want to reduce the ssconf pushes (which need to be to all
nodes). This patch changes the meaning for the cluster serial number so
that it doesn't track instance operations at all.

This means that addition of an instance can fail due to concurrent
additions, even if the cluster serial has not changed. It slightly
breaks the REST paradigm, but IMHO it's better for actual usage.

Reviewed-by: ultrotter

15 years agoinstance import: adapt to multi-disk/nic world
Iustin Pop [Thu, 27 Nov 2008 03:13:27 +0000 (03:13 +0000)]
instance import: adapt to multi-disk/nic world

This is mostly a copy from gnt-instance add; import works, but it's not
optimal - device count/parametrs should be able to be reused.

Reviewed-by: ultrotter

15 years agoFix gnt-backup export
Iustin Pop [Thu, 27 Nov 2008 03:13:17 +0000 (03:13 +0000)]
Fix gnt-backup export

This patch fixes a bug in disk calculation for gnt-backup export, which
completely broke one-disk instance export.

The patch also corrects some error messages and style issues.

Reviewed-by: ultrotter

15 years agoFix a message in LUExportInstance
Iustin Pop [Thu, 27 Nov 2008 03:13:05 +0000 (03:13 +0000)]
Fix a message in LUExportInstance

We never verified the node name before, so this is most likely not a
non-retrieve but a wrong name case.

Reviewed-by: ultrotter

15 years agoAllow network-less instances
Iustin Pop [Thu, 27 Nov 2008 03:12:53 +0000 (03:12 +0000)]
Allow network-less instances

Currently there's no way to specify no NICs for an instance, even though
this is a supported configuration.

The patch adds a --no-nics option to gnt-instance add.

Reviewed-by: amishchenko

15 years agoFix gnt-job submit
Iustin Pop [Thu, 27 Nov 2008 03:12:43 +0000 (03:12 +0000)]
Fix gnt-job submit

The submit function was using a very old API. This patch brings it up to
date.

Reviewed-by: imsnah

15 years agoSmall change to job failure output
Iustin Pop [Thu, 27 Nov 2008 03:12:31 +0000 (03:12 +0000)]
Small change to job failure output

Currently, job failures are done by raising OpExecError(job result). For
a one-opcode job that failed, this is very non-intuitive:
Failure: command execution error:
[u'Disk size change not possible, use grow-disk']

This patch changes the output in two ways:
 - for a job which didn't have opcodes which succeeded, it changes it
   to:
   Failure: command execution error:
   Disk size change not possible, use grow-disk
 - for a job with partial completion, to:
   Failure: command execution error:
   partial failure (opcode 1): Cannot remove the last disk of an
   instance

The actual error type is not changed. A job that doesn't have at least
an error-ed opcode is shown as before.

Reviewed-by: imsnah

15 years agoFix file-based block devices
Iustin Pop [Thu, 27 Nov 2008 03:12:18 +0000 (03:12 +0000)]
Fix file-based block devices

We changed a while ago the protocol for opening block devices, but
FileStorage was not changed. This patch makes it work again.

Reviewed-by: imsnah

15 years agoFix instance creation
Iustin Pop [Thu, 27 Nov 2008 03:12:07 +0000 (03:12 +0000)]
Fix instance creation

This patch fixes the diskless and drbd/file based instances. Sorry :(

Reviewed-by: ultrotter

15 years agoganeti-masterd: create RUN_GANETI_DIR as well
Guido Trotter [Wed, 26 Nov 2008 16:49:33 +0000 (16:49 +0000)]
ganeti-masterd: create RUN_GANETI_DIR as well

Since we're not sure ganeti-noded has started yet, we need to create
RUN_GANETI_DIR before SOCKET_DIR as well, with the proper permissions.

Reviewed-by: imsnah