ganeti-local
16 years agoRemote API code cleanup
Michael Hanselmann [Wed, 21 May 2008 15:19:44 +0000 (15:19 +0000)]
Remote API code cleanup

- Unify variable names
- Use constants for tag kinds
- Add functions to simplify creating URI lists

Reviewed-by: amishchenko, schreiberal

16 years agoImprove remote API logging
Michael Hanselmann [Wed, 21 May 2008 10:30:58 +0000 (10:30 +0000)]
Improve remote API logging

- Put HTTP request log into its own file
- Factor out logging code
- Add unittests

Reviewed-by: amishchenko

16 years agoSet SO_REUSEADDR on remote API socket
Michael Hanselmann [Wed, 21 May 2008 10:30:41 +0000 (10:30 +0000)]
Set SO_REUSEADDR on remote API socket

Reviewed-by: schreiberal

16 years agoFix Unittest for Ganeti RAPI
Oleksiy Mishchenko [Tue, 20 May 2008 14:14:04 +0000 (14:14 +0000)]
Fix Unittest for Ganeti RAPI

16 years agoFix gnt-instance modify for HVM parameters
Alexander Schreiber [Mon, 19 May 2008 10:23:12 +0000 (10:23 +0000)]
Fix gnt-instance modify for HVM parameters

This patch makes gnt-instance modify work again for the advanced
HVM parameters after it was broken by other changes.

Reviewed-by: imsnah

16 years agodocument cluster verify --no-nsplus1-mem option
Guido Trotter [Thu, 15 May 2008 14:22:23 +0000 (14:22 +0000)]
document cluster verify --no-nsplus1-mem option

Add this recently added option to the gnt-cluster man page before
releasing 1.2.4.

Reviewed-by: imsnah

16 years agoUpdate command line help and manpages with mandatory options
Michael Hanselmann [Thu, 15 May 2008 14:10:14 +0000 (14:10 +0000)]
Update command line help and manpages with mandatory options

Reviewed-by: ultrotter

16 years agoRemove unimplemented /status resource from API
Michael Hanselmann [Thu, 15 May 2008 11:26:33 +0000 (11:26 +0000)]
Remove unimplemented /status resource from API

Reviewed-by: ultrotter

16 years agoFix drbd show parser to handle valueless keywords
Guido Trotter [Thu, 15 May 2008 08:58:47 +0000 (08:58 +0000)]
Fix drbd show parser to handle valueless keywords

It turns out in some cases there can exist keywords without an
associated value exported by drbdsetup show. This patch makes the value
part optional in our parser, so that if it's not present the parsing
result will contain an array with just the keyword in it. This is not a
problem since we check all keyword names before accessing their values,
so we won't mistakenly try to access the value of a valueless keyword.

Reviewed-by: iustinp

16 years agoSplit drbd command creation and execution
Guido Trotter [Thu, 15 May 2008 08:58:31 +0000 (08:58 +0000)]
Split drbd command creation and execution

Make _AssembleDisk more similar to _AssembleNet by splitting the
generation of the drbdsetup command and its execution. While not
changing anything this makes it easier to manipulate the command just in
certain cases, which in the future we'll need to do.

Reviewed-by: iustinp

16 years agoOptimize rapi
Michael Hanselmann [Wed, 14 May 2008 11:52:18 +0000 (11:52 +0000)]
Optimize rapi

A lot of changes:
- Don't use eval() anymore, it's evil
- Don't compile Regex' on every request, but once when resources.py is
  imported
- Use string comparison for URIs if possible
- Cleanup function used to parse requests (getController)
- Don't put class names as strings, but rather use classes directly
- Change unit tests accordingly
- Sort result of R_root._get to make unit tests reliable

Reviewed-by: amishchenko

16 years agoGenerate devel/upload during build time from template
Michael Hanselmann [Tue, 13 May 2008 16:38:41 +0000 (16:38 +0000)]
Generate devel/upload during build time from template

- Use variable with prefix instead of grep and sed
- Always run with /bin/bash

Reviewed-by: iustinp

16 years agoSmall style fixes
Iustin Pop [Tue, 13 May 2008 14:38:13 +0000 (14:38 +0000)]
Small style fixes

Reviwed-by: imsnah

16 years agoImplement node daemon conectivity tests
Iustin Pop [Tue, 13 May 2008 14:32:35 +0000 (14:32 +0000)]
Implement node daemon conectivity tests

This patch adds in gnt-cluster verify checks for inter-node tcp
communication checks on the node daemon port for both the primary and
(if defined) secondary networks.

The output looks like (4-node cluster, one with the secondary interface
down):
* Verifying node node1.example.com
  - ERROR: tcp communication with node 'node3.example.com': failure using the secondary interface(s)
* Verifying node node2.example.com
  - ERROR: tcp communication with node 'node3.example.com': failure using the secondary interface(s)
* Verifying node node3.example.com
  - ERROR: tcp communication with node 'node1.example.com': failure using the secondary interface(s)
  - ERROR: tcp communication with node 'node2.example.com': failure using the secondary interface(s)
  - ERROR: tcp communication with node 'node4.example.com': failure using the secondary interface(s)
* Verifying node node4.example.com
  - ERROR: tcp communication with node 'node3.example.com': failure using the secondary interface(s)

Reviewed-by: imsnah

16 years agoAdd --readd option to “gnt-node add”
Michael Hanselmann [Tue, 13 May 2008 14:25:54 +0000 (14:25 +0000)]
Add --readd option to “gnt-node add”

This allows us to readd a node after it failed and required a
reinstallation or replacement.

Reviewed-by: iustinp

16 years agoCLI: retry: remove command opts/args in "gnt-X"
Iustin Pop [Tue, 13 May 2008 13:28:09 +0000 (13:28 +0000)]
CLI: retry: remove command opts/args in "gnt-X"

This new version of the patch removes only the listing of the usage in
the "gnt-X" list, but keeps the strings in since we'll want to enhance
and use them in "gnt-X $cmd --help".

Reviewed-by: ultrotter

16 years agoRevert "CLI: remove command opts/args in "gnt-X""
Iustin Pop [Tue, 13 May 2008 13:03:14 +0000 (13:03 +0000)]
Revert "CLI: remove command opts/args in "gnt-X""

This reverts commit 974, as it's not a good way to proceed (we still
want the usage to be shown when using gnt-X $cmd --help).

Reviewed-by: ultrotter

16 years agoCLI: remove command opts/args in "gnt-X"
Iustin Pop [Tue, 13 May 2008 12:16:21 +0000 (12:16 +0000)]
CLI: remove command opts/args in "gnt-X"

This patch removes all the parameters and options from the output
"gnt-X" (i.e. the subcommand list for command). This is done in order to
uniformize the output, currently only some parameters are shown and they
are not always consistent (e.g. required versus important parameters).

Reviewed-by: ultrotter

16 years agoPass headers to API resource request handlers
Oleksiy Mishchenko [Tue, 13 May 2008 10:26:30 +0000 (10:26 +0000)]
Pass headers to API resource request handlers

16 years agoWatcher: do not activate disks for started instances
Iustin Pop [Tue, 13 May 2008 09:38:52 +0000 (09:38 +0000)]
Watcher: do not activate disks for started instances

Currently the watcher runs first the instance startup and then the
boot-id method of disk reactivation. However, irrelevant of the fact
that a node has rebooted or not, if we just started an instance, there's
no need for its disks to be activated again, since the start instance
has done that (if it is at all possible).

The patch modifies the watcher to remember all started instances and not
run activate-disks for them.

Reviewed-by: ultrotter

16 years agoWatcher: do not activate disks for admin_down
Iustin Pop [Tue, 13 May 2008 09:38:44 +0000 (09:38 +0000)]
Watcher: do not activate disks for admin_down

Currently the watcher does activate disks (via bootid mechanisms) even
for admin_down instances.  This patch logs and skips over these
instances.

Reviewed-by: ultrotter

16 years agoReduce chance of ssh failures in verify cluster
Iustin Pop [Tue, 13 May 2008 07:31:28 +0000 (07:31 +0000)]
Reduce chance of ssh failures in verify cluster

The cluster verify builds a sorted list of nodes and passes that to all
the nodes (in parallel) for ssh checks. This means that for a cluster
with N nodes, there will be approximately N simultaneous connections to
the first node, then to the second node, etc. This, coupled with the
ssh daemon's “MaxStartups” parameter, can create false alarms about ssh
connectivity.

This patch randomizes the node list in the backend (therefore, each node
should have it's own order of ssh-ing to the other nodes) and the chance
of these alarms should be reduced.

Reviewed-by: ultrotter

16 years agobdev: always log command output if it failed
Iustin Pop [Mon, 12 May 2008 09:07:47 +0000 (09:07 +0000)]
bdev: always log command output if it failed

Currently many error handling code paths in bdev.py log only
result.fail_reason (i.e. exit code or signal that killed the command)
but not its output. This makes debugging very hard.

The patch changes all places where we only log fail_reason to also log
result.output.

Reviewed-by: ultrotter

16 years agoDRBD: Fix another bug in diskless activation
Iustin Pop [Sat, 10 May 2008 08:23:57 +0000 (08:23 +0000)]
DRBD: Fix another bug in diskless activation

DRBD8 requires that we pass ‘--create-device’ to the first command that
wants to activate a new DRBD minor. We do this currently when we run the
“drbdsetup ... disk” command which we run before the network setup.

But if the LVs are missing, we skip the ‘disk’ subcommand and run only
the ‘net’ one, so it might be that the activation fails because the
minor we selected was never created in the first place.

The patch adds the required parameter to the DRBD8._AssembleNet() call.
Since it's a no-op for existing minors, it should not create any
problems (tested and works both with configured and unconfigured
minors).

Reviewed-by: ultrotter

16 years agoImplement list of avilable for RAPI resources
Oleksiy Mishchenko [Fri, 9 May 2008 16:38:27 +0000 (16:38 +0000)]
Implement list of avilable for RAPI resources

Add root resource with unittest for it. The unittest also mapper test as a
legacy.

Reviewed-by: iustinp

16 years agoAdd version 1.2.4 to NEWS file and describe remote API addition
Michael Hanselmann [Fri, 9 May 2008 12:48:22 +0000 (12:48 +0000)]
Add version 1.2.4 to NEWS file and describe remote API addition

Reviewed-by: ultrotter

16 years agoAdd --enable-rapi parameter to configure
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

16 years agoStart and stop remote API with master role
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

16 years agoImprove DRBDev.Open docstring as well
Guido Trotter [Thu, 8 May 2008 19:48:14 +0000 (19:48 +0000)]
Improve DRBDev.Open docstring as well

Reviewed-by: iustinp

16 years agoImprove DRBD8.Open's docstring a bit more
Guido Trotter [Thu, 8 May 2008 19:47:55 +0000 (19:47 +0000)]
Improve DRBD8.Open's docstring a bit more

Reviewed-by: iustinp

16 years agoFix comment typo in bdev.py
Guido Trotter [Thu, 8 May 2008 17:26:17 +0000 (17:26 +0000)]
Fix comment typo in bdev.py

Reviewed-by: iustinp

16 years agoSmall codestyle fixes for ganeti-noded, ganeti-master and init script
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

16 years agoRemove unimplemented rapi resources
Michael Hanselmann [Thu, 8 May 2008 15:57:35 +0000 (15:57 +0000)]
Remove unimplemented rapi resources

Reviewed-by: iustinp, amishchenko

16 years agoCodestyle fixes and docstring updates for rapi
Michael Hanselmann [Thu, 8 May 2008 15:56:33 +0000 (15:56 +0000)]
Codestyle fixes and docstring updates for rapi

Reviewed-by: iustinp

16 years agoFix DRBD8 diskless assembling
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

16 years agoExport the number of cpus to iallocator scripts
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

16 years agoMinor doc/help update
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

16 years agoImprove the gnt-* list field selection
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

16 years agoWrap exception in _DistributeConfig code
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

16 years agoSimplify target generation in DistributeConfig
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

16 years agoShow cluster hypervisor for gnt-cluster info
Alexander Schreiber [Fri, 2 May 2008 17:26:48 +0000 (17:26 +0000)]
Show cluster hypervisor for gnt-cluster info

Reviewed-by: iustinp

16 years agoAnother for gnt-instance modify & HVM parameters
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

16 years agomake gnt-modify work with new HVM parameters
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

16 years agoAdd node cpu count to gnt-node list
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

16 years agoAdd new Makefile.am for lib/rapi/
Michael Hanselmann [Wed, 30 Apr 2008 12:55:15 +0000 (12:55 +0000)]
Add new Makefile.am for lib/rapi/

Reviewed-by: iustinp

16 years agoMove target creating symlinks in lib/ into Makefile.libcommon
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

16 years agoRAPI: Change the daemon to standard calling syntax
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

16 years agohooks.sgml: Add cluster-verify hooks information
Guido Trotter [Wed, 30 Apr 2008 09:24:26 +0000 (09:24 +0000)]
hooks.sgml: Add cluster-verify hooks information

Reviewed-by: iustinp

16 years agoAdd cluster-verify hooks
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

16 years agoAdd a LU Hooks notification function
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

16 years agoHooksMaster: Make RunPhase return the rpc output
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

16 years agoRemove NoHooksLU.BuildHooksEnv
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

16 years agoLogicalUnit.BuildHooksEnv, update docstring
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

16 years agoRemove non-existing arguments from some docstrings
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

16 years agoImplement locking in Ganeti Remote API
Oleksiy Mishchenko [Wed, 30 Apr 2008 09:22:44 +0000 (09:22 +0000)]
Implement locking in Ganeti Remote API

Reviewed-by: iustinp

16 years agoRAPI: Workaround twisted failure by early import rpc
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

16 years agoMove iallocator script execution to ganeti-noded
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

16 years agoFix iallocator instance info
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

16 years ago[PATCH] show only parameters relevant to the instance
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

16 years agopatch 4/4 extended HVM features for 1.2
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

16 years agopatch 3/4 extended HVM features for 1.2
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

16 years agoIAllocator: some more info exported
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

16 years agoIAllocator: simplify node info computation
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

16 years agopatch 2/4 extended HVM features for 1.2
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

16 years agoGeneralize RAPI request handling flow
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

16 years agoAdd iallocator documentation
Iustin Pop [Fri, 25 Apr 2008 09:53:26 +0000 (09:53 +0000)]
Add iallocator documentation

Reviewed-by: imsnah

16 years agoburnin: improve -t help message
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

16 years agoChage the rapi to conform to new OpDiagnoseOS
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

16 years agoBackport: Rework the results of OpDiagnoseOS opcode
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

16 years agoStyle fixes for the 1.2 branch
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

16 years agoImplement replace secondary via the iallocator
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

16 years agoImplement memory size option for burnin
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

16 years agoFix generalized relocate mode of IAllocator
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

16 years agopatch 1/4 extended HVM features for 1.2
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

16 years agoburnin: improve instance create message
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

16 years agoburnin: change the default disk type to drbd
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

16 years agoburnin: remove created exports
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

16 years agoAdd gnt-backup remove functionality
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

16 years agoGeneralize the replace_secondary mode in iallocator
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

16 years agoCorrectly filter out Domain-0 from domain list if requested.
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

16 years agoImplement replace_secondary in the dumb allocator
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

16 years agoSend required_nodes field to the iallocator scripts
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

16 years agoAllow burnin to use an iallocator in instance creation
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

16 years agoMove all iallocator functions into a class
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

16 years agoOnly change instance status if not already so
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

16 years agoReuse common code between MarkInstance{Up,Down}
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

16 years agoAbstract the json functions into a separate module
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

16 years agoMove RAPI constants to ganeti.constants
Oleksiy Mishchenko [Mon, 21 Apr 2008 10:20:56 +0000 (10:20 +0000)]
Move RAPI constants to ganeti.constants
Reviewed-by: iustinp

16 years agoSwitch RAPI to default ganeti logging and Daemonize it with ganeti.utils
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

16 years agoIAllocator part 3: LUCreateInstance changes
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

16 years agoReorder checks in instance create
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

16 years agoImplement 'out' direction on allocator tests
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

16 years agoBugfix: wrong identifier in CheckPrereq message
Guido Trotter [Tue, 15 Apr 2008 16:11:35 +0000 (16:11 +0000)]
Bugfix: wrong identifier in CheckPrereq message

Reviewed-by: iustinp

16 years agoMove the disk size computation to its own function
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

16 years agoFix a typo in rapi.RESTHTTPServer
Iustin Pop [Mon, 14 Apr 2008 11:54:43 +0000 (11:54 +0000)]
Fix a typo in rapi.RESTHTTPServer

Reviewed-by: amishchenko

16 years agoFix pylint errors for RAPI
Oleksiy Mishchenko [Fri, 11 Apr 2008 21:26:02 +0000 (21:26 +0000)]
Fix pylint errors for RAPI
Reviewed-by: imsnah

16 years agoFix pylint errors for RAPI
Oleksiy Mishchenko [Fri, 11 Apr 2008 16:18:06 +0000 (16:18 +0000)]
Fix pylint errors for RAPI

16 years agoInstall the rapi files at make install time
Iustin Pop [Fri, 11 Apr 2008 14:22:11 +0000 (14:22 +0000)]
Install the rapi files at make install time

Reviewed-by: imsnah

16 years agoImport first version of Ganeti Remote API
Oleksiy Mishchenko [Fri, 11 Apr 2008 13:40:03 +0000 (13:40 +0000)]
Import first version of Ganeti Remote API

Reviewed-by: iustinp

16 years agoVerify: make skipping checks possible
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