ganeti-local
16 years agoReplace logging functions with calls to logging module
Michael Hanselmann [Fri, 13 Jun 2008 12:46:43 +0000 (12:46 +0000)]
Replace logging functions with calls to logging module

- Shorter code
- Reorder arguments to logger.SetupLogging calls to make more sense

Reviewed-by: iustinp

16 years agoFail job on ganeti exceptions
Guido Trotter [Fri, 13 Jun 2008 10:14:31 +0000 (10:14 +0000)]
Fail job on ganeti exceptions

When a Job raises a ganeti exception a message is printed but nothing is
reported in the job itself. It's better to update the job status, thus
notifying the client, possibly polling for the job result, of what went
wrong.

Reviewed-by: iustinp

16 years agoFix a typo in jqueue.py
Guido Trotter [Fri, 13 Jun 2008 10:14:09 +0000 (10:14 +0000)]
Fix a typo in jqueue.py

s/result/op_result/ (this code was never used, so this wasn't caught)

Reviewed-by: iustinp

16 years agoDon't use specific versions in autogen.sh
Michael Hanselmann [Thu, 12 Jun 2008 13:47:32 +0000 (13:47 +0000)]
Don't use specific versions in autogen.sh

Not all distributions have the same version of aclocal, autoconf
or automake. Users can pass the name of a specific executables
via environment variables. Change configure.ac to require at
least autoconf 1.9.

Reviewed-by: iustinp

16 years agoMove InitCluster opcode into a single function
Michael Hanselmann [Thu, 12 Jun 2008 13:05:27 +0000 (13:05 +0000)]
Move InitCluster opcode into a single function

This allows us to initialize a new cluster. The code certainly contains
bugs and hooks aren't implemented yet.

Reviewed-by: iustinp

16 years agoMove cmdlib._HasValidVG to utils.CheckVolumeGroupSize
Michael Hanselmann [Thu, 12 Jun 2008 13:04:57 +0000 (13:04 +0000)]
Move cmdlib._HasValidVG to utils.CheckVolumeGroupSize

This is required for splitting the cluster initialization code.

Reviewed-by: iustinp

16 years agoMove {Set,Remove}EtcHostsEntry wrappers to utils.py
Michael Hanselmann [Thu, 12 Jun 2008 13:04:23 +0000 (13:04 +0000)]
Move {Set,Remove}EtcHostsEntry wrappers to utils.py

This is required for the split of the cluster initialization code.

Reviewed-by: iustinp, ultrotter

16 years agoRemove REQ_CLUSTER from opcode handling code
Michael Hanselmann [Thu, 12 Jun 2008 10:18:39 +0000 (10:18 +0000)]
Remove REQ_CLUSTER from opcode handling code

It's not needed anymore now that all opcodes require a cluster. Cluster
initialization was the only exception.

Reviewed-by: iustinp

16 years agoRemove unreachable code from cli.SubmitOpCode
Michael Hanselmann [Thu, 12 Jun 2008 10:06:35 +0000 (10:06 +0000)]
Remove unreachable code from cli.SubmitOpCode

Reviewed-by: iustinp

16 years agoRename master socket to ganeti-master.sock
Michael Hanselmann [Thu, 12 Jun 2008 10:06:18 +0000 (10:06 +0000)]
Rename master socket to ganeti-master.sock

…/run/master.sock is not specific enough.

Reviewed-by: iustinp

16 years agoRemove SimpleStore cache
Guido Trotter [Wed, 11 Jun 2008 10:12:25 +0000 (10:12 +0000)]
Remove SimpleStore cache

SimpleStore is instantiated anew most of the times it's used, so having
a cache inside it serves no purpose. Removing it.

Reviewed-by: iustinp

16 years agoForward-port: Fix two problems in QA scripts
Michael Hanselmann [Fri, 6 Jun 2008 09:32:24 +0000 (09:32 +0000)]
Forward-port: Fix two problems in QA scripts

- Failover back to original node in instance failure test
- Exclude secondary node from list of potential nodes in
  replace-disks test

Reviewed-by: iustinp

16 years agoForward-port: Add QA tests for “gnt-instance reboot”
Michael Hanselmann [Fri, 6 Jun 2008 09:31:54 +0000 (09:31 +0000)]
Forward-port: Add QA tests for “gnt-instance reboot”

Reviewed-by: ultrotter

16 years agoForward-port: Add QA test for “gnt-instance replace-disks”
Michael Hanselmann [Fri, 6 Jun 2008 09:31:07 +0000 (09:31 +0000)]
Forward-port: Add QA test for “gnt-instance replace-disks”

Reviewed-by: iustinp

16 years agoForward-port: Update gnt-instance and gnt-backup manpages
Michael Hanselmann [Fri, 6 Jun 2008 09:30:33 +0000 (09:30 +0000)]
Forward-port: Update gnt-instance and gnt-backup manpages

- Add --iallocator options
- Small text fixes

Reviewed-by: ultrotter

16 years agoForward-port: Fix wrong filename in ganeti-watcher manpage
Michael Hanselmann [Fri, 6 Jun 2008 09:30:01 +0000 (09:30 +0000)]
Forward-port: Fix wrong filename in ganeti-watcher manpage

Reviewed-by: iustinp

16 years agoForward-port: Small codestyle fixes for dumb-allocator
Michael Hanselmann [Fri, 6 Jun 2008 09:28:56 +0000 (09:28 +0000)]
Forward-port: Small codestyle fixes for dumb-allocator

Reviewed-by: iustinp

16 years agoForward-port: Remove output file if docbook failed
Michael Hanselmann [Fri, 6 Jun 2008 09:28:21 +0000 (09:28 +0000)]
Forward-port: Remove output file if docbook failed

Reviewed-by: ultrotter

16 years agoForward-port: Alias Dump/Load functions in ganeti.serializer to DumpJson/LoadJson
Michael Hanselmann [Fri, 6 Jun 2008 09:27:49 +0000 (09:27 +0000)]
Forward-port: Alias Dump/Load functions in ganeti.serializer to DumpJson/LoadJson

The remote API will use JSON for the foreseable future, so it's better
to put the serialization format in the function name. We can still
use another serialization format for Ganeti's core.

Reviewed-by: amishchenko, schreiberal

16 years agoAdd line-breaks to gnt-instance manpage
Michael Hanselmann [Fri, 6 Jun 2008 09:19:59 +0000 (09:19 +0000)]
Add line-breaks to gnt-instance manpage

Reviewed-by: ultrotter

16 years agoAdd check for node memory in instance creation
Iustin Pop [Sat, 31 May 2008 23:52:35 +0000 (23:52 +0000)]
Add check for node memory in instance creation

Currently the check for enough memory is done only on instance start
command and failover command. But we also start an instance in instance
create, therefore we need to check this instead of failing to start in
the hypervisor phase.

The patch adds a check for node memory in the case the creation command
specifies that the instance should be started. It is allowed for the
memory to be less than needed if the instance will not be started, in
order to allow migration and other such cases.

Reviewed-by: imsnah

16 years agoShow cluster hypervisor for gnt-cluster info
Iustin Pop [Sat, 31 May 2008 23:51:07 +0000 (23:51 +0000)]
Show cluster hypervisor for gnt-cluster info

Author: schreiberal
Reviewed-by: iustinp

16 years agoForward-port: Another for gnt-instance modify & HVM parameters
Iustin Pop [Sat, 31 May 2008 23:47:55 +0000 (23:47 +0000)]
Forward-port: Another for gnt-instance modify & HVM parameters

Another tiny fix. Anybody got a nice brown paper bag I can wear?

Author: schreiberal
Reviewed-by: iustinp

16 years agoForward-port: make gnt-modify work with new HVM parameters
Iustin Pop [Sat, 31 May 2008 23:45:51 +0000 (23:45 +0000)]
Forward-port: 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

Author: schreiberal
Reviewed-by: iustinp

16 years agoForward-port: show only parameters relevant to the instance
Iustin Pop [Sat, 31 May 2008 23:43:11 +0000 (23:43 +0000)]
Forward-port: 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.

Author: schreiberal
Reviewed-by: iustinp

16 years agoForward-port: patch 4/4 extended HVM features for 1.2
Iustin Pop [Sat, 31 May 2008 23:39:23 +0000 (23:39 +0000)]
Forward-port: patch 4/4 extended HVM features for 1.2

This patch documents the extended HVM features.

Author: schreiberal
Reviewed-by: imsnah

16 years agoForward-port: patch 3/4 extended HVM features for 1.2
Iustin Pop [Sat, 31 May 2008 23:37:52 +0000 (23:37 +0000)]
Forward-port: patch 3/4 extended HVM features for 1.2

This patch adds hypervisor support for the extended HVM features.

Author: schreiberal
Reviewed-by: iustinp

16 years agoForward-port: patch 2/4 extended HVM features for 1.2
Iustin Pop [Sat, 31 May 2008 23:14:35 +0000 (23:14 +0000)]
Forward-port: 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.

Author: schreiberal
Reviewed-by: iustinp

16 years agoComplete removal of md/drbd 0.7 code
Iustin Pop [Fri, 30 May 2008 10:55:05 +0000 (10:55 +0000)]
Complete removal of md/drbd 0.7 code

This patch removes the last of the md and drbd 0.7 code. Cluster which
have the old device types will be broken if they have this applied.

Reviewed-by: imsnah

16 years agoLURemoveInstance: fix op.ignore_failures usage
Iustin Pop [Fri, 30 May 2008 10:52:21 +0000 (10:52 +0000)]
LURemoveInstance: fix op.ignore_failures usage

Currently: the LURemoveInstance.Exec() method uses the ignore_failures
attribute of the OpRemoveInstance opcode, but it doesn't check for its
existence. The patch adds this attribute to _OP_REQP and to all the
places where this opcode was created.

This attributes is always passed by gnt-instance, but burnin didn't pass
it so it can fail if it enters the 'fail to remove disks' branch of the
method (which is why it was not triggered until now).

Reviewed-by: ultrotter, imsnah

16 years agoDocumentation: cleanup of local/remote_raid1
Iustin Pop [Thu, 29 May 2008 09:59:45 +0000 (09:59 +0000)]
Documentation: cleanup of local/remote_raid1

Since we have removed support for local and remote raid1, update the man
pages and guides to reflect the new situation.

Reviewed-by: imsnah

16 years agoDistribute dumb-allocator in examples
Guido Trotter [Sat, 24 May 2008 08:59:39 +0000 (08:59 +0000)]
Distribute dumb-allocator in examples

When creating the ganeti tarball the dumb allocator was left out.
Shipping it alongside the other examples.

Reviewed-by: iustinp

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

Reviewed-by: ultrotter

16 years agodocument cluster verify --no-nsplus1-mem option
Guido Trotter [Thu, 15 May 2008 14:22:56 +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 agoFix drbd show parser to handle valueless keywords
Guido Trotter [Thu, 15 May 2008 09:00:10 +0000 (09:00 +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 09:00:01 +0000 (09:00 +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 agoSmall style fixes
Iustin Pop [Tue, 13 May 2008 14:42:18 +0000 (14:42 +0000)]
Small style fixes

[Trunk version]

Reviwed-by: imsnah

16 years agoImplement node daemon conectivity tests
Iustin Pop [Tue, 13 May 2008 14:33:12 +0000 (14:33 +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 agoForward-port changes made to readd in 1.2
Michael Hanselmann [Tue, 13 May 2008 14:26:57 +0000 (14:26 +0000)]
Forward-port changes made to readd in 1.2

qa_node.py: Fix typo in message
cmdlib.py: Don't add readded node to node list
ganeti-qa.py: Make sure readd isn't done for master node

Reviewed-by: iustinp

16 years agoCLI: retry: remove command opts/args in "gnt-X"
Iustin Pop [Tue, 13 May 2008 13:41:41 +0000 (13:41 +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:04:17 +0000 (13:04 +0000)]
Revert "CLI: remove command opts/args in "gnt-X""

This reverts commit 976.

Reviewed-by: ultrotter

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

[Forward-port of the 1.2 branch patch]

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 agoWatcher: do not activate disks for started instances
Iustin Pop [Tue, 13 May 2008 09:48:15 +0000 (09:48 +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:48:07 +0000 (09:48 +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:32:58 +0000 (07:32 +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:14:28 +0000 (09:14 +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:25:57 +0000 (08:25 +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 agoRemove utils.CheckDaemonAlive and use “xm info” instead
Michael Hanselmann [Fri, 9 May 2008 10:12:08 +0000 (10:12 +0000)]
Remove utils.CheckDaemonAlive and use “xm info” instead

There are a couple of reasons for doing so:
- /proc is not OS independent, it's only supported by Linux (there are
  emulations on other systems, but those might differ from the way
  Linux represents data).
- Checking a daemon's state doesn't necessarily mean it's usable.
  Connecting to the socket using “xm info” is much safer.
- Reduce code size.

Reviewed-by: iustinp

16 years agoImprove DRBD8.Open's docstring a bit more
Guido Trotter [Thu, 8 May 2008 19:50:14 +0000 (19:50 +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 19:50:04 +0000 (19:50 +0000)]
Fix comment typo in bdev.py

Reviewed-by: iustinp

16 years agoFix DRBD8 diskless assembling
Iustin Pop [Thu, 8 May 2008 08:21:20 +0000 (08:21 +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 agoAdd unittest for constants
Michael Hanselmann [Wed, 7 May 2008 11:12:50 +0000 (11:12 +0000)]
Add unittest for constants

Reviewed-by: iustinp

16 years agoUse new ssconf function to check configuration version
Michael Hanselmann [Wed, 7 May 2008 11:12:37 +0000 (11:12 +0000)]
Use new ssconf function to check configuration version

Upgrades will be handled in future patches.

Reviewed-by: iustinp

16 years agoUse dict instead of if/elif map for hypervisor classes
Michael Hanselmann [Tue, 6 May 2008 10:20:49 +0000 (10:20 +0000)]
Use dict instead of if/elif map for hypervisor classes

Reviewed-by: iustinp

16 years agoRename hypervisor code to lowercase filenames
Michael Hanselmann [Tue, 6 May 2008 10:20:27 +0000 (10:20 +0000)]
Rename hypervisor code to lowercase filenames

Reviewed-by: iustinp

16 years agoGenerate devel/upload during build time from template
Michael Hanselmann [Mon, 5 May 2008 15:27:53 +0000 (15:27 +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: ultrotter

16 years agoExport the number of cpus to iallocator scripts
Iustin Pop [Mon, 5 May 2008 10:03:39 +0000 (10:03 +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 10:02:55 +0000 (10:02 +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 10:02:28 +0000 (10:02 +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 agoAdd node cpu count to gnt-node list
Iustin Pop [Mon, 5 May 2008 10:01:39 +0000 (10:01 +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 agoWrap exception in _DistributeConfig code
Guido Trotter [Mon, 5 May 2008 08:49:01 +0000 (08:49 +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 08:15:14 +0000 (08:15 +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 agossconf: update the SetKey docstring
Guido Trotter [Fri, 2 May 2008 09:36:21 +0000 (09:36 +0000)]
ssconf: update the SetKey docstring

SetKey is used, other than for adding new nodes, in another few cases. Update
the docstring to reflect this, so we don't mislead people reading it.

Reviewed-by: iustinp

16 years agoDelete hypervisor.py
Guido Trotter [Fri, 2 May 2008 09:36:07 +0000 (09:36 +0000)]
Delete hypervisor.py

This completes the changes in r898 by actually getting rid of the old unused
hypervisor.py code which was left in the code tree.

Reviewed-by: iustinp

16 years agoganeti-masterd: Some docstrings work
Guido Trotter [Thu, 1 May 2008 11:15:59 +0000 (11:15 +0000)]
ganeti-masterd: Some docstrings work

- Add a docstring to IOServer's constructor
- Add argument description to PoolWorker's and JobRunner's ones

Reviewed-by: iustinp

16 years agolocking: remove obsolete comment
Guido Trotter [Thu, 1 May 2008 11:15:47 +0000 (11:15 +0000)]
locking: remove obsolete comment

Reviewed-by: iustinp

16 years agoRemove deprecated disk templates from doc
Manuel Franceschini [Wed, 30 Apr 2008 12:51:07 +0000 (12:51 +0000)]
Remove deprecated disk templates from doc

Since local_raid1 and remote_raid1 are deprecated they are removed
from the docs. This patch removes some old documentation sections
and bumps the documented version from 1.2 to 1.3.

Reviewed-by: iustinp

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

Reviewed-by: iustinp

16 years agoAdd cluster-verify hooks
Guido Trotter [Wed, 30 Apr 2008 09:29:58 +0000 (09:29 +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:29:49 +0000 (09:29 +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:29:39 +0000 (09:29 +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:29:30 +0000 (09:29 +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:29:21 +0000 (09:29 +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:29:08 +0000 (09:29 +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 agoAdd file-based options to gnt-instance man-page
Manuel Franceschini [Tue, 29 Apr 2008 15:26:05 +0000 (15:26 +0000)]
Add file-based options to gnt-instance man-page

Reviewed-by: iustinp

16 years agoSupport config version in ssconf
Michael Hanselmann [Tue, 29 Apr 2008 14:27:41 +0000 (14:27 +0000)]
Support config version in ssconf

Reviewed-by: iustinp

16 years agoDisable forking in the master daemon
Iustin Pop [Tue, 29 Apr 2008 07:37:10 +0000 (07:37 +0000)]
Disable forking in the master daemon

This patch adds a mechanism to disable utils.RunCmd in selected
programs. This is needed in the master daemon unless we confirm
threading doesn't pose any problems.

This makes cluster init fail, but creating new trunk clusters is anyway
broken at the moment.

Reviewed-by: ultrotter

16 years agoRaise PrereqError when exporting file-based instance
Manuel Franceschini [Mon, 28 Apr 2008 15:24:50 +0000 (15:24 +0000)]
Raise PrereqError when exporting file-based instance

This patch adds a check to LUExportInstance.CheckPrereq to raise an
error when an instance with file disks is exported.

Reviewed-by: ultrotter

16 years agoAdd file backend storage options to ImportInstance
Manuel Franceschini [Mon, 28 Apr 2008 15:24:20 +0000 (15:24 +0000)]
Add file backend storage options to ImportInstance

This patch adds the file storage options to gnt-backup import which
would otherwise fail since the values of file_storage_dir and
file_driver are accessed in LUCreateInstance.

Reviewed-by: ultrotter

16 years agoSplit hypervisor.py into several files
Michael Hanselmann [Mon, 28 Apr 2008 15:05:06 +0000 (15:05 +0000)]
Split hypervisor.py into several files

Before it was a huge file with more than 700 lines. No code changes were
made except for changing imports and class names where needed. In the
future, we could even think about only importing the hypervisors we
actually need. The patch finished QA scripts and distcheck successfully.

Reviewed-by: iustinp

16 years agoMove the 'cmd' lock from cli.py to ganeti-masterd
Iustin Pop [Mon, 28 Apr 2008 13:02:03 +0000 (13:02 +0000)]
Move the 'cmd' lock from cli.py to ganeti-masterd

This patch removes the lock and the lock options from cli.py and moves
them to the master.

Later during development we can remove it completely, but for now it's
good to protect any other tool that uses the lock directly.

Reviewed-by: imsnah,ultrotter

16 years agoConvert cli.SubmitOpCode to use the master
Iustin Pop [Mon, 28 Apr 2008 13:01:49 +0000 (13:01 +0000)]
Convert cli.SubmitOpCode to use the master

This patch converts the cli.py SubmitOpCode method to use the unix
protocol and thus execute the opcodes via the master.

The patch allows a partial burnin to work with the master. Currently the
query opcodes, since they are executed via the SubmitOpCode, are
executed inside a job too, which is suboptimal, but they work fine.

The cmd lock has been removed from the master, but the cli.py still
takes the lock. This is ok for this in-progress patch (since the master
still has only one executor thread). This will be fixed in a future
patch.

Reviewed-by: ultrotter

16 years agoAdd check for major/minor in _FormatBlockDevInfo
Manuel Franceschini [Mon, 28 Apr 2008 12:15:38 +0000 (12:15 +0000)]
Add check for major/minor in _FormatBlockDevInfo

bdev.FileStorage does not have major or minor fields, so gnt-instance
info for file backed instances fails with a TypeError. This patch
adds checks to prevent that and print 'N/A' instead.

Reviewed-by: imsnah

16 years agoMake testSignal unittest not depend on default shell
Manuel Franceschini [Mon, 28 Apr 2008 10:42:04 +0000 (10:42 +0000)]
Make testSignal unittest not depend on default shell

This patch changes the code executed when testing the signal handling
of RunCmd. Since sh does not always point to bash (e.g. on Ubuntu,
where it points to /bin/dash) this test might fail due to the returned
exit code is different so the received signal is not correctly
detected.

Additionally fix the docstring of testSignal.

Reviewed-by: iustinp

16 years agoMove iallocator script execution to ganeti-noded
Iustin Pop [Mon, 28 Apr 2008 09:47:23 +0000 (09:47 +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:47:06 +0000 (09:47 +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 agoExtend utils.WriteFile
Michael Hanselmann [Fri, 25 Apr 2008 13:37:08 +0000 (13:37 +0000)]
Extend utils.WriteFile

Add parameters to not check the path for absoluteness, implement a dry
run mode and automatically create a backup if requested. This will be
used by the cfgupgrade utility.

Reviewed-by: schreiberal

16 years agoIAllocator: some more info exported
Iustin Pop [Fri, 25 Apr 2008 12:07:13 +0000 (12:07 +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:07:05 +0000 (12:07 +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 1/4 extended HVM features for 1.2
Iustin Pop [Fri, 25 Apr 2008 12:03:57 +0000 (12:03 +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.

Author: schreiberal
Reviewed-by: iustinp,imsnah

16 years agoMove target creating symlinks in lib/ into Makefile.libcommon
Michael Hanselmann [Fri, 25 Apr 2008 11:57:08 +0000 (11:57 +0000)]
Move target creating symlinks in lib/ into Makefile.libcommon

Reviewed-by: iustinp

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

Reviewed-by: imsnah

16 years agobackend.FinalizeExport: safely initialize some vars
Manuel Franceschini [Thu, 24 Apr 2008 15:56:43 +0000 (15:56 +0000)]
backend.FinalizeExport: safely initialize some vars

This patch initializes nic_count and disk_count with 0. This prevents
some reference errors if the snap_disks block device list is empty.

Reviewed-by: ultrotter

16 years agoStyle fixes for trunk
Iustin Pop [Thu, 24 Apr 2008 14:39:53 +0000 (14:39 +0000)]
Style fixes for trunk

This small patch fixes:
  - wrong indentation in two places
  - use of 'os' variable that hides global scope os module

Reviewed-by: imsnah

16 years agoImplement replace secondary via the iallocator
Iustin Pop [Thu, 24 Apr 2008 11:13:45 +0000 (11:13 +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:35:04 +0000 (07:35 +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:29:10 +0000 (07:29 +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 agoFix burnin ImportExport CreateInstance opcode
Manuel Franceschini [Wed, 23 Apr 2008 15:11:39 +0000 (15:11 +0000)]
Fix burnin ImportExport CreateInstance opcode

This patch adds the two attributes file_storage_dir and file_driver
to the CreateInstance opcode in the ImportExport method, since
otherwise it will fail with the file storage patches.

Reviewed-by: iustinp

16 years agoburnin: improve instance create message
Guido Trotter [Wed, 23 Apr 2008 14:51:47 +0000 (14:51 +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: remove created exports
Guido Trotter [Wed, 23 Apr 2008 14:51:39 +0000 (14:51 +0000)]
burnin: remove created exports

Make burnin remove exports after importing the instance back.

Reviewed-by: iustinp