ganeti-local
15 years agoMerge branch 'master' into next
Guido Trotter [Wed, 20 May 2009 13:13:56 +0000 (14:13 +0100)]
Merge branch 'master' into next

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agowatcher: write the instance status to a file
Iustin Pop [Wed, 20 May 2009 12:29:47 +0000 (14:29 +0200)]
watcher: write the instance status to a file

This patch modifies the watcher to keep on-disk a file with the instance
status; this can be used from outside of ganeti to react to instances
being down (when the watcher cannot restart them).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoRelease 2.0rc5 v2.0.0rc5
Iustin Pop [Tue, 19 May 2009 13:01:17 +0000 (15:01 +0200)]
Release 2.0rc5

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoFix the SafeEncoding behaviour
Iustin Pop [Tue, 19 May 2009 16:36:36 +0000 (18:36 +0200)]
Fix the SafeEncoding behaviour

Currently we have bad behaviour in SafeEncode:
  - binary strings are actually not handled correctly (ahem)
  - the encoding is not stable, due to use of string_escape

For this reason, we replace the use of string_escape with part of the
code of string escape (PyString_Repr in Objects/stringobject.c); we
don't escape backslashes or single quotes, since that is that makes it
nonstable. Furthermore, we only use the encode('ascii', ...) for unicode
inputs.

The patch also adds unittests for the function that test basic
behaviour.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoMove more hypervisor strings into constants
Iustin Pop [Mon, 18 May 2009 19:15:41 +0000 (21:15 +0200)]
Move more hypervisor strings into constants

This patch adds constants for the mouse and boot order strings; while
there are still some issues remaining, we're trying to cleanup hardcoded
strings from the hypervisors.

Since the formatting of frozensets is currently wrong, we also add an
utility function for this and change all the error messages to use it.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agowatcher: try to restart the master if down
Iustin Pop [Tue, 19 May 2009 11:23:31 +0000 (13:23 +0200)]
watcher: try to restart the master if down

Bugs in either our code or in associated libraries can bring the master daemon
down, and this (due to the 2.0 architecture) stops all work on the cluster.

Since the watcher already does periodic checks on the cluster, we modify
it to try to start the master automatically in case of failures to
connect. This will be tried only once per cycle.

Also, in this case, we modify the code so that the watcher status file
is not updated - its timestamp will reflect thus the time of last
successful connection to the master.

Side note: the except errors.ConfigurationError part could be cleaned
up, since in 2.0 we don't usually get that directly, and if we do it's
an error and we shouldn't touch the file anyway; but that is not a rc5
change.

Signed-off-by: Iustin Pop <iustin@google.com>

15 years agoIAllocator: export total disk size for instances
Iustin Pop [Tue, 19 May 2009 09:35:56 +0000 (11:35 +0200)]
IAllocator: export total disk size for instances

This patch adds for current instance a ‘disk_space_total’ key, similar
to the key for the new instance in case of new allocations.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoAdd -H/-B startup parameters to gnt-instance
Iustin Pop [Mon, 18 May 2009 17:21:44 +0000 (19:21 +0200)]
Add -H/-B startup parameters to gnt-instance

This patch modifies the start instance script, opcode and logical unit
to support temporary startup parameters.

Different from 1.2, where only the kernel arguments were supporting
changes (and thus xen-pvm specific), this version supports changing all
hypervisor and backend parameters (with appropriate checks).

This is much more flexible, and allows for example:
  - start with different, temporary kernel
  - start with different memory size

Note: in later versions, this should be extended to cover disk
parameters as well (e.g. start with drbd without flushes, start with
drbd in async mode, etc.).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agocall_instance_start: add optional hv/be parameters
Iustin Pop [Mon, 18 May 2009 16:39:29 +0000 (18:39 +0200)]
call_instance_start: add optional hv/be parameters

This patch modifies the rpc.call_instance_start - the master side - to
take optional hv/be parameters. The noded side is unchanged and
oblivious to the change.

This will allow implementation of single-user capability and such on
startup (temporary, as opposed to permanent).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoFix gnt-job list argument handling
Guido Trotter [Mon, 18 May 2009 15:57:25 +0000 (16:57 +0100)]
Fix gnt-job list argument handling

Currently QueryJob returns "None" when a wrong job ID is passed.
Handle this in gnt-job list, by printing an error for each wrong job,
and still giving output for all the jobs which actually do exist.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoInstance reinstall: don't mix up errors
Guido Trotter [Fri, 15 May 2009 08:44:13 +0000 (09:44 +0100)]
Instance reinstall: don't mix up errors

If the remote info rpc call fails we can't assume that the instance is
up.

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agoDon't check memory at startup if instance is up
Guido Trotter [Fri, 15 May 2009 08:42:55 +0000 (09:42 +0100)]
Don't check memory at startup if instance is up

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agognt-cluster modify: fix --no-lvm-storage
Guido Trotter [Tue, 12 May 2009 17:34:42 +0000 (18:34 +0100)]
gnt-cluster modify: fix --no-lvm-storage

Currently doing a gnt-cluster-modify --no-lvm-storage is silently
ignored, as it passes a None value in vg_name, which is the same as not
modifying that parameter. Explicitely set the passed value to '', so the
non-true not-None value can be evaluate to actually remove a volume
group.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoLUSetClusterParams: improve volume group removal
Guido Trotter [Tue, 12 May 2009 17:24:40 +0000 (18:24 +0100)]
LUSetClusterParams: improve volume group removal

Currently LUSetClusterParams will remove the volume group if the vg_name
field passed in is not true, but not None. Setting the target volume
group to False or the empty string, though, is a bad idea because it's
not a boolean value, and at cluster init we set it to None if
--no-lvm-storage is passed. With this fix we handle '' (or any other
non-None false value) as the "unset" value, but actually store None in
the config.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agognt-cluster info: show more cluster parameters
Guido Trotter [Tue, 12 May 2009 17:08:06 +0000 (18:08 +0100)]
gnt-cluster info: show more cluster parameters

Even if we cannot modify all of them, they are useful information about
the current cluster.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoLUQueryClusterInfo: return a few more fields
Guido Trotter [Tue, 12 May 2009 17:00:48 +0000 (18:00 +0100)]
LUQueryClusterInfo: return a few more fields

Some fields can be set at cluster init, and perhaps even modifed with
SetClusterParams but there's no way to know them. With this patch we
export them in the cluster info query.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoKVMHypervisor: return memory and cpus as integers
Guido Trotter [Tue, 12 May 2009 11:11:00 +0000 (12:11 +0100)]
KVMHypervisor: return memory and cpus as integers

Currently the KVM hypervisor returns strings for the memory and cpu
values, while the xen hypervisor returns integers. Making this uniform
converting the values to integers in KVM as well.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoLUSetInstanceParam: don't assume memory is integer
Guido Trotter [Tue, 12 May 2009 11:07:18 +0000 (12:07 +0100)]
LUSetInstanceParam: don't assume memory is integer

LUSetInstanceParam currently assumes that the 'memory' value of a
call_instance_info result is an integer, while the rest of the code
explicitely converts it to int(). Converting it to int works around a
bug which prevents changing the memory allocation of a live instance if
the remote call returns the memory in string format.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoAdd the new DRBD test files to the Makefile
Iustin Pop [Sat, 9 May 2009 21:48:43 +0000 (23:48 +0200)]
Add the new DRBD test files to the Makefile

These were forgotten in commit 01e2ce3a6e4ca68983f50dedaddd0d0fc7b77026,
and caused “make distcheck” to fail.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoFix QA and documentation about no initrd case
Iustin Pop [Mon, 11 May 2009 13:43:34 +0000 (15:43 +0200)]
Fix QA and documentation about no initrd case

In Ganeti 1.2, “none” was used to signify no initrd. In 2.0 we have
changed to “no_” as a prefix (i.e. “-H no_initrd_path”) and thus we
document in the manpage this.

The QA suite is changed accordingly.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoRemove an unused function
Iustin Pop [Mon, 11 May 2009 13:30:14 +0000 (15:30 +0200)]
Remove an unused function

The _TransformPath function is not used anymore in 2.0, let's remove it.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoExporting the instance network_port on the RAPI
Tim Boring [Sun, 10 May 2009 14:27:04 +0000 (10:27 -0400)]
Exporting the instance network_port on the RAPI

Patch for adding network_port to the instance attributes exported by the
RAPI.

[iustin@google.com: slightly changed the formatting]
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoMinor patch to rapi documentation
Tim Boring [Fri, 8 May 2009 18:10:42 +0000 (14:10 -0400)]
Minor patch to rapi documentation

Minor patch to clarify the URL necessary for accessing the RAPI.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoSmall doc change in README
Iustin Pop [Sat, 9 May 2009 20:30:14 +0000 (22:30 +0200)]
Small doc change in README

The version is 2.0, and we don't build PDFs by default, only HTML
files.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoRemove some superfluous imports
Carlos Valiente [Tue, 5 May 2009 13:17:52 +0000 (14:17 +0100)]
Remove some superfluous imports

This is for Python 2.6 compatibility.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoMake Python interpreter selectable for test scripts
Carlos Valiente [Tue, 5 May 2009 15:12:48 +0000 (16:12 +0100)]
Make Python interpreter selectable for test scripts

The Python interpreter used to run the test cases is hard-coded to be
/usr/bin/python. If we use the first one from $PATH instead, it is
much easier to test ganeti with other Python versions.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoPass optional arguments to the daemons
Guido Trotter [Tue, 5 May 2009 13:58:49 +0000 (15:58 +0200)]
Pass optional arguments to the daemons

These can be set in the defaults file, default to no arguments being
passed, and make it easy for local installation to customize the way the
ganeti daemons are called.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin <iustin@google.com>

15 years agoganeti.initd: include defaults file, if present
Guido Trotter [Tue, 5 May 2009 13:53:37 +0000 (15:53 +0200)]
ganeti.initd: include defaults file, if present

In the example init script we'll execute an optional defaults file to
make it easier to add local customizations to the ganeti startup.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin <iustin@google.com>

15 years agoFix ;; indentation in the main initd loop
Guido Trotter [Tue, 5 May 2009 14:07:00 +0000 (16:07 +0200)]
Fix ;; indentation in the main initd loop

Currently two of the ;; ending the case bodies are not indented with
anything. Reindent all of them to the body of the loop, as it's done
somewhere else in the init script.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin <iustin@google.com>

15 years agoAvoid DeprecationWarning on Python >= 2.6
Carlos Valiente [Tue, 5 May 2009 14:43:04 +0000 (15:43 +0100)]
Avoid DeprecationWarning on Python >= 2.6

Python 2.6 complains about module 'sha' being deprecated. It makes
execution of Ganeti commands a bit annoying, and when you run
'ganeti-watcher' in cron jobs, you get a mail message after every
execution.

Tests pass under under Python 2.6 and Python 2.4.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoAvoid DeprecationWarning on Python >= 2.6
Carlos Valiente [Tue, 5 May 2009 14:43:04 +0000 (15:43 +0100)]
Avoid DeprecationWarning on Python >= 2.6

Python 2.6 complains about module 'sha' being deprecated. It makes
execution of Ganeti commands a bit annoying, and when you run
'ganeti-watcher' in cron jobs, you get a mail message after every
execution.

Tests pass under under Python 2.6 and Python 2.4.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoganeti-noded: add bind address option
Guido Trotter [Tue, 5 May 2009 10:29:10 +0000 (12:29 +0200)]
ganeti-noded: add bind address option

This allows ganeti-noded to bind only on one interface rather than all
the ones on the machine. The default behaviour doesn't change.

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agoFix compatibility with DRBD 8.3
Iustin Pop [Tue, 5 May 2009 10:48:50 +0000 (12:48 +0200)]
Fix compatibility with DRBD 8.3

DRBD 8.3 changes two more things compared to 8.2:
  - /proc/drbd format changed in multiple ways; the part we're
    interested is the ‘st:’ to ‘ro:‘ change (in the changelog named as
    “Renamed 'state' to 'role'”
  - “drbdsetup /dev/drbdN show” changed the ‘device’ stanza from:
      device "/dev/drbd0";
    to:
      device                  minor 0;

This patch fixes these both and adds data files and unittests for DRBD
8.3.1.

Signed-off-by: Iustin Pop <iustin@google.com>

15 years agoFix compatibility with DRBD 8.2
Karsten Keil [Tue, 14 Apr 2009 15:06:30 +0000 (17:06 +0200)]
Fix compatibility with DRBD 8.2

This patch adds (and suppresses) the extra ipv4/ipv6 words before the
actual address that newer DRBD versions add.

[iustin@google.com: slightly changed the patch to conform to style
guide, and changed the commit message]
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoRunCmd: log command line for missing cmd case
Iustin Pop [Mon, 4 May 2009 22:03:29 +0000 (00:03 +0200)]
RunCmd: log command line for missing cmd case

In case of missing programs, currently utils.RunCmd doesn't show any
information to help debugging, only 'No such file or directory'. This
patch adds error handling for the ENOENT case such that at least we have
this information in the node daemon logs.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoAbstract Linux node information in hv_base
Iustin Pop [Mon, 4 May 2009 21:19:58 +0000 (23:19 +0200)]
Abstract Linux node information in hv_base

Currently both hv_fake and hv_kvm implement practically identical code
to get the node information. Since future container-like hypervisors
will also need this functionality, this patch moves it into the base
class (as a separate function) which can then be called from classes
which need this info.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoFix argument checking in LUSetClusterParams
Iustin Pop [Mon, 4 May 2009 14:49:15 +0000 (16:49 +0200)]
Fix argument checking in LUSetClusterParams

This patch fixes two issues with LUSetClusterParams and argument
checking.

First, this LU used the wrong function name (CheckParameters instead of
CheckArguments), which means that no parameter checking was done at all;
this impacted the candidate_pool_size checks (the only one done at this
stage).

Second, int() can raise both ValueError and TypeError, and we should
correctly handle both.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoSmall optimisation in utils.WriteFile
Iustin Pop [Sat, 2 May 2009 21:03:07 +0000 (23:03 +0200)]
Small optimisation in utils.WriteFile

Currently we always try to remove the new file, even if the rename
succeeded. This patch tracks the existence of the new file and doesn't
try to remove it if we managed to rename it.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoFix luxi serialization in ganeti-masterd
Iustin Pop [Sat, 2 May 2009 20:17:01 +0000 (22:17 +0200)]
Fix luxi serialization in ganeti-masterd

Currently, lib/luxi.py used lib/serializer.py for encoding/decoding
messages, but the master daemon uses directly the simplejson module.
This is wrong as any non-trivial change to serializer.py will break the
master daemon.

The patch changes masterd to use exactly the same functions as luxi.py
for encoding/decoding of messages.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

15 years agoAllow gnt-debug submit-job to take multiple args
Iustin Pop [Fri, 1 May 2009 19:19:59 +0000 (21:19 +0200)]
Allow gnt-debug submit-job to take multiple args

Currently “gnt-debug submit-job” takes a single argument and has
non-trivial startup-costs; in order to exercise the job system, it is
better to be able to submit multiple jobs with a single invocation of
the script.

This patch extends it to take multiple argument, de-serialize the
opcodes and then submit all of them as fast as possible, in order to
increase pressure on the master daemon.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Alexander Schreiber <als@google.com>

15 years agoInclude node name in hypervisor validation errors
Iustin Pop [Mon, 4 May 2009 11:29:10 +0000 (13:29 +0200)]
Include node name in hypervisor validation errors

The current validation routine just says "failed", without specifying
the node name. This is very confusing, and we should log the node name
too.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Alexander Schreiber <als@google.com>

15 years agoFix gnt-cluster getmaster on non-master nodes
Iustin Pop [Mon, 4 May 2009 12:48:29 +0000 (14:48 +0200)]
Fix gnt-cluster getmaster on non-master nodes

The current implementation of “gnt-cluster getmaster” doesn't work on
non-master nodes, which is a regression from 1.2. This patch implements
it (again) via ssconf.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Alexander Schreiber <als@google.com>

15 years agoRelease 2.0rc4 v2.0.0rc4
Iustin Pop [Mon, 27 Apr 2009 10:57:49 +0000 (10:57 +0000)]
Release 2.0rc4

Reviewed-by: ultrotter

15 years agoUpdate gnt-instance(8) for info
Guido Trotter [Fri, 24 Apr 2009 16:13:45 +0000 (16:13 +0000)]
Update gnt-instance(8) for info

Add the --all argument, and reword a bit the basic information.

Reviewed-by: iustinp

15 years agognt-instance info --all
Guido Trotter [Fri, 24 Apr 2009 16:13:29 +0000 (16:13 +0000)]
gnt-instance info --all

Don't show all instances info by default, but require --all to be passed
for this time consuming operation.

Reviewed-by: iustinp

15 years agoLUDiagnoseOS: change locking and error handling
Iustin Pop [Fri, 24 Apr 2009 14:36:17 +0000 (14:36 +0000)]
LUDiagnoseOS: change locking and error handling

Since the “list OSes” call is exported via RAPI, this can be used pretty
easily to DOS the master daemon during long jobs.

The implementation of LUDiagnoseOS makes an RPC call to all nodes; we
lock nodes here in order to prevent node removal.

However, after closer examination, the worst case is:
  - we get the list of nodes from the config
  - another thread removes a node
  - our RPC queries reach the removed node

As this point, if ganeti-noded is stopped or doesn't accept our queries,
the RPC call will return failed, and in the current implementation all
OSes will become invalid.

If we change the ‘failed RPC’ handling to ignore such nodes, this allows
us to both remove locking, and to handle transient RPC failures better
(not invalidating all OSes).

This patch does both these things, with a single drawback: in gnt-os
diagnose, the down nodes do not appear at all. I think this is a small
drawback, and the alternative is to add them with status failed; this
works (3-line patch), but then the output of “list” and “diagnose” will
no longer be consistent. As such, my proposal is to not list the nodes.

Reviewed-by: ultrotter

15 years agoFix verify-disks with broken volume groups
Iustin Pop [Fri, 24 Apr 2009 08:43:09 +0000 (08:43 +0000)]
Fix verify-disks with broken volume groups

When a remote node returns invalid LVM data, we check it, but we don't
stop and continue with the rest of the checks (which require a valid
volume group). This raises an internal error and breaks verify disks.

This seems unchanged for a long while, I don't know why it surfaced just
recently.

Reviewed-by: ultrotter

15 years agoPrevent errors when xenvg is broken cluster verify
Iustin Pop [Fri, 24 Apr 2009 08:43:01 +0000 (08:43 +0000)]
Prevent errors when xenvg is broken cluster verify

When vg_name is not returned at all, we currently abort with an internal
error. This is because we don't catch KeyError.

This patch adds a custom message for this case, and also adds KeyError
to the list of catched exceptions, just for safety.

On the other hand, we could also just remove this piece of code since
it's not used at all the ["dfree"] value.

Reviewed-by: ultrotter

15 years agoA bunch of doc and other small fixes
Iustin Pop [Wed, 15 Apr 2009 11:11:12 +0000 (11:11 +0000)]
A bunch of doc and other small fixes

This patch adds a couple of both externally and internally reported
issues:
  - missing SGML tags (Issue 54), report and patch by superdupont
  - wrong variable used in the init.d script, report and patch by
    Karsten Keil <karsten-keil@t-online.de>
  - man page for gnt-instance reinstall needs clarification (Issue 56)
  - gnt-instance man page missing --disks documentation for
    replace-disks
  - gnt-node modify help output is unclear about the -C/-D/-O input
    format, and the man page doesn't document this command at all
  - “gnt-node modify -C yes” for offline or drained nodes had wrong
    error message
  - “gnt-instance reinstall --select-os” has wrong prompt, we only
    accept a number for the OS and not the template name

Reviewed-by: ultrotter

15 years agoTrivial typo fix in error message
Alexander Schreiber [Tue, 14 Apr 2009 16:42:43 +0000 (16:42 +0000)]
Trivial typo fix in error message

Reviewed-by: iustinp

15 years agoRelease 2.0rc3 v2.0.0rc3
Iustin Pop [Wed, 8 Apr 2009 12:34:49 +0000 (12:34 +0000)]
Release 2.0rc3

Burnin tests were successful, release rc3.

Reviewed-by: imsnah

15 years agoDistribute built documentation
Iustin Pop [Tue, 7 Apr 2009 11:53:58 +0000 (11:53 +0000)]
Distribute built documentation

This patch changes the way documentation is built in order to distribute
the generated output in the 'dist' archive, and thus no longer
requiring the presence of the docbook/rst toolchains during build time.
This will lower the requirements for installation and also makes the
build time insignificant.

First, we remove the docbook2pdf rules and variables, since we no longer
build this kind of docs. Furthermore, the rst source files are not
(today) processed via replace_vars_sed, so the whole .in rules for doc/
go away.

Next, we change the ".sgml|.rst -> replace_vars_sed -> .in -> processor
-> final file" processing to ".sgml|.rst -> generator -> .in ->
replace_vars_sed -> final file"; this means we first process the file
using the formatter, with the @VARIABLE@ entries in it, and save the
output as .in; this output we distribute, and on the user side, the
replace_vars_sed will use the new configure flags to transform the
(almost final .in form) to the final form, without needing the
toolchain.

In configure.ac we also change from ERROR to WARN for the documentation
generators, and extra tests in Makefile.am check that the programs have
been found.

This was tested with distcheck and works as expected.

Reviewed-by: ultrotter

15 years agoDisable synchronous (locking) queries
Iustin Pop [Mon, 6 Apr 2009 08:21:30 +0000 (08:21 +0000)]
Disable synchronous (locking) queries

This patch raises an error in the master daemon in case the user
requests a locking query; accordingly, all clients were modified to send
only lockless queries. This is short-term fix, for proper fix the
clients should be modified to submit a job when the user request a
locking query.

The other approach would be to ignore the flag passed by the client;
this would be worse as client's wouldn't get at least an error.

The possible impact of this is multiple:
  - some commands could have been not converted, and thus fail; this
    can be remedied easily
  - the consistency of commands is lost; e.g. node failover will not
    lock the node *while we get the node info*, so we could miss some
    data; this is again in the thread of atomic operations which are
    missing in the current model of query-and-act from gnt-* scripts

Reviewed-by: imsnah, ultrotter

15 years agoFix the output of watcher on non-master nodes
Iustin Pop [Mon, 6 Apr 2009 08:21:13 +0000 (08:21 +0000)]
Fix the output of watcher on non-master nodes

Currently the watcher spews errors message on non-master nodes. This
cleans it up.

Reviewed-by: imsnah

15 years agoChange the watcher to use jobs instead of queries
Iustin Pop [Mon, 6 Apr 2009 08:21:04 +0000 (08:21 +0000)]
Change the watcher to use jobs instead of queries

As per the mailing list discussion, this patch changes the watcher to
use a single job (two opcodes) for getting the cluster state (node list
and instance list); it will then compute the needed actions based on
this data.

The patch also archives this job and the verify-disks job.

Reviewed-by: imsnah

15 years agoFix Xen soft reboot via polling
Iustin Pop [Mon, 6 Apr 2009 08:20:53 +0000 (08:20 +0000)]
Fix Xen soft reboot via polling

This patch fixes the Xen soft reboot ("xm reboot") via polling for a specific
time for either changed domain ID or decreased CPU run-time.

This sould prevent the race-conditions discussed on the mailing list for
reboots.

Reviewed-by: imsnah

15 years agoAdd a new ssconf file with the cluster tags
Iustin Pop [Mon, 6 Apr 2009 08:20:40 +0000 (08:20 +0000)]
Add a new ssconf file with the cluster tags

Since the cluster tags are/should be more-or-less static, add them as an
ssconf key, so that querying them is possible without creating a
job/requiring the masterd to be running.

Reviewed-by: imsnah

15 years agoAdd some more debugging info to masterd
Iustin Pop [Mon, 6 Apr 2009 08:20:28 +0000 (08:20 +0000)]
Add some more debugging info to masterd

This patch will log data about queries, which are today completely
invisible (at the default log level) in the master log file.

Reviewed-by: imsnah

15 years agoRelease 2.0rc2 v2.0.0rc2
Iustin Pop [Fri, 27 Mar 2009 15:11:54 +0000 (15:11 +0000)]
Release 2.0rc2

This updates the NEWS file and bumps up the version number.

Reviewed-by: ultrotter

15 years agoFix _NOQUOTE regexp
Guido Trotter [Fri, 20 Mar 2009 13:07:22 +0000 (13:07 +0000)]
Fix _NOQUOTE regexp

Allow expressions longer than one character to match.

Reviewed-by: imsnah

15 years agoMainloop: avoid calculating timeout every time
Guido Trotter [Fri, 20 Mar 2009 13:06:56 +0000 (13:06 +0000)]
Mainloop: avoid calculating timeout every time

set timeout_needs_update to False after calculating the timeout.

Reviewed-by: imsnah

15 years agoRaise on invalid gnt-cluster queue commands
Guido Trotter [Fri, 20 Mar 2009 13:06:29 +0000 (13:06 +0000)]
Raise on invalid gnt-cluster queue commands

 # gnt-cluster queue foo
 Failure: prerequisites not met for this operation:
 Command 'foo' is not valid.

Reviewed-by: iustinp

15 years agokvm: use the correct vnc bind address
Guido Trotter [Thu, 12 Mar 2009 12:08:04 +0000 (12:08 +0000)]
kvm: use the correct vnc bind address

There is a bug in kvm, when binding vnc to a specific address the
constant 'vnc_bind_address' is passed in, instead of the actual
requested address. This patch fixes it.

Reviewed-by: iustinp

15 years agoAdd the 2.0-specific node flags to the design doc
Iustin Pop [Thu, 12 Mar 2009 11:54:35 +0000 (11:54 +0000)]
Add the 2.0-specific node flags to the design doc

This patch adds the newly-introduced node flags to the design document,
as they currently are missing from there.

The patch also reduces the TOC depth to 3, as it was too big.

Reviewed-by: ultrotter

15 years agoFix the --net option to gnt-instance add
Iustin Pop [Thu, 12 Mar 2009 11:54:22 +0000 (11:54 +0000)]
Fix the --net option to gnt-instance add

Similar to the --disk fixes a while ago, --net is broken too. This patch
fixes it.

Reviewed-by: imsnah

15 years agoXen: Remove one hardcoded constant
Guido Trotter [Tue, 10 Mar 2009 15:02:43 +0000 (15:02 +0000)]
Xen: Remove one hardcoded constant

s/"vnc_bind_address"/constants.HV_VNC_BIND_ADDRESS/

Reviewed-by: imsnah

15 years agowatcher: fix startup sequence locking the master
Iustin Pop [Mon, 9 Mar 2009 15:12:24 +0000 (15:12 +0000)]
watcher: fix startup sequence locking the master

Currently, the watcher startup sequence does:
  - open a luxi client
  - get the instance list
  - get the node boot ids
  - open and lock the status file, and:
    - archive jobs
    - restart the down instances
    - check disks

This, of course, can lead to problems when a node is (genuinely or not)
locked for more than (watcher interval * maximum query clients) time. At
that time, the master is completely unresponsive until the node is
unlocked and all the watchers exit with error due to the state file
being locked by the first instance.

This patch reworks the startup sequence to first open/lock the status
file, and only then open a luxi client. This should prevent the above
case.

Reviewed-by: ultrotter

15 years agoHandle ghost instances in temp DRBD map
Iustin Pop [Mon, 9 Mar 2009 15:12:13 +0000 (15:12 +0000)]
Handle ghost instances in temp DRBD map

Currently cluster-verify doesn't handle the (admitedly invalid) case where we
have reservation for instances that were removed in the meantime.

This patch adds a check for this and prevents code errors in cluster-verify in
this case:
 * Verifying node node4.example.com (master candidate)
   - ERROR: ghost instance \'instance3.example.com\' in temporary DRBD map

Reviewed-by: imsnah

15 years agoFix error handling in replace-disks with new node
Iustin Pop [Mon, 9 Mar 2009 15:12:01 +0000 (15:12 +0000)]
Fix error handling in replace-disks with new node

Currently the _CreateSingleBlockDev function only raises OpExecError and not
BlockDeviceError. This means that we don't release the instance's temporary
minors properly, and this creates problems later if the instance is removed
without master restart.

We could just use OpExecError, but adding it and leaving
BlockDeviceError in seems safer.

Reviewed-by: imsnah

15 years agoFix serial_no field on instances
Iustin Pop [Fri, 6 Mar 2009 14:49:06 +0000 (14:49 +0000)]
Fix serial_no field on instances

The instance objects did not get a serial_no field. This patch adds a
new constants for the field name and uses it for all three cases
(cluster, nodes, instances).

Reviewed-by: imsnah

15 years agoUpdate gnt-cluster(8) for be/hyp parameter syntax
Guido Trotter [Thu, 5 Mar 2009 15:42:21 +0000 (15:42 +0000)]
Update gnt-cluster(8) for be/hyp parameter syntax

Now it displays:

--hypervisor-parameters hypervisor:hv-param=value [ ,hv-param=value ... ]
--backend-parameters be-param=value [ ,be-param=value ... ]

Sorry for the super-long lines :( Is there a better way to insert spaces
without pushing them to the resulting man page?

Reviewed-by: iustinp

15 years agoComplete the cfgupgrade script for 2.0 migrations
Iustin Pop [Wed, 4 Mar 2009 14:22:52 +0000 (14:22 +0000)]
Complete the cfgupgrade script for 2.0 migrations

This patch makes the cfgupgrade script to handle:
  - instance changes
  - disk changes
  - further cluster fixes
  - adds configuration checks at the end, in non-dry-run mode

Reviewed-by: ultrotter

15 years agoFirst run at cfgupgrade for 2.0 upgrades
Iustin Pop [Wed, 4 Mar 2009 14:20:47 +0000 (14:20 +0000)]
First run at cfgupgrade for 2.0 upgrades

This patch makes cfgupgrade work on empty cluster (i.e. no instances),
up to a point that the config file can be converted from 1.2 to 2.0.
This is not yet complete, though.

Reviewed-by: ultrotter

15 years agoFix bash completion for cluster copyfile/command
Iustin Pop [Wed, 4 Mar 2009 10:13:53 +0000 (10:13 +0000)]
Fix bash completion for cluster copyfile/command

“copyfile” takes a file argument, so we enable file-completion for it.
“gnt-cluster command” takes a command, so we enable command completion.

Reviewed-by: imsnah

15 years agoRelease 2.0rc1 v2.0.0rc1
Iustin Pop [Mon, 2 Mar 2009 14:30:26 +0000 (14:30 +0000)]
Release 2.0rc1

This patch updates the NEWS file and increases the version to 2.0 rc1.

Reviewed-by: ultrotter

15 years agoExport tags to cluster verify hooks
Iustin Pop [Mon, 2 Mar 2009 12:19:45 +0000 (12:19 +0000)]
Export tags to cluster verify hooks

This patch export the cluster and node tags to the cluster verify hook
scripts. The tags are exported as a space-separated list, which allows
easy parsing from the shell (e.g. “for tag in $GANETI_CLUSTER_TAGS; do
...”) and therefore requires the previous “Don't allow spaces in tag
names” patch.

The patch also fixes a minor line length style problem.

Reviewed-by: ultrotter

15 years agoDon't allow spaces in tag names
Iustin Pop [Mon, 2 Mar 2009 12:19:23 +0000 (12:19 +0000)]
Don't allow spaces in tag names

This patch restricts the use of spaces in tags, as this does not allow
nice exporting of tags to environment in hooks. One can use underscores
or dashes instead of spaces.

Reviewed-by: schreiberal

15 years agoUpdate the iallocator documentation
Iustin Pop [Mon, 2 Mar 2009 12:18:42 +0000 (12:18 +0000)]
Update the iallocator documentation

This updates the iallocator documentation to 2.0, bumps up the
iallocator version (and moves a constants to lib/constants.py), and
fixes a style on install.rst.

Reviewed-by: ultrotter

15 years agoFix a bug in utils.EnsureDirs
Iustin Pop [Mon, 2 Mar 2009 12:18:13 +0000 (12:18 +0000)]
Fix a bug in utils.EnsureDirs

This fixes a bug introduced in rev 2562 and also fixes the indentation.

Reviewed-by: ultrotter

15 years agoA doc update and a small indentation fix
Iustin Pop [Mon, 2 Mar 2009 09:51:15 +0000 (09:51 +0000)]
A doc update and a small indentation fix

This adds a small paragraph about the “master” role of a node, and fixes
a wrong indentation in the bash completion file.

Reviewed-by: imsnah

15 years agoUse EnsureDirs in KVM as well.
Guido Trotter [Fri, 27 Feb 2009 17:09:15 +0000 (17:09 +0000)]
Use EnsureDirs in KVM as well.

The KVM hypervisor has also code to ensure a list of directories exist.
Substitute it with our new utils function.

Reviewed-by: iustinp

15 years agoCreate runtime dir in bootstrap
Guido Trotter [Fri, 27 Feb 2009 17:08:55 +0000 (17:08 +0000)]
Create runtime dir in bootstrap

Some hypervisors (KVM) need RUN_GANETI_DIR to exist even at cluster init
time. This patch creates it in InitCluster just before hv parameter
checking. Since the code to make list of directories is already repeated
twice in the code, and this would be the third time, we abstract it into
an utils.EnsureDirs function and we call that one from ganti-noded,
ganeti-masterd and bootstrap.

Reviewed-by: iustinp

15 years agoLUVerifyCluster: Handle the "no volume group" case
Guido Trotter [Fri, 27 Feb 2009 17:08:31 +0000 (17:08 +0000)]
LUVerifyCluster: Handle the "no volume group" case

If we're only file based and out volume group is set to "None" there's
no point in asking nodes for their volume groups, logical volumes, and
drbd devices, and checking those.

Reviewed-by: iustinp

15 years agoConvert the RAPI document to restructured text
Iustin Pop [Fri, 27 Feb 2009 13:06:31 +0000 (13:06 +0000)]
Convert the RAPI document to restructured text

This patch changes the RAPI document, and the RAPI resources
autogenerated-documentation to restructured text. This meant changing
the autogen tool.

The new fragment can be included via RST directives, and doesn't need
passing through replace-sed-vars. This was also the last sgml document
in doc/, so we remove old makefile rules about it.

Reviewed-by: imsnah

15 years agoFix some epydoc style issues
Iustin Pop [Fri, 27 Feb 2009 13:06:15 +0000 (13:06 +0000)]
Fix some epydoc style issues

99% of the epydoc return tags are "@return:", but each of the modified files
had one "@returns:" line. We fix this for consistency.

Reviewed-by: imsnah

15 years agoConvert the install document to restructured text.
Iustin Pop [Fri, 27 Feb 2009 10:38:51 +0000 (10:38 +0000)]
Convert the install document to restructured text.

This switches back to the hardcoding of the version number, as we don't
yet have a wrapper for rst files that passes them through
replace-sed-vars.

Reviewed-by: imsnah

15 years agoFix the Makefile after the bash_completion patch
Iustin Pop [Thu, 26 Feb 2009 16:27:45 +0000 (16:27 +0000)]
Fix the Makefile after the bash_completion patch

I've somehow left these two out. Sorry!

Reviewed-by: imsnah

15 years agoAdd bash-completion rules
Iustin Pop [Thu, 26 Feb 2009 16:11:11 +0000 (16:11 +0000)]
Add bash-completion rules

This is a not-complete bash completion file for ganeti commands (gnt-*)
and the burnin tool. It is based on previous work by Minghua Ye
<yeminghua@google.com> for Ganeti 1.1, which wasn't used because the
lack of ssconf keys (which allow easy inspection by the shell of the
existing nodes and instances) made it too slow.

The file works as expected, however I realized that our custom (like
comma-separated, or a=b:c,e:f) options are not very nice for
auto-completion. There are a few FIXMEs in the source for that.

The file is not installed at make install time, but it should be put in
the correct place by packages.

Reviewed-by: imsnah

15 years agoFix typos in utils.WriteFile's docstring
Michael Hanselmann [Thu, 26 Feb 2009 12:32:04 +0000 (12:32 +0000)]
Fix typos in utils.WriteFile's docstring

Reviewed-by: iustinp

15 years agoFix mixed pvm/hvm clusters and instance listing
Iustin Pop [Wed, 25 Feb 2009 15:03:43 +0000 (15:03 +0000)]
Fix mixed pvm/hvm clusters and instance listing

The current implementation of the combining of the instance lists will
only do this for instances whose all four-fields match in both
hypervisors; however, this is broken for the dynamic fields (state,
times) which can change between the invocations of the two different
hypervisors if the instance is busy.

The patch checks only the memory and VCPUs, and makes mixed clusters
work even with 100% CPU instances.

Reviewed-by: imsnah

15 years agoFix xen-hvm and KERNEL_ARGS
Iustin Pop [Wed, 25 Feb 2009 15:03:24 +0000 (15:03 +0000)]
Fix xen-hvm and KERNEL_ARGS

xen-hvm doesn't have KERNEL_ARGS, and I just changed blindly all old
extra_args to HV_KERNEL_ARGS. This makes xen-hvm work again.

Reviewed-by: imsnah

15 years agoUpdate some version-related constants
Iustin Pop [Wed, 25 Feb 2009 12:50:46 +0000 (12:50 +0000)]
Update some version-related constants

Since we are quite close to final RPC and hooks APIs, we update the hooks and
protocol_version constants.

Reviewed-by: imsnah

15 years agoConvert the hooks document to restructured text
Iustin Pop [Wed, 25 Feb 2009 11:24:10 +0000 (11:24 +0000)]
Convert the hooks document to restructured text

This also updates the hooks document to 2.0.

Reviewed-by: ultrotter

15 years agoUpdate some hooks settings
Iustin Pop [Wed, 25 Feb 2009 11:23:58 +0000 (11:23 +0000)]
Update some hooks settings

While reviewing the hooks document, I realised we are not correctly
exporting the instance properties.

This patch fixes:
  - export the disk and disk template in all LUs, not only (hardcoded)
    in the instance create
  - removes the instance create INSTANCE_ prefix on some non-instance
    variables (those are LU-related, not instance-related)
  - adds a couple of more variables to other LUs

The hook document will be updated in a separate patch.

Reviewed-by: ultrotter

15 years agoRemove the extra_args parameter in instance start
Iustin Pop [Tue, 24 Feb 2009 15:25:37 +0000 (15:25 +0000)]
Remove the extra_args parameter in instance start

This patch removes the extra_args parameter and instead switches the
instance to the HV_KERNEL_ARGS hypervisor option.

This is a big change, but it's a needed cleanup, this extra parameter on
all RPC calls is not generic and we also need to have a persistent value
here.

Reviewed-by: imsnah

15 years agoSimplify a little the hypervisor routines
Iustin Pop [Tue, 24 Feb 2009 15:25:01 +0000 (15:25 +0000)]
Simplify a little the hypervisor routines

Instead of “instance.hvparams”, we use a shorter “hvp” name to make readability
better.

Reviewed-by: imsnah

15 years agoAdd definitions for the root_args hypervisor param
Iustin Pop [Tue, 24 Feb 2009 15:24:45 +0000 (15:24 +0000)]
Add definitions for the root_args hypervisor param

This patch adds a new hypervisor parameter for the hypervisors that can
actually start and instance with external kernels.

Reviewed-by: imsnah

15 years agoConvert iallocator.sgml to restructured text
Iustin Pop [Tue, 24 Feb 2009 13:57:53 +0000 (13:57 +0000)]
Convert iallocator.sgml to restructured text

This is a no-contents change, this doc will need update to conform to
2.0 message contents (and also the code will need increase to version 2
of the iallocator protocol).

Reviewed-by: imsnah

15 years agoConvert the admin guide to restructured text
Iustin Pop [Tue, 24 Feb 2009 13:56:12 +0000 (13:56 +0000)]
Convert the admin guide to restructured text

The RST format holds a little bit less information, as all the <file
class="directory"> and <userinput> tags are gone, however we're not
really losing important context here. And it's way easier to read and
update.

Reviewed-by: imsnah

15 years agognt-instance info: remove hvattr descriptions
Guido Trotter [Tue, 24 Feb 2009 12:59:13 +0000 (12:59 +0000)]
gnt-instance info: remove hvattr descriptions

Having hvattr descriptions is only confusing for the user, because even
if they explain better what an attribute is about, they don't help in
deciding what keyword should be used to actually set it. If in the
future we want descriptions they should probably live in constants.py,
and be displayed together with the key, rather than instead of it.

This patch also changes the handling of the vnc console connection
description, making compatible work with both kvm and xen-hvm.

Reviewed-by: iustinp