ganeti-local
16 years agoAllow disk object to set their own physical ID
Iustin Pop [Tue, 17 Jun 2008 15:07:23 +0000 (15:07 +0000)]
Allow disk object to set their own physical ID

Currently, the way to customize a DRBD disk from (node name 1, node name
2, port) to (ip1, port, ip2, port) is to use the ConfigWriter method
SetDiskID. However, since this needs a ConfigWriter object, it can be
run only on the master, and therefore disk object can't be passed to
more than one node unchanged. This, coupled with the rpc layer
limitation that all nodes in a multi-node call receive the same
arguments, prevent any kind of multi-node operation that has disks as an
argument.

This patch takes the SetDiskID method from ConfigWriter and ports it to
the disk object itself, and instead of the full node configuration it
uses a simple {node_name: replication_ip} mapping for all the nodes
involved in the disk tree (currently we only pass primary and secondary
node since we don't support nested drbd devices).

This allows us to send disks to both the primary and secondary nodes at
once and perform synchronized drbd activation on primary/secondary
nodes.

Note that while for the 1.2 branch this will not change old methods, it
is worth to investigate and possible replace all such calls on the
master to the nodes themselves for the 2.0 branch.

Reviewed-by: ultrotter

16 years agoFix an error-handling case
Iustin Pop [Tue, 17 Jun 2008 13:10:55 +0000 (13:10 +0000)]
Fix an error-handling case

There is a mistake in handling grow-disk for an invalid disk. This patch
fixes it.

Reviewed-by: imsnah

16 years agoManpage updates for the new grow-disk command
Iustin Pop [Tue, 17 Jun 2008 06:44:59 +0000 (06:44 +0000)]
Manpage updates for the new grow-disk command

The patch documents the steps needed to complete a user-visible grow
(i.e. not only grow-disk, but also filesystem resize is needed, etc.)

Reviewed-by: imsnah

16 years agoImplement gnt-instance grow-disk
Iustin Pop [Mon, 16 Jun 2008 16:26:24 +0000 (16:26 +0000)]
Implement gnt-instance grow-disk

This patch exposes at command line level the grow-disk operation.

Reviewed-by: imsnah

16 years agoImplement disk grow at LU level
Iustin Pop [Mon, 16 Jun 2008 16:25:19 +0000 (16:25 +0000)]
Implement disk grow at LU level

This patch adds a new opcode and LU for growing an instance's disk.

The opcode allows growing only one disk at time, and will throw an error
if the operation fails midway (e.g. on the primary node after it has
been increased on the secondary node). As such, it might actually leave
different sized LVs on different nodes, but this will not create
problems.

Reviewed-by: imsnah

16 years agoAdd method to update a disk object size
Iustin Pop [Mon, 16 Jun 2008 16:21:21 +0000 (16:21 +0000)]
Add method to update a disk object size

This patch adds a method that implements updating of a disk
(object.Disk) size, together with its children.

While this will not track the exact disk size, it allows at least an
approximate size to be recorded in the configuration (and queried).

Reviewed-by: imsnah

16 years agoImplement block device grow at the rpc layer
Iustin Pop [Mon, 16 Jun 2008 16:20:09 +0000 (16:20 +0000)]
Implement block device grow at the rpc layer

This simple patch exposes the block device grow operation at the rpc
layer. It does not increase the protocol version as it has been recently
changed by the live failover rpc call.

Reviewed-by: imsnah

16 years agoExpose block device grow in backend.py
Iustin Pop [Mon, 16 Jun 2008 15:08:18 +0000 (15:08 +0000)]
Expose block device grow in backend.py

This patch adds a wrapper over the block device grow operation that
converts the input and output parameters as needed for the rpc layer.

Reviewed-by: imsnah

16 years agobdev: implement disk resize for lvm/drbd8
Iustin Pop [Mon, 16 Jun 2008 15:04:01 +0000 (15:04 +0000)]
bdev: implement disk resize for lvm/drbd8

This patch implements disk resize at the bdev level for the LVM and
DRBD8 disk types. It is not implemented for DRBD7 and MD since the way
MD works with its underlaying devices makes it harder and this
combination is also deprecated.

The LVM resize operation is tried three times, with different allocation
policies:
  - contiguous first, since this is best for allocation purposes (it
    won't fragment too much the PV)
  - cling, which is supported only by more recent LVM versions, will try
    to place the new extents on the same PV as the rest of the LV
  - and finally normal, which is the default

Reviewed-by: imsnah

16 years agoAdd migration support at the rpc layer
Iustin Pop [Mon, 16 Jun 2008 13:52:43 +0000 (13:52 +0000)]
Add migration support at the rpc layer

This patch adds the migration rpc call and its implementation in the
backend. The patch does not deal with the correct activation of disks.

Because of the new RPC, the protocol version is increased.

Reviewed-by: imsnah

16 years agohypervisor: add live migration support
Iustin Pop [Mon, 16 Jun 2008 10:29:24 +0000 (10:29 +0000)]
hypervisor: add live migration support

This is just the hypervisor-level migration (e.g. “xm migrate”) not the
whole node coordination work.

Reviewed-by: ultrotter

16 years agoganeti-watcher: Replace custom exceptions with ganeti.error.*
Michael Hanselmann [Mon, 16 Jun 2008 08:06:04 +0000 (08:06 +0000)]
ganeti-watcher: Replace custom exceptions with ganeti.error.*

Reviewed-by: iustinp

16 years agoganeti-watcher: Don't write file if data didn't change
Michael Hanselmann [Mon, 16 Jun 2008 08:05:38 +0000 (08:05 +0000)]
ganeti-watcher: Don't write file if data didn't change

This is the safest way to detect changes and the amount of data
is small, so keeping a copy around is cheap enough.

Reviewed-by: iustinp

16 years agoganeti-watcher: Rename WatcherState.data to WatcherState._data
Michael Hanselmann [Mon, 16 Jun 2008 08:05:18 +0000 (08:05 +0000)]
ganeti-watcher: Rename WatcherState.data to WatcherState._data

Cleanup: _data is private and should not be modified from outside
of this class.

Reviewed-by: iustinp

16 years agoDon't log SystemExit exception in ganeti-watcher
Michael Hanselmann [Mon, 16 Jun 2008 08:04:54 +0000 (08:04 +0000)]
Don't log SystemExit exception in ganeti-watcher

Reviewed-by: iustinp

16 years agoReplace watcher state file atomically
Michael Hanselmann [Mon, 16 Jun 2008 08:04:29 +0000 (08:04 +0000)]
Replace watcher state file atomically

- Lock it before renaming
- Code cleanup; close() automatically unlocks it

Reviewed-by: iustinp

16 years agoWrite ganeti-watcher status file even if something failed
Michael Hanselmann [Mon, 16 Jun 2008 08:04:02 +0000 (08:04 +0000)]
Write ganeti-watcher status file even if something failed

Reviewed-by: iustinp

16 years agoAdd more parameters to utils.WriteFile
Michael Hanselmann [Mon, 16 Jun 2008 08:03:32 +0000 (08:03 +0000)]
Add more parameters to utils.WriteFile

- Make closing file optional: Required by ganeti-watcher to keep
  file open after writing it. Changes return value of utils.WriteFile
  if "close" parameter evaluates to True.
- Pre- and post-write functions: Can be used to lock files. This
  will be used by ganeti-watcher to lock the temporary file before
  renaming.

Reviewed-by: iustinp

16 years agoUse ganeti.serializer module in ganeti-watcher
Michael Hanselmann [Mon, 16 Jun 2008 08:03:08 +0000 (08:03 +0000)]
Use ganeti.serializer module in ganeti-watcher

Reviewed-by: ultrotter

16 years agoReplace custom logging code in watcher with logging module
Michael Hanselmann [Mon, 16 Jun 2008 08:02:27 +0000 (08:02 +0000)]
Replace custom logging code in watcher with logging module

- Log timestamp for all messages
- Write everything to logfile and optionally to stderr
- Log messages are no longer buffered, allowing a user to see progress

Reviewed-by: ultrotter

16 years agoMake sure serialized data ends with EOL character
Michael Hanselmann [Mon, 16 Jun 2008 08:01:51 +0000 (08:01 +0000)]
Make sure serialized data ends with EOL character

Also fix the regular expression to not remove newlines. The simplejson
module puts whitespace at line endings when using indentation. Remove
unnecessary import of ConfigParser module.

Reviewed-by: ultrotter

16 years agoFix an error message in instance add
Iustin Pop [Sun, 15 Jun 2008 05:21:16 +0000 (05:21 +0000)]
Fix an error message in instance add

There is a mistake in the error message generated when we can't reach a
node for checking for available disk space. Without it, the error
message is:
Failure: prerequisites not met for this operation:
Cannot get current information from node '{u'gnte2.lab.k1024.org':
{'cpu_total': 1, 'memory_free': 480, 'vg_size': 131068, 'memory_total':
504, 'bootid': '2176dd3b-2f96-42f0-8b6e-2873ecaf5f9c', 'memory_dom0':
134, 'vg_free': 130172}, u'gnte1.lab.k1024.org': False}'

instead of the expected:
Failure: prerequisites not met for this operation:
Cannot get current information from node 'gnte2.lab.k1024.org'

Reviewed-by: imsnah

16 years agoActivate down instances' disks on replace-disks
Guido Trotter [Sat, 14 Jun 2008 08:34:27 +0000 (08:34 +0000)]
Activate down instances' disks on replace-disks

When replacing disks or evacuating nodes with instances administratively
down ganeti fails because the instance disks are not active. This patch
activates them, performs the replacement, and shuts them down again.
Changing this also fixes the same issue on gnt-node evacuate.

Reviewed-by: iustinp

16 years agoFailoverInstance: change AddInstance with Update
Guido Trotter [Sat, 14 Jun 2008 08:34:10 +0000 (08:34 +0000)]
FailoverInstance: change AddInstance with Update

We're not adding a new instance, just making configuration changes to
the one we're working on.

Reviewed-by: imsnah

16 years agoBurnin: Use iallocator in import/export
Guido Trotter [Sat, 14 Jun 2008 08:33:51 +0000 (08:33 +0000)]
Burnin: Use iallocator in import/export

Currently the iallocator option is ignored by burnin at import/export
time even if passed in. With this patch it becomes used. The log message
used by the importer is also changed to reflect this.

This patch also improves import/export on the non-iallocator case:
  - The secondary node is not passed anymore on non-mirrored templates
  - On mirrored templates the secondary node is logged

Reviewed-by: imsnah

16 years agoFix building of auto-generated rapi docs v1.2.4
Iustin Pop [Fri, 13 Jun 2008 13:16:27 +0000 (13:16 +0000)]
Fix building of auto-generated rapi docs

This is needed for a clean checkout to pass 'make distcheck'

Reviewed-by: imsnah

16 years agoMake final 1.2.4 release
Iustin Pop [Fri, 13 Jun 2008 12:59:25 +0000 (12:59 +0000)]
Make final 1.2.4 release

Reviewed-by: imsnah

16 years agoGaneti version 1.2.4~rc2
Guido Trotter [Wed, 11 Jun 2008 09:58:32 +0000 (09:58 +0000)]
Ganeti version 1.2.4~rc2

Third release candidate for the 1.2.4 release.

Reviewed-by: iustinp

16 years agoGaneti 1.2.4 upgrade hint for existing HVM clusters
Alexander Schreiber [Mon, 9 Jun 2008 12:31:51 +0000 (12:31 +0000)]
Ganeti 1.2.4 upgrade hint for existing HVM clusters

Add an upgrade hint for anybody upgrading existing HVM clusters to Ganeti
1.2.4 to avoid mysteriously non-starting instances after the upgrade.

Reviewed-by: iustinp

16 years agoUse default values for unset HVM instance attributes.
Alexander Schreiber [Mon, 9 Jun 2008 10:01:28 +0000 (10:01 +0000)]
Use default values for unset HVM instance attributes.

This patch is intended reduce the update friction for those who used
HVM with the Ganeti 1.2.3 version. Newly introduced HVM instance flags
will be unset for existing HVM instances after the upgrade. Those unset
flags will be treated as set to the previously hardcoded values where
this makes sense (ACPI and PAE flags).

Reviewed-by: iustinp

16 years agoGaneti version 1.2.4~rc1
Guido Trotter [Tue, 3 Jun 2008 10:42:14 +0000 (10:42 +0000)]
Ganeti version 1.2.4~rc1

Second release candidate for the 1.2.4 stable release.

Reviewed-by: schreiberal

16 years agoAdd check for node memory in instance creation
Iustin Pop [Sat, 31 May 2008 21:59:47 +0000 (21:59 +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 agoFix two problems in QA scripts
Michael Hanselmann [Fri, 30 May 2008 10:55:17 +0000 (10:55 +0000)]
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 agoAdd QA tests for “gnt-instance reboot”
Michael Hanselmann [Fri, 30 May 2008 10:55:03 +0000 (10:55 +0000)]
Add QA tests for “gnt-instance reboot”

Reviewed-by: ultrotter

16 years agoAdd QA test for “gnt-instance replace-disks”
Michael Hanselmann [Fri, 30 May 2008 10:54:43 +0000 (10:54 +0000)]
Add QA test for “gnt-instance replace-disks”

Reviewed-by: iustinp

16 years agoLURemoveInstance: fix op.ignore_failures usage
Iustin Pop [Fri, 30 May 2008 10:51:22 +0000 (10:51 +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 agoFix exception handling for lock timeout in RAPI
Oleksiy Mishchenko [Fri, 30 May 2008 09:56:58 +0000 (09:56 +0000)]
Fix exception handling for lock timeout in RAPI

16 years agoFix typo in rapi docstring
Michael Hanselmann [Fri, 30 May 2008 08:18:40 +0000 (08:18 +0000)]
Fix typo in rapi docstring

Reviewed-by: amishchenko

16 years agoRAPI Docstrings update.
Oleksiy Mishchenko [Thu, 29 May 2008 16:39:10 +0000 (16:39 +0000)]
RAPI Docstrings update.

Reviewed-by: imsnah

16 years agoUpdate gnt-instance and gnt-backup manpages
Michael Hanselmann [Thu, 29 May 2008 13:25:52 +0000 (13:25 +0000)]
Update gnt-instance and gnt-backup manpages

- Add --iallocator options
- Small text fixes

Reviewed-by: ultrotter

16 years agoAdd manpage for ganeti-rapi daemon
Michael Hanselmann [Thu, 29 May 2008 12:05:21 +0000 (12:05 +0000)]
Add manpage for ganeti-rapi daemon

Reviewed-by: iustinp

16 years agoFix wrong filename in ganeti-watcher manpage
Michael Hanselmann [Thu, 29 May 2008 12:05:03 +0000 (12:05 +0000)]
Fix wrong filename in ganeti-watcher manpage

Reviewed-by: iustinp

16 years agoStrip unnecessary whitespace from docstrings in remote API doc
Michael Hanselmann [Thu, 29 May 2008 12:04:50 +0000 (12:04 +0000)]
Strip unnecessary whitespace from docstrings in remote API doc

Also apply cgi.escape to all strings.

Reviewed-by: ultrotter

16 years agoImprove remote API QA tests
Michael Hanselmann [Thu, 29 May 2008 12:04:34 +0000 (12:04 +0000)]
Improve remote API QA tests

- Fix /nodes check; it broke when there was more than one node
- Add simple checks on information returned by /info
- Test instance info (/instances/$name)
- Test node info (/nodes/$name)

Reviewed-by: amishchenko

16 years agoAdd remote API QA tests to sample config file
Michael Hanselmann [Thu, 29 May 2008 12:04:16 +0000 (12:04 +0000)]
Add remote API QA tests to sample config file

Reviewed-by: ultrotter

16 years agoAdd simple QA tests for remote API
Michael Hanselmann [Wed, 28 May 2008 14:45:54 +0000 (14:45 +0000)]
Add simple QA tests for remote API

/nodes and /instances are only partially tested.

Reviewed-by: amishchenko

16 years agoPrepare tags QA tests to add calls into remote API tests
Michael Hanselmann [Wed, 28 May 2008 14:45:38 +0000 (14:45 +0000)]
Prepare tags QA tests to add calls into remote API tests

Reviewed-by: amishchenko

16 years agoSmall codestyle fixes for dumb-allocator
Michael Hanselmann [Wed, 28 May 2008 11:59:58 +0000 (11:59 +0000)]
Small codestyle fixes for dumb-allocator

Reviewed-by: iustinp

16 years agoFix "missing parameter" error and pass correct kind for instance tags
Michael Hanselmann [Mon, 26 May 2008 14:27:20 +0000 (14:27 +0000)]
Fix "missing parameter" error and pass correct kind for instance tags

Reviewed-by: ultrotter

16 years agoDisable twisted signal handlers for remote API daemon
Michael Hanselmann [Mon, 26 May 2008 14:27:06 +0000 (14:27 +0000)]
Disable twisted signal handlers for remote API daemon

Otherwise we can't exit the daemon in a clean way by sending a signal.

Reviewed-by: iustinp

16 years agoRemove print statement from cmdlib
Michael Hanselmann [Mon, 26 May 2008 12:24:04 +0000 (12:24 +0000)]
Remove print statement from cmdlib

Seems to be some debug code left over.

Reviewed-by: ultrotter

16 years agoRemove output file if docbook failed
Michael Hanselmann [Sat, 24 May 2008 20:48:06 +0000 (20:48 +0000)]
Remove output file if docbook failed

Reviewed-by: ultrotter

16 years agoAdd documentation for remote API
Michael Hanselmann [Sat, 24 May 2008 20:47:52 +0000 (20:47 +0000)]
Add documentation for remote API

- Introduction and examples
- Update docstrings in resources.py
- Script to automatically generate documentation from resources.py

Reviewed-by: ultrotter

16 years agoDistribute dumb-allocator in examples
Guido Trotter [Sat, 24 May 2008 08:53:39 +0000 (08:53 +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 agoGaneti version 1.2.4~rc0
Guido Trotter [Thu, 22 May 2008 10:40:17 +0000 (10:40 +0000)]
Ganeti version 1.2.4~rc0

Make a release candidate version of 1.2.4, since it contains enough
changes that we want to be sure before declaring it stable.

Reviewed-by: schreiberal

16 years agoAdd more 1.2.4 information in NEWS
Guido Trotter [Thu, 22 May 2008 10:40:05 +0000 (10:40 +0000)]
Add more 1.2.4 information in NEWS

This is the result of what I remember about all the changes that went
throgh, plus scrubbing through all the 1.2.4 commit messages for
user-visible changes in 1.2.4, and merging some suggestions from
Alexander.

Reviewed-by: schreiberal

16 years agoFix remote API unittests
Michael Hanselmann [Wed, 21 May 2008 16:04:59 +0000 (16:04 +0000)]
Fix remote API unittests

Reviewed-by: ultrotter

16 years agoUse a single function for all tag fetching resources
Michael Hanselmann [Wed, 21 May 2008 16:04:45 +0000 (16:04 +0000)]
Use a single function for all tag fetching resources

Reviewed-by: ultrotter

16 years agoUse PEP-318 decorator to acquire locks in remote API code
Michael Hanselmann [Wed, 21 May 2008 16:04:27 +0000 (16:04 +0000)]
Use PEP-318 decorator to acquire locks in remote API code

Reviewed-by: ultrotter

16 years agoImplement better error handling in remote API
Michael Hanselmann [Wed, 21 May 2008 16:04:09 +0000 (16:04 +0000)]
Implement better error handling in remote API

- Add dedicated file for HTTP exceptions
- Use ganeti.serializer instead of simplejson directly
- Throw exceptions instead of setting variables or returning None
  for errors
- Rename "_get" method to "GET" to correspond with HTTP protocol
- Move most code of R_generic to handler class, simplifying control flow

Reviewed-by: ultrotter

16 years agoAlias Dump/Load functions in ganeti.serializer to DumpJson/LoadJson
Michael Hanselmann [Wed, 21 May 2008 16:03:47 +0000 (16:03 +0000)]
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 agoRemove authorization code from remote API
Michael Hanselmann [Wed, 21 May 2008 15:20:22 +0000 (15:20 +0000)]
Remove authorization code from remote API

It's not yet implemented anyway.

Reviewed-by: amishchenko, ultrotter

16 years agoAdd /version resource to remote API
Michael Hanselmann [Wed, 21 May 2008 15:20:08 +0000 (15:20 +0000)]
Add /version resource to remote API

This returns the remote API version implemented and allows clients
to adjust accordingly.

Reviewed-by: amishchenko, ultrotter

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