ganeti-local
15 years agoSmall 1.2.6 fixes
Guido Trotter [Tue, 2 Sep 2008 15:39:01 +0000 (15:39 +0000)]
Small 1.2.6 fixes

Found going through the 1.2.5/1.2.6~rc0 diff
  - Remove a slipped empty line
  - Change if statement to be more direct (nested if, rather than
    if...pass...elif)

Reviewed-by: iustinp

15 years agoChange version for rc0 release of ganeti 1.2.6
Guido Trotter [Tue, 2 Sep 2008 11:45:39 +0000 (11:45 +0000)]
Change version for rc0 release of ganeti 1.2.6

Reviewed-by: iustinp

15 years agoImport internal batcher tool
Iustin Pop [Mon, 1 Sep 2008 09:21:51 +0000 (09:21 +0000)]
Import internal batcher tool

This patch adds a slightly modified version of the internal ‘batcher’
tool by Tim Boring. It still has some small usability issues, but it can
be used for 'bulk' instance creation.

The tool will be installed under the 'tools' directory and its
associated README under the doc directory.

Author: Tim Boring <tjboring@gmail.com>
Reviewed-by: imsnah

15 years agoTiny doc typo fix
Alexander Schreiber [Fri, 29 Aug 2008 14:41:08 +0000 (14:41 +0000)]
Tiny doc typo fix

Reviewed-by: ultrotter

15 years agoChange gnt-instance reinstall --interactive to --select-os
Alexander Schreiber [Thu, 28 Aug 2008 15:29:25 +0000 (15:29 +0000)]
Change gnt-instance reinstall --interactive to --select-os

Reviewed-by: ultrotter

15 years agoExport all instance fields in RAPI
Iustin Pop [Thu, 28 Aug 2008 15:22:47 +0000 (15:22 +0000)]
Export all instance fields in RAPI

This just adds the newly added field to LUQueryInstances into the RAPI
instance queries.

Reviewed-by: imsnah

15 years agoSmall typos in the gnt-instance man page
Iustin Pop [Thu, 28 Aug 2008 13:52:44 +0000 (13:52 +0000)]
Small typos in the gnt-instance man page

Reviewed-by: imsnah

15 years agoAllow instance info to only query the config file
Iustin Pop [Thu, 28 Aug 2008 13:52:36 +0000 (13:52 +0000)]
Allow instance info to only query the config file

This patch adds a new '-s' parameter to ‘gnt-instance info’ that makes
it return only 'static' information. This is much faster, especially for
drbd instances.

Reviewed-by: imsnah

15 years agoImplement more options for “gnt-backup import”
Michael Hanselmann [Thu, 28 Aug 2008 13:49:58 +0000 (13:49 +0000)]
Implement more options for “gnt-backup import”

HVM options were missing.

Reviewed-by: iustinp

15 years agoAdd more fields to “gnt-instance list”
Michael Hanselmann [Thu, 28 Aug 2008 13:49:47 +0000 (13:49 +0000)]
Add more fields to “gnt-instance list”

Reviewed-by: iustinp

15 years agoFix auto_balance and memory modification
Iustin Pop [Thu, 28 Aug 2008 11:24:41 +0000 (11:24 +0000)]
Fix auto_balance and memory modification

The secondary nodes should not be checked for free memory in case of non
auto-balanced instances.

Reviewed-by: ultrotter

15 years agoInclude qa_rapi in distribution
Michael Hanselmann [Thu, 28 Aug 2008 10:26:51 +0000 (10:26 +0000)]
Include qa_rapi in distribution

It was missing.

Reviewed-by: ultrotter, amishchenko

15 years agoUpdate command line help for instance list
Iustin Pop [Thu, 28 Aug 2008 08:50:45 +0000 (08:50 +0000)]
Update command line help for instance list

Reviewed-by: ultrotter

15 years agoDocumentation for auto_balance
Iustin Pop [Thu, 28 Aug 2008 08:50:36 +0000 (08:50 +0000)]
Documentation for auto_balance

The man pages for gnt-instance and gnt-backup are updated with this
parameter.

Reviewed-by: ultrotter

15 years agoUse the auto_balance in cluster verify
Iustin Pop [Thu, 28 Aug 2008 08:50:25 +0000 (08:50 +0000)]
Use the auto_balance in cluster verify

This patch changes the cluster verify in two ways:
  - do not use instances marked with auto_balance=False in N+1 memory
    checks
  - report, if any, the number of instances with auto_balance=False

Reviewed-by: imsnah

15 years agoQuery/manipulation of the auto_balance attribute
Iustin Pop [Thu, 28 Aug 2008 08:50:15 +0000 (08:50 +0000)]
Query/manipulation of the auto_balance attribute

This patch allows:
  - setting of the auto_balance parameter in the instance creation and
    import
  - modification later via gnt-instance modify
  - listing it via gnt-instance list
  - printing it in gnt-instance info

Reviewed-by: ultrotter

15 years agoAdd a new auto_balance parameters to instances
Iustin Pop [Thu, 28 Aug 2008 08:50:03 +0000 (08:50 +0000)]
Add a new auto_balance parameters to instances

This new parameters will be initialized to true if it's missing from the
config file.

Reviewed-by: ultrotter

15 years agoCheck memory size before setting it
Guido Trotter [Wed, 27 Aug 2008 11:25:56 +0000 (11:25 +0000)]
Check memory size before setting it

With this change when a user asks for a new memory size for an instance,
the number is checked instead of just applied. The operation fails only
if the instance would not be able to restart on its primary node, but
generates warnings should it be impossible to failover the instance or
should the computation be impossible due to nodes being unreachable.

Reviewed-by: iustinp

15 years agoPass the force param to SetInstanceParms
Guido Trotter [Wed, 27 Aug 2008 11:25:32 +0000 (11:25 +0000)]
Pass the force param to SetInstanceParms

It was already allowed in gnt-instance modify, but ignored.
It will be used to force skipping parameter checks.

Reviewed-by: imsnah

15 years agoFix wrong wording of instance rename error message.
Alexander Schreiber [Tue, 26 Aug 2008 12:27:04 +0000 (12:27 +0000)]
Fix wrong wording of instance rename error message.

Reviewed-by: imsnah

15 years agoDocument behaviour of gnt-instance console for HVM
Alexander Schreiber [Tue, 26 Aug 2008 11:53:08 +0000 (11:53 +0000)]
Document behaviour of gnt-instance console for HVM

Reviewed-by: imsnah

15 years agoWork around a DRBD sync speed race condition
Michael Hanselmann [Mon, 25 Aug 2008 12:32:00 +0000 (12:32 +0000)]
Work around a DRBD sync speed race condition

When DRBD is doing its dance to establish a connection with its
peer, it also sends the synchronization speed over the wire. In
some cases setting the sync speed only after setting up both
sides can race with DRBD connecting, hence we set it here before
telling DRBD anything about its peer.

Reviewed-by: iustinp

15 years agoDocument gnt-instance reinstall --interactive
Alexander Schreiber [Mon, 25 Aug 2008 09:27:14 +0000 (09:27 +0000)]
Document gnt-instance reinstall --interactive

Reviewed-by: ultrotter

15 years agoImplement interactive gnt-instance reinstall
Alexander Schreiber [Fri, 22 Aug 2008 16:26:09 +0000 (16:26 +0000)]
Implement interactive gnt-instance reinstall

Reviewed-by: ultrotter

15 years agomore information for VNC console port
Alexander Schreiber [Fri, 22 Aug 2008 12:00:59 +0000 (12:00 +0000)]
more information for VNC console port

This patch extends the gnt-instance info again. If vnc_bind_address is
set to 127.0.0.1 then the 'VNC console port' line will also print the
nodename on which to connect to localhost.

While this duplicates info from the Node:primary output, it should make
it simpler for scripts that look for VNC console port information.

Reviewed-by: ultrotter

15 years agoAllow access to HVM serial console
Alexander Schreiber [Fri, 22 Aug 2008 09:58:04 +0000 (09:58 +0000)]
Allow access to HVM serial console

This patch changes the behaviour of gnt-instance console for HVM instances.
Now the warning message directing the user to VNC (stating the necessary
host:port pair) is no longer printed but instead access to the serial
console of the instance is attempted. The VNC console access information
can now be found via gnt-instance info (requires previous patch 37e41abdeb
"Display VNC console port in gnt-instance info").

Reviewed-by: imsnah

15 years agoDisplay VNC console port in gnt-instance info.
Alexander Schreiber [Fri, 22 Aug 2008 09:50:27 +0000 (09:50 +0000)]
Display VNC console port in gnt-instance info.

This patch shows the host:port pair needed to access the console of an
HVM instance as part of the gnt-instance info output. It is a precondition
for allowing serial console access to HVM instances.

Reviewed-by: imsnah

15 years agoCheck HVM device type on instance modify as well.
Alexander Schreiber [Fri, 22 Aug 2008 08:18:46 +0000 (08:18 +0000)]
Check HVM device type on instance modify as well.

Reviewed-by: ultrotter

15 years agoAdd HVM device type flags 3/4
Alexander Schreiber [Thu, 21 Aug 2008 16:07:28 +0000 (16:07 +0000)]
Add HVM device type flags 3/4

This patch adds the frontend handling (gnt-instance command) for
the HVM device type patchset.

Reviewed-by: ultrotter

15 years agoAdd HVM device type flags 2/4
Alexander Schreiber [Thu, 21 Aug 2008 16:03:31 +0000 (16:03 +0000)]
Add HVM device type flags 2/4

This patch adds the backend support for the HVM device flags.

Reviewed-by: ultrotter

15 years agoAdd HVM device type flags 1/4
Alexander Schreiber [Thu, 21 Aug 2008 15:27:14 +0000 (15:27 +0000)]
Add HVM device type flags 1/4

This patch adds the constants and instance object additions.

Reviewed-by: ultrotter

15 years agoAdd HVM device type flag 4/4
Alexander Schreiber [Thu, 21 Aug 2008 15:03:16 +0000 (15:03 +0000)]
Add HVM device type flag 4/4

And finally, document the new flags.

Reviewed-by: ultrotter

15 years agoConvert RunCmd to an epydoc docstring
Guido Trotter [Wed, 13 Aug 2008 15:00:47 +0000 (15:00 +0000)]
Convert RunCmd to an epydoc docstring

Reviewed-by: imsnah

15 years agoFakeHypervisor: fix a function signature
Guido Trotter [Wed, 13 Aug 2008 15:00:24 +0000 (15:00 +0000)]
FakeHypervisor: fix a function signature

StartInstance takes 'block_devices', not 'force' as its third argument.
Even if this is not used in the fake hypervisor it's better to have the
correct argument name to avoid confusion.

Reviewed-by: imsnah

15 years agoremove two end-of-line semicolons
Alexander Schreiber [Tue, 5 Aug 2008 16:04:17 +0000 (16:04 +0000)]
remove two end-of-line semicolons

Reviewed-by: imsnah

15 years agoAnother typo in the install doc
Iustin Pop [Mon, 4 Aug 2008 09:10:29 +0000 (09:10 +0000)]
Another typo in the install doc

Reviewed-by: imsnah

15 years agoUpdate the module build section of install doc
Iustin Pop [Mon, 4 Aug 2008 09:10:05 +0000 (09:10 +0000)]
Update the module build section of install doc

Reviewed-by: imsnah

15 years agoFix a typo in the install doc
Iustin Pop [Mon, 4 Aug 2008 09:09:44 +0000 (09:09 +0000)]
Fix a typo in the install doc

Reviewed-by: imsnah

15 years agoMake the 1.2.5 release v1.2.5
Iustin Pop [Tue, 22 Jul 2008 09:22:48 +0000 (09:22 +0000)]
Make the 1.2.5 release

Reviewed-by: imsnah

16 years agoFix LUReplaceDisks with iallocator
Guido Trotter [Fri, 18 Jul 2008 10:30:39 +0000 (10:30 +0000)]
Fix LUReplaceDisks with iallocator

self._RunAllocator() sets self.op.remote_node, but doesn't return the
new remote node. If we set it to the return value of the function we
basically reset it to None, and iallocator is never run.

Reviewed-by: imsnah

16 years agoBump version to 1.2.5~rc2
Iustin Pop [Mon, 14 Jul 2008 13:53:31 +0000 (13:53 +0000)]
Bump version to 1.2.5~rc2

Since we had some more code changes, let's make another rc.

Reviewed-by: ultrotter

16 years agoFix backend.NodeVolumes handling of LVM output
Iustin Pop [Fri, 11 Jul 2008 13:53:50 +0000 (13:53 +0000)]
Fix backend.NodeVolumes handling of LVM output

This is the same fix as for GetVolumeList.

I've checked manually and all other places that call lvm commands are
already checking the output validity in terms of correct number of
fields.

Reviewed-by: ultrotter

16 years agoInclude process ID in the watcher logs
Iustin Pop [Fri, 11 Jul 2008 13:09:11 +0000 (13:09 +0000)]
Include process ID in the watcher logs

Since the watcher is launched by cron, and we can have the situation of
two processes running at the same time (the lock will prevent problems),
we need to have the pid in the log so that it's clear which messages
come from which program.

Reviewed-by: imsnah

16 years agoFix backend.GetVolumeList handling of LVM output
Iustin Pop [Fri, 11 Jul 2008 13:09:03 +0000 (13:09 +0000)]
Fix backend.GetVolumeList handling of LVM output

This patch is fix for the case when ‘lvs’ spits out error messages on
stdout. It's just a simple check that we have the needed number of
separators in the line.

Reviewed-by: imsnah

16 years agodoc fix: Describe default values for HVM instance options & cleanup.
Alexander Schreiber [Tue, 8 Jul 2008 17:57:58 +0000 (17:57 +0000)]
doc fix: Describe default values for HVM instance options & cleanup.

Describes the default values used for the HVM instance options when
creating HVM instances and cleans up the HVm specifics of the HVM cluster
init.

Reviewed-by: iustinp

16 years agoClarify cluster IP requirement.
Alexander Schreiber [Tue, 8 Jul 2008 17:27:02 +0000 (17:27 +0000)]
Clarify cluster IP requirement.

Reviewed-by: iustinp

16 years agoFix some style issues in rapi
Iustin Pop [Tue, 8 Jul 2008 08:56:05 +0000 (08:56 +0000)]
Fix some style issues in rapi

This patch add a properly commented __init__.py from the lib directory
and removes the shebang from the other modules, per the rest of the
code.

Reviewed-by: amishchenko

16 years agoBump version to 1.2.5~rc1
Iustin Pop [Mon, 7 Jul 2008 11:51:40 +0000 (11:51 +0000)]
Bump version to 1.2.5~rc1

Reviewed-by: amishchenko

16 years agoUpdate news file for 1.2.5
Iustin Pop [Mon, 7 Jul 2008 11:51:32 +0000 (11:51 +0000)]
Update news file for 1.2.5

Reviewed-by: imsnah

16 years agoFix compatibility with twisted 8.x
Iustin Pop [Mon, 7 Jul 2008 08:00:10 +0000 (08:00 +0000)]
Fix compatibility with twisted 8.x

After much investigation, I realized that our old method of restarting
the reactor will not work easily (if at all) with twisted 8.x. So the
logical consequence is that we must not restart the reactor, but instead
create one fully anew.

Since twisted doesn't allow one to re-install a new reactor, we just
pretend there was no reactor ever installed; this works as the old
reactor was (or should have been, as otherwise we wouldn't have returned
from the reactor.run() call in Client.run()) already stopped and since
we delete it, no other references to it should exist and it should be
cleared away.

The actual implementation is as follows:
  - we remove the ReReactor class, as we don't need it, as instead we
    use a standard PollReactor
  - at each rpc.Client creation, we:
    - delete the twisted.internet.reactor from the list of loaded
      modules
    - create a new PollReactor()
    - replace the twisted main reactor with it
  - we move the use of the install_twisted_signal_handlers from the
    ReReactor class to the Client.run() function

The deletion from sys.modules is needed to skip twisted checks and
should be safe (per the python documentation of sys.modules:
"sys.modules... can be manipulated to force reloading of modules and
other tricks").

The patch has been tested and passes burnin on both debian stable
(twisted 2.4.0) and unstable (twisted 8.1.0).

Reviewed-by: imsnah

16 years agoQA for instance migration.
Oleksiy Mishchenko [Mon, 7 Jul 2008 07:13:59 +0000 (07:13 +0000)]
QA for instance migration.

Reviewed-by: imsnah

16 years agoFix some issues with the watcher
Iustin Pop [Fri, 4 Jul 2008 15:58:19 +0000 (15:58 +0000)]
Fix some issues with the watcher

This patch fixes two bugs:
  - the state file is not saved because we use the method for checking
    for udpated data
  - in two places 'Error' was used instead of 'Exception', which breaks
    error handling

Additionally:
  - the unused 're' import has been removed
  - a variable named 'id' which collides with a builtin function has
    been renamed

Note that comparing the serialized forms might create false negatives
(due to the dicts being reordered) but that will just cause an extra
write of the file, which is sub-optimal but harmless.

Reviewed-by: ultrotter

16 years agoFix error handling in _CheckNodeFreeMemory
Iustin Pop [Fri, 4 Jul 2008 12:01:31 +0000 (12:01 +0000)]
Fix error handling in _CheckNodeFreeMemory

If the remote node is down, the rpc layer will return 'False' for the
node result, and not a dict.

The patch adds extra checks that we have the node and that its result is
a dict.

Reviewed-by: imsnah

16 years agoSet locale when building manpages
Michael Hanselmann [Tue, 1 Jul 2008 12:17:45 +0000 (12:17 +0000)]
Set locale when building manpages

docbook2man includes the date in the current locale into
the output document. Therefore we need to use the "C"
locale.

Reviewed-by: iustinp

16 years agoDocument additional options in manpages
Michael Hanselmann [Tue, 1 Jul 2008 12:17:33 +0000 (12:17 +0000)]
Document additional options in manpages

Reviewed-by: iustinp

16 years agoGaneti version 1.2.5~rc0
Iustin Pop [Tue, 1 Jul 2008 08:00:30 +0000 (08:00 +0000)]
Ganeti version 1.2.5~rc0

Let's a release candidate, the only other needed things will be
non-functional changes (QA and some documentation updates).

Reviewed-by: imsnah

16 years agoFurther increase the migration delays
Iustin Pop [Tue, 1 Jul 2008 07:54:57 +0000 (07:54 +0000)]
Further increase the migration delays

More testing shows that an even bigger timeout is better and allows many
more migrations before xen breaks.

Reviewed-by: imsnah

16 years agoQA parameter for grow-disk size
Oleksiy Mishchenko [Fri, 27 Jun 2008 16:04:08 +0000 (16:04 +0000)]
QA parameter for grow-disk size

Reviewed-by: iustinp

16 years agoInstance migration: add delays around migration
Iustin Pop [Fri, 27 Jun 2008 14:02:58 +0000 (14:02 +0000)]
Instance migration: add delays around migration

It seems that xen can have issues that are triggered by too fast
migrations. For now, until we have more experience with it, we should
add some delays before/after the migration call so that things have
enough time to settle down (e.g. hot plug scripts, etc.).

Note that I don't have solid data that this will fix it, or that indeed
xen is the culprit, but for now this seems the simplest way to try to
mitigate it.

Reviewed-by: ultrotter

16 years agoFix burnin for migration cleanup
Iustin Pop [Fri, 27 Jun 2008 13:46:21 +0000 (13:46 +0000)]
Fix burnin for migration cleanup

I forgot again to add the cleanup parameter to the burnin. This patch
adds it and also runs migration cleanup for the instances.

Reviewed-by: imsnah

16 years agoQA for gnt-instance disk-grow option.
Oleksiy Mishchenko [Fri, 27 Jun 2008 13:19:02 +0000 (13:19 +0000)]
QA for gnt-instance disk-grow option.

Reviewed-by: imsnah

16 years agoChange fping to TcpPing in two LUs
Guido Trotter [Fri, 27 Jun 2008 12:07:49 +0000 (12:07 +0000)]
Change fping to TcpPing in two LUs

Two LUs are using RunCmd to call fping, in order to check for an IP
presence on the network. Substituting it with TcpPing will get rid of
it, which makes it not break in the new world order, where the master
cannot fork.

Reviewed-by: iustinp

16 years agoImplement cleanup for broken instance migration
Iustin Pop [Fri, 27 Jun 2008 09:14:00 +0000 (09:14 +0000)]
Implement cleanup for broken instance migration

The patch adds a new option for the “gnt-instance migrate” called
‘--cleanup’ that makes this command to perform a recovery from a
(possibly) failed migration instead of actually migrating the instance.

The cleanup checks that the instance runs on the correct node (or
update the config if not), and makes sure the disks are in single-master
mode by reconfiguring the drbd devices.

The patch also fixes a wrong description in an error message for the
migration prerequisite checks.

Reviewed-by: ultrotter

16 years agoRework the migration implementation
Iustin Pop [Thu, 26 Jun 2008 15:03:02 +0000 (15:03 +0000)]
Rework the migration implementation

The current migration code has many issues related to the
synchronization between nodes in the drbd network reconfiguration part.
As such, a new algorithm is implemented that uses the master as a
synchronization point, and implementing a cache of bdevs in the backend
to allow the rpc to resume from the previous state.

The code also splits the LU code in a few methods, so that we can reuse
it better when we implement the ‘--recover’ flag.

Reviewed-by: ultrotter

16 years agoImprove some corner cases in instance migration
Iustin Pop [Thu, 26 Jun 2008 10:32:45 +0000 (10:32 +0000)]
Improve some corner cases in instance migration

Since the backend.DrbdReconfigNet function is called from the rpc layer,
it's better not to raise exception but to return a meaningful error
message.

The patch adds two try.. except blocks around the ReAttachNet() calls
which are the ones which most often return errors (among the few errors
that we have for now).

The patch also adds two SetDiskID calls in cmdlib's LUMigrateInstance
before the change-to-secondary which are needed depending on what is
saved in the config file.

Reviewed-by: ultrotter

16 years agoAdd an instance_migratable rpc call
Guido Trotter [Wed, 25 Jun 2008 08:14:41 +0000 (08:14 +0000)]
Add an instance_migratable rpc call

This call will check whether an instance is up on its primary, and that
it has been started with symlinks. We currently have no on-secondary
checks, nor any hypervisor specific call.

Reviewed-by: iustinp

16 years agobackend: improve MigrateInstance docstring
Guido Trotter [Wed, 25 Jun 2008 08:14:27 +0000 (08:14 +0000)]
backend: improve MigrateInstance docstring

Document the arguments accepted by backend.MigrateInstance

Reviewed-by: iustinp

16 years agobackend: Fix a few instance related docstrings
Guido Trotter [Wed, 25 Jun 2008 08:14:17 +0000 (08:14 +0000)]
backend: Fix a few instance related docstrings

{Start,Shutdown,Reboot}Instance take instance objects, not names.

Reviewed-by: iustinp

16 years agoOnly burnin migrate with drbd8
Guido Trotter [Wed, 25 Jun 2008 08:14:08 +0000 (08:14 +0000)]
Only burnin migrate with drbd8

Currently burnin would try (and fail) with remote_raid1 as well.

Reviewed-by: iustinp

16 years agoAdd gnt-node migrate
Guido Trotter [Wed, 25 Jun 2008 08:13:57 +0000 (08:13 +0000)]
Add gnt-node migrate

This is the same as gnt-node failover, and is also a cut&paste of its
code (almost). It will be really really useful to quickly empty a
healthy node. I can be persuaded to merge MigrateNode and FailoverNode
in a common codebase, but could also forget about it and submit it if
nobody cares.

Reviewed-by: iustinp

16 years agoCleanup LV status computation
Iustin Pop [Wed, 25 Jun 2008 06:45:52 +0000 (06:45 +0000)]
Cleanup LV status computation

Currently, when seeing if a LV is degraded or not (i.e. virtual volume),
we first attach to the device (which does an lvdisplay), then do a lvs
in order to display the lv_attr. This generates two external commands to
do (almost) the same thing.

This patch changes the Attach() method for LVs to call lvs and display
both the major/minor (needed for attach) and the lv_status (needed for
GetSyncStatus). Thus, later in GetSyncStatus, we don't need to run lvs
again, and instead just return the value computed in Attach().

Reviewed-by: imsnah

16 years agoAdd Instances/Nodes List/Bulk QA for RAPI
Oleksiy Mishchenko [Tue, 24 Jun 2008 18:19:56 +0000 (18:19 +0000)]
Add Instances/Nodes List/Bulk QA for RAPI

Revieved-by: imsnah

16 years agobackend: Remove symlinks by disk name, not using a wildcard
Michael Hanselmann [Tue, 24 Jun 2008 14:30:44 +0000 (14:30 +0000)]
backend: Remove symlinks by disk name, not using a wildcard

Reviewed-by: ultrotter

16 years agogrow-disk: wait until resync is completed
Iustin Pop [Tue, 24 Jun 2008 14:29:18 +0000 (14:29 +0000)]
grow-disk: wait until resync is completed

The patch adds a new ‘--no-wait-for-sync’ parameter to grow-disk similar
to the one in instance add, and changes the default to wait.

This is cleaner as at the moment when the command returns, we either
have a fully synced disk or there is an error.

Reviewed-by: ultrotter

16 years agoBurnin OpMigrateInstance
Guido Trotter [Tue, 24 Jun 2008 12:16:22 +0000 (12:16 +0000)]
Burnin OpMigrateInstance

If the new --no-migrate flag is not passed live migrate all the
instances to their secondary nodes.

Reviewed-by: iustinp

16 years agoBurnin OpGrowDisk
Guido Trotter [Tue, 24 Jun 2008 12:16:07 +0000 (12:16 +0000)]
Burnin OpGrowDisk

With this patch both the os and the swap disk are grown during
burnin. You can pass an increase size of 0 to skip this operation.

Reviewed-by: iustinp

16 years agogrow-disk: refuse to start if the disk is degraded
Iustin Pop [Tue, 24 Jun 2008 11:51:03 +0000 (11:51 +0000)]
grow-disk: refuse to start if the disk is degraded

DRBD refuses to grow the disk if it's not fully synch-ed, for example
it's still processing the result of a previous grow. As such, it's
better to prevent any operation unless all nodes look good.

The patch also adds a simple check for amount > 0.

Reviewed-by: imsnah

16 years agoFix gnt-instance(8) grow-disk example wording
Guido Trotter [Tue, 24 Jun 2008 11:37:09 +0000 (11:37 +0000)]
Fix gnt-instance(8) grow-disk example wording

Improve a bit the grow-disk manpage example wording making it clearer
that "amount" is the difference, not the new disk size.

Reviewed-by: iustinp

16 years agoEnable TCP keep-alives in the twisted rpc client
Iustin Pop [Tue, 24 Jun 2008 10:44:44 +0000 (10:44 +0000)]
Enable TCP keep-alives in the twisted rpc client

Since a dead node will not be detected (in our current implementation)
by the twisted rpc layer, we should enable TCP-level keepalives in order
to at least detect TCP-level problems.

This patch changes the rpc.NodeController class to enable TCP-keepalives
before doing the remote call (so a failure in the connect/login sequence
will not be protected by this, but there twisted - if I understood
correctly - has its own timeouts).

We should always have a TCP-based transport under our object broker, but
I think it's better to check first for support of the setTcpKeepAlive
function and only if it's available call it.

Note that the interval and keepalive behaviour must be tuned at kernel
level (sysctls net.ipv4.tcp_keepalive_* in Linux) and cannot be tuned
from within our code.

Reviewed-by: imsnah

16 years agoxen: remove the config file after migration
Iustin Pop [Tue, 24 Jun 2008 09:46:35 +0000 (09:46 +0000)]
xen: remove the config file after migration

Since it's not good to have the instance definition file left on the
source one if the migration succeeded, we remove it after the ‘xm
migrate’ call.

In order to do this using the existing self._RemoveConfigFile, we change
the protocol for this method to take the instance name and not instance
object as parameter, as in the migration we don't have the instance
object (and the only other caller is cheap to modify).

Reviewed-by: imsnah

16 years agoFix copy/paste error in RAPI comments
Oleksiy Mishchenko [Tue, 24 Jun 2008 08:30:07 +0000 (08:30 +0000)]
Fix copy/paste error in RAPI comments

Revieved-by: imsnah

16 years agoAdd a tool for cleaning up clusters
Iustin Pop [Tue, 24 Jun 2008 05:17:25 +0000 (05:17 +0000)]
Add a tool for cleaning up clusters

This tool (that is not installed, just available in the source tree)
helps with cleaning up clusters to a (as much as possible) pristine
state. This helps in preparing for QA runs. By cleaning I mean removing
all instances, logical volumes, nodes, etc. - so this will cause
complete data-loss if it's run on a normal cluster.

Limitations: it only deals with drbd8 and not md (if any md devices are
in use which use drbd devices, they will not be cleaned up). Also the
logic behind the cleaning up is not bulet-proof.

Reviewed-by: ultrotter

16 years agoProvide bulk nodes and instances info
Oleksiy Mishchenko [Mon, 23 Jun 2008 14:23:00 +0000 (14:23 +0000)]
Provide bulk nodes and instances info

Add tags data to node/instance queries.

Reviewed-by: imsnah

16 years agoUpdate man pages with migration information
Iustin Pop [Mon, 23 Jun 2008 14:09:23 +0000 (14:09 +0000)]
Update man pages with migration information

The patch adds the new ‘migrate’ subcommand to the gnt-instance man
page. Some details about the limitations are also given.

Reviewed-by: imsnah

16 years agoLive migration implementation in gnt-instance
Iustin Pop [Mon, 23 Jun 2008 14:09:12 +0000 (14:09 +0000)]
Live migration implementation in gnt-instance

This patch adds the subcommand ‘gnt-instance migrate’.

Reviewed-by: imsnah

16 years agoAdd live failover implementation at LU level
Iustin Pop [Mon, 23 Jun 2008 14:05:55 +0000 (14:05 +0000)]
Add live failover implementation at LU level

This patch adds the OpCode and the LU to implement live migration.
Together with the recent symlink changes, this should allow live
migration.

Reviewed-by: imsnah

16 years agoAdd a rpc call for drbd network reconfiguration
Iustin Pop [Mon, 23 Jun 2008 14:04:16 +0000 (14:04 +0000)]
Add a rpc call for drbd network reconfiguration

This patch adds a rpc call and backend.py implementation over the
low-level bdev.DRBD8.ReAttachNet() call.

The rpc call and reconfiguration is done in such a way that it needs to
be called to two nodes in parallel, and will wait (with one minute
timeout) until the two nodes are reconnected with the new configuration.
Note that this means that if the rpc calls cannot be launched in
parallel to the two nodes, this call will fail.

The patch also adds an extra attribute to the bdev.DRBD8Status class,
and changes the blockdev_close rpc to also pass the instance name to
backend.CloseBlockDevices(), in order to cleanup the symlinks (which are
create in the DrbdReconfigNet function).

Reviewed-by: imsnah

16 years agoImplement network reconfiguration for drbd8
Iustin Pop [Mon, 23 Jun 2008 14:01:03 +0000 (14:01 +0000)]
Implement network reconfiguration for drbd8

This patch implements a simple network reconfiguration method for DRBD8
devices: it currently only allows changing of the multi-master flag.

The method can only be called when the device is attached, and it will
not work for (primary and diskless) devices, as then the shutdown will
fail; the consistency needs to be checked before attempting the
reconfiguration.

Reviewed-by: imsnah

16 years agoFix the _RemoveBlockDevLinks() function
Iustin Pop [Mon, 23 Jun 2008 13:22:12 +0000 (13:22 +0000)]
Fix the _RemoveBlockDevLinks() function

This fixes the removal of the instance symlinks (probably breakage from
the glob changes).

Reviewed-by: imsnah

16 years agoFix the zombie process unittest
Guido Trotter [Mon, 23 Jun 2008 12:50:57 +0000 (12:50 +0000)]
Fix the zombie process unittest

The failure is because in high load, the parent gets to run before the
child has the chance to os._exit(), and therefore it is still running
when the parent does the check.

The fix removes the chance of this happening by waiting to receive a SIGCHLD
(but not calling wait()) before trying to test the pid.

Reviewed-by: imsnah

16 years agoCreate all SUB_RUN_DIRS in ganeti-noded
Guido Trotter [Mon, 23 Jun 2008 11:06:56 +0000 (11:06 +0000)]
Create all SUB_RUN_DIRS in ganeti-noded

Rather than just creating BDEV_CACHE_DIR we loop through the
SUB_RUN_DIRS list and create all its childs.

Reviewed-by: iustinp

16 years agoAdd a top level RUN_GANETI_DIR constant
Guido Trotter [Mon, 23 Jun 2008 11:06:41 +0000 (11:06 +0000)]
Add a top level RUN_GANETI_DIR constant

This patch creates a base RUN_GANETI_DIR and then moves the other run
dir constants to use that (even if just setting BDEV_CACHE_DIR as equal
to it, rather than putting it deeper, for now).

Also we create a constant list of all the subdirs we need in RUN_DIR to
work properly, which we'll use when creating them in ganeti-noded.

Reviewed-by: iustinp

16 years agoFix cut&paste error when removing symlinks
Guido Trotter [Mon, 23 Jun 2008 08:18:25 +0000 (08:18 +0000)]
Fix cut&paste error when removing symlinks

It's just whitespace... isn't it? uhm... :) Anyway, fixing an error made
when reformatting the code for the new "safer" behaviour.

Reviewed-by: iustinp

16 years agoRemove instance's symlinks
Guido Trotter [Mon, 23 Jun 2008 08:01:36 +0000 (08:01 +0000)]
Remove instance's symlinks

Add _RemoveBlockDevLinks auxiliary function, called when an instance
fails to start and when it is shut down.

Reviewed-by: iustinp

16 years agoCatch BlockDeviceError when starting instance
Guido Trotter [Mon, 23 Jun 2008 08:01:21 +0000 (08:01 +0000)]
Catch BlockDeviceError when starting instance

_GatherAndLinkBlockDevs used to raise the errors.BlockDeviceError
exception when it failed to create a block device, and with this patch
set it does so also when it fails to create a symlink to it.

With this patch we move the call to this function into a pre-existing
try-except block in the code, and catch the BlockDeviceError exception,
logging a message and returning a failure state if it happens.

Reviewed-by: iustinp

16 years agoCreate symlinks to intances' block devices
Guido Trotter [Mon, 23 Jun 2008 08:01:07 +0000 (08:01 +0000)]
Create symlinks to intances' block devices

Change the _GatherBlockDevs private function, called only one time by
StartInstance, to _GatherAndLinkBlockDevs, and make it transform the
device returned even more by calling the new _SimlinkBlockDev auxiliary
function.

This makes sure that every time an instance is started symlinks to its
block devices are created, and the instance is started off them, rather
than the underlying block devices.

Reviewed-by: iustinp

16 years agosymlinks: Add DISK_LINKS_DIR constant
Guido Trotter [Mon, 23 Jun 2008 08:00:47 +0000 (08:00 +0000)]
symlinks: Add DISK_LINKS_DIR constant

The DISK_LINKS_DIR points to the RUN_DIR/ganeti/instance-disks
directory, which will contain symlinks to the instances' disks. These
provide a stable name accross all nodes for them, and permit
live-migration to happen.

Unfortunately RUN_DIR/ganeti/instance-disks happens to be below ganeti
1.2's BDEV_CACHE_DIR, which will we need to address at some point
(possibly in 2.0).

Reviewed-by: iustinp

16 years agoAdd a ‘tags’ field to instance and node listing
Iustin Pop [Sun, 22 Jun 2008 10:46:55 +0000 (10:46 +0000)]
Add a ‘tags’ field to instance and node listing

Currently there isn't any easy way to list all nodes or instance and
their tags; you have to query each node in turn, or list all the tags
via something like “gnt-cluster search-tags '.*'”. Of course, this is
not optimal.

The patch adds a new fields to “gnt-instance list” and “gnt-node list”
called ‘tags’, that will list the tags of the object in comma-separated
form. This field will be empty if there are no tags (when using a
separator this output can still be parsed by other scripts).

At opcode level, there is a new fields called ‘tags’ that returns a
(python) list of the object tags.

Reviewed-by: ultrotter

16 years agoUpdate error message in instance failover
Iustin Pop [Sun, 22 Jun 2008 05:06:57 +0000 (05:06 +0000)]
Update error message in instance failover

Currently both the hypervisor code and the backend code add a prefix of
'Failed to migrate instance' to the actual error output, thus doubling
this message.

The patch removes this string from the backend code.

Reviewed-by: imsnah

16 years agoMake testSignal unittest not depend on default shell
Iustin Pop [Sat, 21 Jun 2008 08:14:04 +0000 (08:14 +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.

(This is a backport from trunk)

Reviewed-by: iustinp

From: Manuel Franceschini <manuel.franceschini@gmail.com>