Michael Hanselmann [Fri, 9 May 2008 12:46:52 +0000 (12:46 +0000)]
Add --enable-rapi parameter to configure
This allows developers and packagers to control whether they want to start
the remote API daemon, ganeti-rapi, automatically or not.
Reviewed-by: ultrotter
Michael Hanselmann [Fri, 9 May 2008 09:25:55 +0000 (09:25 +0000)]
Start and stop remote API with master role
At the moment, the remote API is always started on the master with the
default port and with no SSL encryption enabled.
Reviewed-by: iustinp
Guido Trotter [Thu, 8 May 2008 19:48:14 +0000 (19:48 +0000)]
Improve DRBDev.Open docstring as well
Reviewed-by: iustinp
Guido Trotter [Thu, 8 May 2008 19:47:55 +0000 (19:47 +0000)]
Improve DRBD8.Open's docstring a bit more
Reviewed-by: iustinp
Guido Trotter [Thu, 8 May 2008 17:26:17 +0000 (17:26 +0000)]
Fix comment typo in bdev.py
Reviewed-by: iustinp
Michael Hanselmann [Thu, 8 May 2008 15:57:57 +0000 (15:57 +0000)]
Small codestyle fixes for ganeti-noded, ganeti-master and init script
Reviewed-by: iustinp
Michael Hanselmann [Thu, 8 May 2008 15:57:35 +0000 (15:57 +0000)]
Remove unimplemented rapi resources
Reviewed-by: iustinp, amishchenko
Michael Hanselmann [Thu, 8 May 2008 15:56:33 +0000 (15:56 +0000)]
Codestyle fixes and docstring updates for rapi
Reviewed-by: iustinp
Iustin Pop [Thu, 8 May 2008 08:20:00 +0000 (08:20 +0000)]
Fix DRBD8 diskless assembling
The algorithm for attaching to existing DRBD devices is not trivial. It
has four alternatives, and there is a bug in the last one when we have
diskless devices.
The last case (local disk info matches but remote/network configuration
doesn't match) we disconnect from the network and reattach with the
correct info. We do this because correct local device has higher
priority than remote device.
However, the test we use (self._MatchesLocal) can succeed in two cases:
- we have a disk and it's the same as the one attached
- we don't have a disk and the drbd is in diskless mode
But this creates problems for the fourth case as when we already have
one diskless DRBD, activating then next one will do:
- _MatchesLocal? yes, because both config data and system have no
disks (with the effect that all diskless devices are identical)
- _MatchesRemote? no, because this disk is configured to its current
remote peer, not to our new one
The fix is trivial, although the algorithm not: we only allow overriding
the network configuration when the disk information matches and we are
not diskless, by adding the <"local_dev" in info'> test.
Reviewed-by: ultrotter
Iustin Pop [Mon, 5 May 2008 09:41:33 +0000 (09:41 +0000)]
Export the number of cpus to iallocator scripts
Now that we have the number of cpus available from the hypervisors, we
can export this to the iallocator scripts.
Reviewed-by: ultrotter
Iustin Pop [Mon, 5 May 2008 09:37:48 +0000 (09:37 +0000)]
Minor doc/help update
This shortens the help output in gnt-node so that the output looks
nicer, and improves the manual page for gnt-instance with the new
'status' field.
Reviewed-by: ultrotter
Iustin Pop [Mon, 5 May 2008 09:35:10 +0000 (09:35 +0000)]
Improve the gnt-* list field selection
This patch allows the '-o' option to the list subcommands to add more
fields to the default list instead of replacing the default list by
prefixing the fields list with '+'.
The patch also moves the listing (in the help output) of the default
field list from hardcoded to built at runtime from the actual list.
Reviewed-by: ultrotter
Guido Trotter [Mon, 5 May 2008 09:09:23 +0000 (09:09 +0000)]
Wrap exception in _DistributeConfig code
nodelist.remove(X) could potentially raise a ValueError (even if the chance
that the current node is not in the list are pretty scarce, and its absence
should raise a red flag anyway). If this happens let things go on, as that's
what the code which previously distributed the config did.
Reviewed-by: iustinp
Guido Trotter [Mon, 5 May 2008 09:09:13 +0000 (09:09 +0000)]
Simplify target generation in DistributeConfig
Currently we get the list of nodes, and for each one extract all its info, and
just to exclude it if the name matches ours. Since the list of nodes is a list
of names just use .remove() to exclude ourself from it, and use that list
directly.
Reviewed-by: iustinp
Alexander Schreiber [Fri, 2 May 2008 17:26:48 +0000 (17:26 +0000)]
Show cluster hypervisor for gnt-cluster info
Reviewed-by: iustinp
Alexander Schreiber [Fri, 2 May 2008 11:10:35 +0000 (11:10 +0000)]
Another for gnt-instance modify & HVM parameters
Another tiny fix. Anybody got a nice brown paper bag I can wear?
Reviewed-by: iustinp
Alexander Schreiber [Fri, 2 May 2008 10:05:15 +0000 (10:05 +0000)]
make gnt-modify work with new HVM parameters
This fixes gnt-instance modify so it actually works with the
new HVM parameters for Ganeti 1.2
Reviewed-by: iustinp
Iustin Pop [Wed, 30 Apr 2008 15:53:19 +0000 (15:53 +0000)]
Add node cpu count to gnt-node list
This patch adds the backend and frontend changes needed for being able
to list the cpu count.
Reviewed-by: ultrotter
Michael Hanselmann [Wed, 30 Apr 2008 12:55:15 +0000 (12:55 +0000)]
Add new Makefile.am for lib/rapi/
Reviewed-by: iustinp
Michael Hanselmann [Wed, 30 Apr 2008 12:55:00 +0000 (12:55 +0000)]
Move target creating symlinks in lib/ into Makefile.libcommon
Reviewed-by: iustinp
Iustin Pop [Wed, 30 Apr 2008 09:39:46 +0000 (09:39 +0000)]
RAPI: Change the daemon to standard calling syntax
This patch removes the start/stop options from the ganeti-rapi daemon.
The reasons for this are multiple:
- we want to have the same startup/shutdown methods in all daemon
(call with no arguments for start, stop using start-stop-daemon or
such)
- the code for parsing /proc/net/tcp does not belong in ganeti, but in
tools like fuser (fuser -kn tcp 5080)
Note that due to how the RESTHTTPServer is written, the daemon must
currently be killed via -9, so a simple killall doesn't work.
Reviewed-by: imsnah
Guido Trotter [Wed, 30 Apr 2008 09:24:26 +0000 (09:24 +0000)]
hooks.sgml: Add cluster-verify hooks information
Reviewed-by: iustinp
Guido Trotter [Wed, 30 Apr 2008 09:24:10 +0000 (09:24 +0000)]
Add cluster-verify hooks
Only post-hooks are run on cluster verify, and then their output is sent back
to the LU, which upon failure displays it to the user and changes the result of
the execution to a failure.
Reviewed-by: iustinp
Guido Trotter [Wed, 30 Apr 2008 09:23:57 +0000 (09:23 +0000)]
Add a LU Hooks notification function
Previously LUs could be failed by pre-hooks, and post-hooks just had effects by
themselves. This patch allows a LU to define the HooksCallBack function if it
wants to know about its hooks' results and alter its results in response.
The ChainOpCode execution path contains some commented out hooks code, which
this patch modifies to run the HooksCallBack function, so this is not forgot if
it ever gets uncommented out.
Reviewed-by: iustinp
Guido Trotter [Wed, 30 Apr 2008 09:23:42 +0000 (09:23 +0000)]
HooksMaster: Make RunPhase return the rpc output
Right now the hooks output is propagated from the nodes all the way up to
HooksMaster.RunPhase, which uses it for debugging PRE hooks, but then silently
discards them. We'll now propagate it up to the Processor.ExecOpCode function,
where they can be handled for other purposes (or discarded again, of course).
This patch also improves a bit the HooksMaster.RunPhase docstring.
Reviewed-by: iustinp
Guido Trotter [Wed, 30 Apr 2008 09:23:29 +0000 (09:23 +0000)]
Remove NoHooksLU.BuildHooksEnv
Since NoHooksLU defines HPATH as None, BuildHooksEnv will never be called (as
the LogicalUnit.BuildHooksEnv docstring correctly states). Removing the
function altogether, to avoid having dead code lying around, and to make sure
the non-implemented one in LogicalUnit will be called if someone mistakenly
tries to call it, so it's immediately clear that something is wrong.
Reviewed-by: iustinp
Guido Trotter [Wed, 30 Apr 2008 09:23:15 +0000 (09:23 +0000)]
LogicalUnit.BuildHooksEnv, update docstring
The LogicalUnit.BuildHooksEnv docstring used to say that the node list should
not include the master node. This is obviously not the case checking the
relevant code, and double-checking with iustin he confirmed it just document
some obsolete behaviour. This patch removes those remarks making the docstring
shorter, easier, and, last but not least, correct! ;)
Reviewed-by: iustinp
Guido Trotter [Wed, 30 Apr 2008 09:22:59 +0000 (09:22 +0000)]
Remove non-existing arguments from some docstrings
A fewdocstrings in the HooksRunner backend class list arguments the relevant
functions do not take. Clean them up.
Reviewed-by: iustinp
Oleksiy Mishchenko [Wed, 30 Apr 2008 09:22:44 +0000 (09:22 +0000)]
Implement locking in Ganeti Remote API
Reviewed-by: iustinp
Iustin Pop [Wed, 30 Apr 2008 09:20:18 +0000 (09:20 +0000)]
RAPI: Workaround twisted failure by early import rpc
This could probably solved in a nicer way, but it seems that somehow twisted
gets imported before our rpc which overrides the default twisted reactor; or
maybe it gets imported twice or such. Anyway, importing rpc early makes the rpc
layer work.
Lest this is taken as a random thing, this can be consistently
reproduced and traces of imports are not very clear of why this happens
- nor why gnt-os works, despite having a very similar import list and
not importing rpc.
Reviewed-by: amishchenko,imsnah
Iustin Pop [Mon, 28 Apr 2008 09:44:39 +0000 (09:44 +0000)]
Move iallocator script execution to ganeti-noded
Currently the iallocator execution takes place in the master, which is a
violation of the current architecture, and will create problems with a
threaded master daemon.
This patch moves the execution to the backend, similar to the hooks
runner, by:
- introducing a new class that handles the execution in the backend
(and could be used also for listing the allocators, etc.)
- introducing a new rpc call
- replacing the actual execution in IAllocator.Run() with a rpc call
This passes burnin with the dumb allocator
Reviewed-by: imsnah
Iustin Pop [Mon, 28 Apr 2008 09:44:03 +0000 (09:44 +0000)]
Fix iallocator instance info
The commit "IAllocator: some more info exported" broke the instance list
generation due to a wrong index variable. This patch fixes that.
Reviewed-by: ultrotter
Alexander Schreiber [Fri, 25 Apr 2008 14:56:40 +0000 (14:56 +0000)]
[PATCH] show only parameters relevant to the instance
This patch modifies the code for "gnt-instance info .." to only display
instance parameters that actually apply to that instance, i.e. for PVM
instances no HVM parameters are shown and vice versa.
Reviewed-by: iustinp
Alexander Schreiber [Fri, 25 Apr 2008 13:34:28 +0000 (13:34 +0000)]
patch 4/4 extended HVM features for 1.2
This patch documents the extended HVM features.
Reviewed-by: imsnah
Alexander Schreiber [Fri, 25 Apr 2008 12:37:18 +0000 (12:37 +0000)]
patch 3/4 extended HVM features for 1.2
This patch adds hypervisor support for the extended HVM features.
Reviewed-by: iustinp
Iustin Pop [Fri, 25 Apr 2008 12:06:10 +0000 (12:06 +0000)]
IAllocator: some more info exported
This patch adds the following information to the exported info:
- hypervisor type (in the main dict)
- total memory used by primary instances (in each node dict) (can be
computed from the node+instance dicts, but it's cheap to compute
from Ganeti) (this is not live data, just from the config)
- total memory used by primary instances marked to be up, similar to
the above
Reviewed-by: imsnah
Iustin Pop [Fri, 25 Apr 2008 12:05:54 +0000 (12:05 +0000)]
IAllocator: simplify node info computation
Currently we try to convert the values returned by call_node_info to
ints, and if all succeed, we actually do the conversion. Simplify this
by doing it in one step.
The patch also adds exporting of node memory as 'reserved_memory'.
Reviewed-by: imsnah
Alexander Schreiber [Fri, 25 Apr 2008 11:38:58 +0000 (11:38 +0000)]
patch 2/4 extended HVM features for 1.2
This patch adds the commandline extensions and the code to store
and display the extended HVM features.
Reviewed-by: iustinp
Oleksiy Mishchenko [Fri, 25 Apr 2008 10:05:20 +0000 (10:05 +0000)]
Generalize RAPI request handling flow
All request we goin to hanle have similar prerun steps, lets keep them in the same bucket.
Reviewd-by: iustinp
Iustin Pop [Fri, 25 Apr 2008 09:53:26 +0000 (09:53 +0000)]
Add iallocator documentation
Reviewed-by: imsnah
Guido Trotter [Thu, 24 Apr 2008 19:45:17 +0000 (19:45 +0000)]
burnin: improve -t help message
Make the help message a bit more similar to the trunk version, which is
actually better ("Disk template" is a lot clearer than "Template type")
Reviewed-by: imsnah
Iustin Pop [Thu, 24 Apr 2008 14:54:37 +0000 (14:54 +0000)]
Chage the rapi to conform to new OpDiagnoseOS
This patch modifies the remote api to conform to the new format for the
input and output of the OpDiagnoseOS opcode.
Reviewed-by: amishchenko
Iustin Pop [Thu, 24 Apr 2008 14:54:24 +0000 (14:54 +0000)]
Backport: Rework the results of OpDiagnoseOS opcode
Currently, the opcode DiagnoseOS is the only opcode that return a
structure of objects.OS (which is a custom class, and not a simple
python object) and furthermore all the processing of OS validity across
nodes is left to the clients of this opcode.
It would be more logical to have this opcode be similar to list
instances/nodes, in the sense that:
- it should return a table of results
- the fields in the table should be selectable
This patch does the above. The possible fields are:
- name (os name)
- valid (bool representing validity across all nodes)
- node_status, which is a complicated structure required for ‘gnt-os
diagnose’
With this patch, gnt-os list becomes a very simple iteration over the
list of results, filtering out non-valid ones. gnt-os diagnose is still
complicated, but no more than before.
The burnin tool has also been modified to work with the modified
results, and is simpler because of this (it only needs to know if an OS
is valid or not, not the per-node details).
Reviewed-by: imsnah,ultrotter
Iustin Pop [Thu, 24 Apr 2008 14:44:01 +0000 (14:44 +0000)]
Style fixes for the 1.2 branch
This patch fixes:
- line too long
- missing spaces around "=" or after commas
- wrong position for a docstring
- wrong indentation
Reviewed-by: imsnah
Iustin Pop [Thu, 24 Apr 2008 11:10:14 +0000 (11:10 +0000)]
Implement replace secondary via the iallocator
This patch implements secondary replace via the iallocator. The new
opcode parameter 'iallocator' behaves like this: if passed, it will
always compute and assign a new secondary, behaving in effect as if the
secondary node has been passed. It conflicts with actually giving the
secondary too.
[Note: not tested with remote_raid1, but the code should behave the
same, we only touch CheckPrereq and we assign a node.]
The patch also adds burnin support for the replace secondary operation;
with this in place, burnin can fully work with auto-assigned nodes.
Reviewed-by: ultrotter
Iustin Pop [Thu, 24 Apr 2008 07:34:21 +0000 (07:34 +0000)]
Implement memory size option for burnin
This simple patch adds memory size for the burnin instances, which helps
testing allocator algorithm response based on the available node memory
and instance memory size values.
Reviewed-by: ultrotter
Iustin Pop [Thu, 24 Apr 2008 07:26:30 +0000 (07:26 +0000)]
Fix generalized relocate mode of IAllocator
The patch which generalized the IAllocator was half-true: it actually
put the selection of the node inside the IAllocator, so callers were not
able to specify replace primary node.
This patch does:
- split the arguments to the constructor in three sets: mode and name
are always passed, and then we differentiate between allocation
parameters and relocation ones
- add a new relocate_from option to the IAllocator constructor which
is a list of nodes we want to move the instance off
- rename the 'nodes' argument in the request object to 'relocate_from'
since this is clearer and is not confused with the result field also
called 'nodes'
Reviewed-by: ultrotter
Alexander Schreiber [Wed, 23 Apr 2008 15:26:41 +0000 (15:26 +0000)]
patch 1/4 extended HVM features for 1.2
This patch extends the config objects with the slots to handle
more HVM configuration items.
Reviewed-by: iustinp
Guido Trotter [Wed, 23 Apr 2008 14:48:11 +0000 (14:48 +0000)]
burnin: improve instance create message
When the allocator or a non-mirrored template are used the message shown by
burnin at instance creation time was wrong. Fixing it.
Reviewed-by: iustinp
Guido Trotter [Wed, 23 Apr 2008 14:47:59 +0000 (14:47 +0000)]
burnin: change the default disk type to drbd
We generally discourage people from using remote_raid1, so it makes sense to
use drbd as the default disk template for burning in 1.2.
Reviewed-by: iustinp
Guido Trotter [Wed, 23 Apr 2008 14:47:46 +0000 (14:47 +0000)]
burnin: remove created exports
Make burnin remove exports after importing the instance back.
Reviewed-by: iustinp
Guido Trotter [Wed, 23 Apr 2008 13:55:37 +0000 (13:55 +0000)]
Add gnt-backup remove functionality
This patch also fixes the LUExportInstance Prereq docstring.
Reviewed-by: iustinp
Iustin Pop [Wed, 23 Apr 2008 12:05:01 +0000 (12:05 +0000)]
Generalize the replace_secondary mode in iallocator
Currently the replace_secondary mode is too restrictive. This patch
changes this to a general 'relocate' mode where the node(s) to be
changed are specified via a new key in the request dict ('nodes') so
that we can change any of the instance's nodes.
Note that for the relocate mode, len(nodes) == required_nodes, so the
required nodes field is redundant, but it is provided for consistency
with the allocate mode.
Reviewed-by: ultrotter
Iustin Pop [Wed, 23 Apr 2008 11:38:40 +0000 (11:38 +0000)]
Correctly filter out Domain-0 from domain list if requested.
Author: schreiberal
Reviewed-by: ultrotter
Iustin Pop [Wed, 23 Apr 2008 11:02:55 +0000 (11:02 +0000)]
Implement replace_secondary in the dumb allocator
This patch allows the dumb allocator to perform the replace secondary
request type. This is done simply by not allowing the current instances
nodes as a valid selection, and using the existing instance data instead
of the request (which doesn't have the instance info when doing the
replace_secondary).
Reviewed-by: ultrotter
Iustin Pop [Wed, 23 Apr 2008 11:02:44 +0000 (11:02 +0000)]
Send required_nodes field to the iallocator scripts
This patch adds the 'required_nodes' field in the request dict for the
iallocator.
This means that the handmade-checks in the create instance can be
simplified, and that the dumb allocator can be made simple. Therefore
the patch also modifies it.
The patch also sends the disk_space_total to the script in realocate
mode and a small fix for showing errors (include stderr too).
Reviewed-by: ultrotter
Iustin Pop [Wed, 23 Apr 2008 10:58:53 +0000 (10:58 +0000)]
Allow burnin to use an iallocator in instance creation
This patch adds iallocator support to burnin, currently only in instance
creation. This means that, depending on the external algorithm, not all
nodes might get instances.
The patch also restricts node selection and iallocator options together.
Reviewed-by: ultrotter
Iustin Pop [Wed, 23 Apr 2008 10:57:08 +0000 (10:57 +0000)]
Move all iallocator functions into a class
This patch moves all the iallocator function into a separate class that
is then somewhat easier to use. It doesn't bring any new functionality.
The patch also changes the way the iallocator is called - the
OpTestAllocator opcode is no longer needed, and all its parameters
should be passed directly to the IAllocator constructor.
Reviewed-by: ultrotter
Iustin Pop [Mon, 21 Apr 2008 13:20:53 +0000 (13:20 +0000)]
Only change instance status if not already so
This patch makes the _SetInstanceStatus only change the status of the
instance (in the config file) if it's not already in the desired state.
This skips the increase of the config serial no without actual data
changes.
Reviewed-by: ultrotter
Iustin Pop [Mon, 21 Apr 2008 13:20:30 +0000 (13:20 +0000)]
Reuse common code between MarkInstance{Up,Down}
This patch creates a new method ConfigWriter._SetInstanceStatus that
consists of the common code between MarkInstanceUp and MarkInstanceDown.
These two methods become wrappers over the _SetInstanceStatus.
Reviewed-by: ultrotter
Iustin Pop [Mon, 21 Apr 2008 13:01:54 +0000 (13:01 +0000)]
Abstract the json functions into a separate module
This simple patch adds a new module that holds the simplejson functions
for serialization/deserialization. This reduces the amount of redundant
code.
The patch also adds some normalizations to the json output:
- the output text will always have an EOL as last char
- extra spaces before EOL are removed
Reviewed-by: ultrotter
Oleksiy Mishchenko [Mon, 21 Apr 2008 10:20:56 +0000 (10:20 +0000)]
Move RAPI constants to ganeti.constants
Reviewed-by: iustinp
Oleksiy Mishchenko [Thu, 17 Apr 2008 08:08:24 +0000 (08:08 +0000)]
Switch RAPI to default ganeti logging and Daemonize it with ganeti.utils
Reviewed-by: insmah
Iustin Pop [Wed, 16 Apr 2008 13:17:30 +0000 (13:17 +0000)]
IAllocator part 3: LUCreateInstance changes
This (final) patch allows the instance's nodes to be selected
automatically based on the passed allocator algorithm.
The patch changes the pnode opcode parameter from required to optional,
now either the pnode or the iallocator must be passed.
A possible improvement could be to organize all the _IAllocator
functions into a separate class, but that can come later and the current
version is functionally ok.
Reviewed-by: ultrotter
Iustin Pop [Wed, 16 Apr 2008 13:17:01 +0000 (13:17 +0000)]
Reorder checks in instance create
This patch reorders the checks in the instance create prereq so that all
checks and normalisations that are not node-dependent are done before
the node dependent checks.
This is done so that, after the instance-related opcode parameters are
checked and fixed, we can run the allocator and compute the primary (and
any secondary) nodes, and only then proceed with node-related checks.
Reviewed-by: ultrotter
Iustin Pop [Wed, 16 Apr 2008 13:16:40 +0000 (13:16 +0000)]
Implement 'out' direction on allocator tests
This patch adds the paths for searching for instance allocators and
makes the LUTestAllocator code run the allocator and return the results
if the direction specified is 'out'. 'out' means that the opcode will
return the result of the allocator run, instead of the allocator input
file ('in').
The patch unifies all names to refer to 'iallocator' instead of plain
allocator.
The patch also adds an example allocator that can be used for testing
this new functionality.
Reviewed-by: ultrotter
Guido Trotter [Tue, 15 Apr 2008 16:11:35 +0000 (16:11 +0000)]
Bugfix: wrong identifier in CheckPrereq message
Reviewed-by: iustinp
Iustin Pop [Tue, 15 Apr 2008 12:30:09 +0000 (12:30 +0000)]
Move the disk size computation to its own function
This is currently hard-coded for the two drive case and will need to be
reworked for multi-disk support.
The patch is needed to support passing the total required size to the
iallocator interface.
Reviewed-by: ultrotter
Iustin Pop [Mon, 14 Apr 2008 11:54:43 +0000 (11:54 +0000)]
Fix a typo in rapi.RESTHTTPServer
Reviewed-by: amishchenko
Oleksiy Mishchenko [Fri, 11 Apr 2008 21:26:02 +0000 (21:26 +0000)]
Fix pylint errors for RAPI
Reviewed-by: imsnah
Oleksiy Mishchenko [Fri, 11 Apr 2008 16:18:06 +0000 (16:18 +0000)]
Fix pylint errors for RAPI
Iustin Pop [Fri, 11 Apr 2008 14:22:11 +0000 (14:22 +0000)]
Install the rapi files at make install time
Reviewed-by: imsnah
Oleksiy Mishchenko [Fri, 11 Apr 2008 13:40:03 +0000 (13:40 +0000)]
Import first version of Ganeti Remote API
Reviewed-by: iustinp
Guido Trotter [Thu, 10 Apr 2008 16:48:26 +0000 (16:48 +0000)]
Verify: make skipping checks possible
Add a general way to skip some checks at cluster-verify time and make the N+1
memory redundancy check optional.
Reviewed-by: iustinp
Guido Trotter [Thu, 10 Apr 2008 16:48:06 +0000 (16:48 +0000)]
Verify: add N+1 Memory redundancy verification
For every node we check that we can host all the instances it's currently
secondary for belonging to the same primary. This ensures that if a node fails
all its instances can fit on their secondary node. The code only works when
failover is forced to go to the secondary node, and cannot go to an arbitrary
node in the cluster, which is the case in Ganeti 1.2.
Reviewed-by: iustinp
Iustin Pop [Thu, 10 Apr 2008 14:59:54 +0000 (14:59 +0000)]
Allow utils.Daemonize() to not close some fds
This patch implements an optional parameter to utils.Daemonize() which
allows that function to not close some file descriptors.
This will allow the master daemon to open the listening socket before
fork - in order to be able to notify errors and return a meaningful exit
code, and then when we fork we don't close that fd.
Reviewed-by: imsnah
Iustin Pop [Thu, 10 Apr 2008 14:58:46 +0000 (14:58 +0000)]
Move the daemonize function to utils.py
Currently, in ganeti-noded we have the createDaemon function. Since
we'll need the same in other daemons, we move this function to utils.py
With the move, a few changes were also done:
- change the name to Daemonize()
- add a parameter, logfile, as different daemons will want to log to
different files
- remove the try.. except.. around the fork calls, since they were
only re-raising the OS exception with less data; unless we want to
actually handle fork error (not just re-raising), these try blocks
are not useful
- change the return style at the end of the function
Reviewed-by: imsnah
Iustin Pop [Thu, 10 Apr 2008 13:36:43 +0000 (13:36 +0000)]
Move the OS search code into an abstract function
Based on the previous OS search code changes, we can now move the OS
search code into a generic look-for-file function in utils.py. This
means that the allocator code can use the same function.
Reviewed-by: ultrotter
Iustin Pop [Thu, 10 Apr 2008 13:36:21 +0000 (13:36 +0000)]
Change backend._OSSearch return values
Currently, the function backend._OSSearch() returns the (first) base dir
in which this OS can be found. Thereafter the full actual path to the OS
dir is built in the backend.OSFromDisk() function.
This patch changes this so that _OSSearch() always returns the full path
to the OS directory, and OSFromDisk uses that as returned (it will only
build it if it gets a base dir in the first place).
This patch is needed before we can abstract the _OSSearch into a generic
'look for file object' functionality that can be used for allocator
plugins search too.
Reviewed-by: ultrotter
Iustin Pop [Thu, 10 Apr 2008 12:58:00 +0000 (12:58 +0000)]
Fix example scripts build dependencies
Currently, the example scripts (the init.d and the cron script) do not
depend on the Makefile, so if configure is rerun with different
parameters these scripts are not rebuild.
The patch adds Makefile as a dependency so changes to installation paths
or other parameters trigger the rebuild.
Reviewed-by: imsnah
Guido Trotter [Thu, 10 Apr 2008 12:33:49 +0000 (12:33 +0000)]
Verify: save instance config
Save the instance config after we queried it in an instance_cfg dict. This can
be used later by any function that wants it, without reloading it from the
configuration module. It will be used for N+1 memory resilience checking.
Reviewed-by: iustinp
Guido Trotter [Thu, 10 Apr 2008 12:33:33 +0000 (12:33 +0000)]
Verify: add more instance information to node_info
The sisnt-by-pnode field contains all secondary instances of a node, grouped by
their primary node. This information allows us to see quickly if when a node
dies some of its instances cannot be started on their secondary node.
Reviewed-by: iustinp
Guido Trotter [Thu, 10 Apr 2008 12:33:18 +0000 (12:33 +0000)]
Verify: add instance information to node_info
With this patch node_info is changed to store information about which primary
and secondary instances are configured on a node. This information is useful to
check memory and disk allocation. A list of non-redundant instances is also
collected at this stage.
Reviewed-by: iustinp
Guido Trotter [Thu, 10 Apr 2008 12:33:05 +0000 (12:33 +0000)]
Verify: Add and populate node_info dict
During information gathering we collect information from call_node_info, and
then when we cycle trough the nodes add it into a node_info dict containing a
node's free memory and disk. This will be useful later to verify that the
cluster is N+1 redundant. The disk space is saved as well because it can be
useful for checks about disk space redundancy.
Reviewed-by: iustinp
Guido Trotter [Thu, 10 Apr 2008 10:07:58 +0000 (10:07 +0000)]
Verify: remove useless check in _VerifyInstance
The list of instances passed to _VerifyInstance is the one coming from
self.cfg.GetInstanceList(). So there's no point, inside that function, in
checking whether the current instance is a member of that list. Moreover
orphaned instance verification is already done in a separate step.
Reviewed-by: imsnah
Guido Trotter [Thu, 10 Apr 2008 10:07:44 +0000 (10:07 +0000)]
Verify: instance verification cleanup
The instance configuration is grabbed both in the _VerifyInstance function and
in the loop that calls it. Clean this up by passing the configuration as a
parameter.
Reviewed-by: imsnah
Guido Trotter [Thu, 10 Apr 2008 10:07:25 +0000 (10:07 +0000)]
Verify: fix crash when a node is down
Currently if ganeti-noded doesn't respond on a node gnt-cluster verify will die
when verifying primary instances for that node. Fix this by just emitting an
error message if no information about running instances is returned from the
node.
Reviewed-by: iustinp
Guido Trotter [Thu, 10 Apr 2008 10:06:57 +0000 (10:06 +0000)]
Verify: fix ERROR message indentation
All ERROR messages in cluster verify are indented by four spaces, this one is
indented by two. Fixing this skew.
Reviewed-by: imsnah, iustinp
Guido Trotter [Thu, 10 Apr 2008 10:06:40 +0000 (10:06 +0000)]
Fix spelling mistake in constants.py
Of course instance creation don't have any modem, and the comment was just
talking about modes. Sorry to everybody expecting whistles.
Reviewed-by: imsnah
Iustin Pop [Wed, 9 Apr 2008 13:01:34 +0000 (13:01 +0000)]
Allocator framework, 1st part: allocator input generation
In preparation for the introduction of automatic instance allocator,
this patch adds an allocator simulation opcode, that based on the input
parameters, will return either the input message to the allocator
(implemented) or the result of the allocator run (not yet implemented).
This allows algorithm tests against simulated allocations and the
current cluster state.
The patch adds the following:
- a function that generates the generic cluster information for the
allocator
- a function that generates the 'new instance' information
- a function that generates the 'replace_secondary' information
These three functions will be used by the allocator framework later to
generate the actual information for the external algorithms. Currently
we just return the json-serialized text.
Reviewed-by: imsnah
Iustin Pop [Wed, 9 Apr 2008 13:01:14 +0000 (13:01 +0000)]
Add a gnt-debug tool
This patch adds a script which submits a job consisting of the
OpTestDelay opcode. This can be helpful for debugging and can be
extended to execute other 'debug'-like tasks.
Reviewed-by: imsnah
Guido Trotter [Wed, 2 Apr 2008 18:31:37 +0000 (18:31 +0000)]
Improve disk consistency error message again
This new version includes all the possible failure options.
Reviewed-by: iustinp
Guido Trotter [Wed, 2 Apr 2008 18:01:54 +0000 (18:01 +0000)]
Fix misleading error message when checking disks
_CheckDiskConsistency outputs "Can't get any data from node NODE" when no drbd
is found on the target node. This causes a misleading error message to be
output for example on failover (when the primary node is down, or the instance
is not running), stating that no data could be got from the secondary node,
which scares the user and misleads him. Changing this to "Disk degraded or not
found on node %s" still reports that something is missing, but on the other
hand doesn't make the user think the node is down, or has no data at all...
Reviewed-by: imsnah
Guido Trotter [Wed, 2 Apr 2008 18:00:27 +0000 (18:00 +0000)]
Handle better failing over non-running instances
Right now if you try to failover an instance which is not marked as up the
operation will fail unless you pass the --ignore-consistency flag because the
disks won't be considered to be consistent. Allow them to be if we know the
instance shouldn't be up.
Reviewed-by: imsnah
Guido Trotter [Wed, 2 Apr 2008 18:00:13 +0000 (18:00 +0000)]
Improve export and fix export-on-norun bug
Currently gnt-backup export chains the ShutdownInstance and StartupInstance
opcodes to itself. This works but (a) it's suboptimal, because there's no need
to deactivate the instance's disks as we are about to restart it anyway, and
(b) doesn't take care of instances which are already down (and should be). This
patch takes care of this by just calling the shutdown rpc function instead of
the whole opcode, and just starting up the instance if it's configured as up in
the first place.
Reviewed-by: imsnah
Guido Trotter [Wed, 2 Apr 2008 17:00:33 +0000 (17:00 +0000)]
failover: only start instance if we should
gnt-instance failover on an instance marked as down will mistakenly bring it
up. The watcher will then shut it down again, but it's a lot better (and safer)
not to start it at all.
Reviewed-by: imsnah
Iustin Pop [Wed, 2 Apr 2008 09:08:27 +0000 (09:08 +0000)]
Update the lock autocleanup log message
Reviewed-by: ultrotter
Iustin Pop [Tue, 1 Apr 2008 16:02:22 +0000 (16:02 +0000)]
Add autocleanup of stale locks
This patch adds autocleanup of stale locks. This can be disabled by
passing --lock-noautoclean to the commands.
The autocleanup mechanism will only try to do five cleanups before
raising an exception, to protect against runaway processes or similar
conditions.
Reviewed-by: schreiberal
Guido Trotter [Tue, 1 Apr 2008 13:08:20 +0000 (13:08 +0000)]
Fix gnt-instance failover help message
The message used to misleadingly say that failover just works with remote_raid1
instances, while of course it works for drbd as well. Thanks to Jesus Climent
who spotted the bug.
Reviewed-by: imsnah
Iustin Pop [Mon, 31 Mar 2008 14:45:54 +0000 (14:45 +0000)]
Change the 'gnt-cluster command' execution order
This patch makes the command execute last on the master (if the master
is selected). The order for the other nodes is unchanged.
The patch also updates the man page with some explanations and an
example.
Reviewed-by: imsnah