ganeti-local
15 years agoConvert ssh.py to use the logging module
Iustin Pop [Mon, 20 Oct 2008 12:50:06 +0000 (12:50 +0000)]
Convert ssh.py to use the logging module

Reviewed-by: imsnah

15 years agoConvert rpc.py to use the logging module
Iustin Pop [Mon, 20 Oct 2008 12:49:59 +0000 (12:49 +0000)]
Convert rpc.py to use the logging module

Reviewed-by: imsnah

15 years agoFix some pylint-detected issues on the scripts
Iustin Pop [Mon, 20 Oct 2008 12:33:35 +0000 (12:33 +0000)]
Fix some pylint-detected issues on the scripts

Some names were wrong, and similar stuff detected by pylint.
gnt-debug.GenericOpCode is still broken.

Reviewed-by: imsnah

15 years agoConvert the gnt scripts to ToStdout/err
Iustin Pop [Mon, 20 Oct 2008 12:33:25 +0000 (12:33 +0000)]
Convert the gnt scripts to ToStdout/err

Currently the gnt-* scripts are using a mix of print, logger.ToStd* and
sys.stderr.write. We convert them all to using cli.ToStdout/err. This
way, we can easily change the implementation for all at once.

Reviewed-by: imsnah

15 years agoConvert cli.py to logging
Iustin Pop [Mon, 20 Oct 2008 12:33:15 +0000 (12:33 +0000)]
Convert cli.py to logging

We also add two function for printing messages, so that scripts won't
have to import logger to get these. They are a simple extension over the
logger ones, as they accept the call style from logging:
 ToStdout("Message: %s", msg)
(instead of requiring formatting by the client.

Reviewed-by: imsnah

15 years agoFix gnt-instance modify with beparams
Iustin Pop [Mon, 20 Oct 2008 12:16:38 +0000 (12:16 +0000)]
Fix gnt-instance modify with beparams

The gnt-instance modify didn't work correctly w.r.t the be parameters.
There was also a typo in the corresponding LU.

Reviewed-by: imsnah

15 years agoUpdate gnt-cluster man page for removal of --hypervisor-type.
Alexander Schreiber [Mon, 20 Oct 2008 11:09:11 +0000 (11:09 +0000)]
Update gnt-cluster man page for removal of --hypervisor-type.

We no longer use a single, cluster-wide hypervisor, but configure the
actual to be used hypervisor on the instance level. The option has already
been removed from gnt-cluster.

Reviewed-by: imsnah

15 years agoRemove old HTTP server code
Michael Hanselmann [Mon, 20 Oct 2008 11:04:11 +0000 (11:04 +0000)]
Remove old HTTP server code

All users of this code have been migrated to the new and shiny HttpServer
class.

It also fixes a typo in the ApacheLogfile unittests. It has not yet been
decided whether we should keep ApacheLogfile or not, hence leaving it in.

Reviewed-by: ultrotter

15 years agoRemove --hypervisor-type from gnt-cluster.
Alexander Schreiber [Mon, 20 Oct 2008 10:47:06 +0000 (10:47 +0000)]
Remove --hypervisor-type from gnt-cluster.

We no longer use a single, cluster-wide hypervisor, but configure the
actual to be used hypervisor on the instance level.

Reviewed-by: imsnah

15 years agoFix gnt-cluster init to set cluster defaults.
Alexander Schreiber [Sat, 18 Oct 2008 22:27:43 +0000 (22:27 +0000)]
Fix gnt-cluster init to set cluster defaults.

Reviewed-by: iustinp

15 years agoAdd constants for cluster defaults
Alexander Schreiber [Sat, 18 Oct 2008 22:26:56 +0000 (22:26 +0000)]
Add constants for cluster defaults

Reviewed-by: iustinp

15 years agoCleanup os_add/rename rpc for OS API 10
Guido Trotter [Fri, 17 Oct 2008 14:37:00 +0000 (14:37 +0000)]
Cleanup os_add/rename rpc for OS API 10

- remove now unused osdev and swapdev arguments from backend, noded,
  rpc, cmdlib
- convert docstrings to epydoc

Reviewed-by: iustinp

15 years agoTemporarily explicitely break import/export
Guido Trotter [Fri, 17 Oct 2008 14:36:45 +0000 (14:36 +0000)]
Temporarily explicitely break import/export

Since they're not converted to API 10 yet, we temporarily disable the
import/export functions.

Reviewed-by: iustinp

15 years agoAddOSToInstance: convert to api10
Guido Trotter [Fri, 17 Oct 2008 14:36:35 +0000 (14:36 +0000)]
AddOSToInstance: convert to api10

Reviewed-by: iustinp

15 years agoRunRenameInstance: convert to api10
Guido Trotter [Fri, 17 Oct 2008 14:36:23 +0000 (14:36 +0000)]
RunRenameInstance: convert to api10

Reviewed-by: iustinp

15 years agoAdd new OSEnvironment function
Guido Trotter [Fri, 17 Oct 2008 14:36:12 +0000 (14:36 +0000)]
Add new OSEnvironment function

This function calculates the basic environment for OS scripts in API
version 10.

Reviewed-by: iustinp

15 years agoBump up the OS API version
Guido Trotter [Fri, 17 Oct 2008 14:35:59 +0000 (14:35 +0000)]
Bump up the OS API version

Reviewed-by: iustinp

15 years agoOSFromDisk: use script names from constants
Guido Trotter [Fri, 17 Oct 2008 14:35:43 +0000 (14:35 +0000)]
OSFromDisk: use script names from constants

Reviewed-by: iustinp

15 years agoChange OSFromDisk's docstring to epydoc
Guido Trotter [Fri, 17 Oct 2008 14:35:31 +0000 (14:35 +0000)]
Change OSFromDisk's docstring to epydoc

Plus update it with the real variable name

Reviewed-by: iustinp

15 years agoAdd LDS_BLOCK for block device backed dev types
Guido Trotter [Fri, 17 Oct 2008 14:35:17 +0000 (14:35 +0000)]
Add LDS_BLOCK for block device backed dev types

Reviewed-by: iustinp

15 years agoCreate constants to replace os scripts names
Guido Trotter [Fri, 17 Oct 2008 14:35:04 +0000 (14:35 +0000)]
Create constants to replace os scripts names

Reviewed-by: iustinp

15 years agoETag passing support.
Oleksiy Mishchenko [Fri, 17 Oct 2008 13:06:04 +0000 (13:06 +0000)]
ETag passing support.

Reviewed-by: imsnah

15 years agoMainloop: handle sigterm
Guido Trotter [Fri, 17 Oct 2008 11:08:10 +0000 (11:08 +0000)]
Mainloop: handle sigterm

This fixes removals of the pid files and clean exit in the init script

Reviewed-by: iustinp

15 years agoMainloop: init sigchld_handler as None
Guido Trotter [Fri, 17 Oct 2008 11:07:57 +0000 (11:07 +0000)]
Mainloop: init sigchld_handler as None

There is no point in initializing sigchld_handler as an empty dict, when
it will be overwritten by an instance of utils.SignalHandler
immediately after.

Reviewed-by: iustinp

15 years agoFix remote API unittest
Michael Hanselmann [Fri, 17 Oct 2008 09:47:44 +0000 (09:47 +0000)]
Fix remote API unittest

I broke it with rev 1864. This patch also removes whitespace at
line endings.

Reviewed-by: amishchenko

15 years agoEnable gnt-cluster modify to hv/beparams
Iustin Pop [Thu, 16 Oct 2008 20:39:38 +0000 (20:39 +0000)]
Enable gnt-cluster modify to hv/beparams

This patch enables the cluster modify to change:
  - enabled hypervisor list
  - hvparams (per hypervisor)
  - beparams (only the default group)

Syntax:
  gnt-cluster modify -B vcpus=3 -H xen-pvm:no_initrd_path

Validation for parameters is somewhat missing - the individual
hypervisors will be checked for syntax and validation, but beparams
doesn't have validation yes (nowhere), it should be added here once we
have a global method (will come soon).

Reviewed-by: imsnah

15 years agorapi: Convert to new HTTP server class
Michael Hanselmann [Thu, 16 Oct 2008 16:54:02 +0000 (16:54 +0000)]
rapi: Convert to new HTTP server class

Requests are no longer logged to a separate file.

Reviewed-by: amishchenko

15 years agodesign-2.0-cluster-parameters: escape final _
Guido Trotter [Thu, 16 Oct 2008 16:38:32 +0000 (16:38 +0000)]
design-2.0-cluster-parameters: escape final _

In rst a final _ is used for linking. Escaping it prevents an error at
compile time on design-2.0-cluster-parameters.rst

Reviewed-by: iustinp

15 years agoShow the cluster parametrs in gnt-cluster info
Iustin Pop [Thu, 16 Oct 2008 16:26:04 +0000 (16:26 +0000)]
Show the cluster parametrs in gnt-cluster info

This is just a raw update without any special formatting.

Reviewed-by: imsnah

15 years agoRAPI: Instance add/delete implementation.
Oleksiy Mishchenko [Thu, 16 Oct 2008 14:40:33 +0000 (14:40 +0000)]
RAPI: Instance add/delete implementation.

Reviewed-by: iustinp

15 years agoOS Design: invert new and old name
Guido Trotter [Thu, 16 Oct 2008 13:35:15 +0000 (13:35 +0000)]
OS Design: invert new and old name

Internally in ganeti we already have renamed the instance, so it's
better to pass the new name in INSTANCE_NAME and the old one in
OLD_INSTANCE_NAME rather than the old name in INSTANCE_NAME and the new
one in NEW_INSTANCE_NAME as this reflects what the cluster thinks.

Reviewed-by: iustinp

15 years agoReally fix with the zombie test (hopefully)
Iustin Pop [Thu, 16 Oct 2008 13:05:18 +0000 (13:05 +0000)]
Really fix with the zombie test (hopefully)

So, instead of any timeouts for synchronization, we move to actual
events. We still have one (huge) timeout for pathological cases (just to
cleanup), but we don't sleep at all in normal usage.

The patch moves the zombie/cleaned up child creation out from setUp(),
and to on-demand by the functions. We remove all signal handler usage,
instead we rely on the fact that when a process is cleaned up, its FDs
are closed, so the read end of a pipe will get an event.

Reviewed-by: imsnah

15 years agoFix job queue behaviour when loading jobs
Iustin Pop [Thu, 16 Oct 2008 12:08:47 +0000 (12:08 +0000)]
Fix job queue behaviour when loading jobs

Currently, if loading a job fails, the job queue code raises an
exception and prevents the proper processing of the jobs in the queue.
We change this so that unparseable jobs are instead archived (if not
already).

Reviewed-by: imsnah

15 years agoPrevent master failover if we have wrong data
Iustin Pop [Thu, 16 Oct 2008 11:36:52 +0000 (11:36 +0000)]
Prevent master failover if we have wrong data

If we don't actually know the current master (as determined via voting),
we prevent the failover.

The patch also changes some messages (capitalization, typos).

Reviewed-by: ultrotter

15 years agoImprovements to the master startup checks
Iustin Pop [Thu, 16 Oct 2008 11:36:17 +0000 (11:36 +0000)]
Improvements to the master startup checks

In order to account for future improvements to master failover, we move
the actual data gathering capabilities from ganeti-masterd into
bootstrap.py, and we leave only the verification into masterd.

The verification procedure is then changed to retry multiple times (up
to one minute) in case most nodes do not respond, and also the algorithm
is changed to require at least half (but not half+1) votes, since our
vote also should count (and we vote for ourselves).

Example for consistent (config-wise) cluster:
  - 5 node cluster, 2 nodes down: still start
  - 4 node cluster, 2 nodes down: retry for one minute, abort

Reviewed-by: ultrotter

15 years agoProvide example for backend parameters
René Nussbaumer [Thu, 16 Oct 2008 08:37:14 +0000 (08:37 +0000)]
Provide example for backend parameters

Update the design about cluster parameters and provide
some example of backend parameters. By now this includes
all supported parameters.

Reviewed-by: iustinp, ultrotter

15 years agoAdd an interface for the drain flag changes/query
Iustin Pop [Thu, 16 Oct 2008 08:37:00 +0000 (08:37 +0000)]
Add an interface for the drain flag changes/query

This adds the set/reset in the jqueue and luxi modules, and a way to
query it in OpQueryConfigValues, and also the comand line interface for
it:
$ gnt-cluster queue info
The drain flag is unset
$ gnt-cluster queue drain
$ gnt-cluster queue info
The drain flag is set
$ gnt-cluster queue undrain
$ gnt-cluster queue info
The drain flag is unset

The choice of making the setting via luxi and not an opcode is that
opcodes can't be executed when drained, but we don't query via luxi
since in the future it might become a cluster property as opposed to a
node one.

Reviewed-by: imsnah

15 years agoAdding batch-create to gnt-instance
René Nussbaumer [Wed, 15 Oct 2008 13:38:49 +0000 (13:38 +0000)]
Adding batch-create to gnt-instance

This change is part of the integration of tools/batcher from
Ganeti 1.2 into Ganeti 2.0 core code. It has a compatible
submission interface to the version from 1.2 with these differences:

* it's integrated into Ganeti directly: gnt-instance batch-create
* iallocator is now provided by the instance specs
* log is now held within Ganeti
* no force needed
* no sleep needed
* memory and vcpus goes now into beparams
* missing stuff from the TODO (see below)

Open TODOs:

* Implement notification about creation status/interactive part (top like)
* Backup instance allocation specs?
* Document usage and spec format

Reviewed-by: iustinp

15 years agoAdd a rpc call for changing the drain flag
Iustin Pop [Wed, 15 Oct 2008 13:13:36 +0000 (13:13 +0000)]
Add a rpc call for changing the drain flag

A new multi-node call is added that sets/resets the drain flag.

Reviewed-by: imsnah

15 years agoImplement the job queue drain flag
Iustin Pop [Wed, 15 Oct 2008 10:52:07 +0000 (10:52 +0000)]
Implement the job queue drain flag

We add a (per-node) queue drain flag that blocks new job submission.
There is not yet an interface to add/remove the flag (will come in next
patches).

Reviewed-by: imsnah

15 years agoImplement transport of ganeti errors across luxi
Iustin Pop [Wed, 15 Oct 2008 10:51:51 +0000 (10:51 +0000)]
Implement transport of ganeti errors across luxi

This patch adds a generic method to identify the ganeti error given its
class name, and implements this across the luxi protocol.

Reviewed-by: imsnah

15 years agoChange the JobQueueError parent class
Iustin Pop [Wed, 15 Oct 2008 10:51:14 +0000 (10:51 +0000)]
Change the JobQueueError parent class

Currently this is not derived from GenericError, but there's no reason
for it to be so.

Reviewed-by: imsnah

15 years agorapi: Don't throw class as an exception
Michael Hanselmann [Wed, 15 Oct 2008 10:13:01 +0000 (10:13 +0000)]
rapi: Don't throw class as an exception

Reviewed-by: ultrotter

15 years agorapi: Whitespace fixes
Michael Hanselmann [Wed, 15 Oct 2008 08:22:54 +0000 (08:22 +0000)]
rapi: Whitespace fixes

Reviewed-by: ultrotter

15 years agognt-backup: update for cluster parameters
Guido Trotter [Tue, 14 Oct 2008 16:34:04 +0000 (16:34 +0000)]
gnt-backup: update for cluster parameters

- add backend and hypervisor parameters
- fix beparams validation/passing
- pass hypervisor and hvparams
- remove deprecated flags

Reviewed-by: iustinp

15 years agognt-instance fix ValidateBeParams call
Guido Trotter [Tue, 14 Oct 2008 16:33:53 +0000 (16:33 +0000)]
gnt-instance fix ValidateBeParams call

ValidateBeParams does not return, but its return value is assigned to a
variable which is never used. Avoid this assignment.

Reviewed-by: iustinp

15 years agognt-instance remove deprecated flags
Guido Trotter [Tue, 14 Oct 2008 16:33:41 +0000 (16:33 +0000)]
gnt-instance remove deprecated flags

kernel, initrd, hvm_boot_order and vnc_bind_address are now hypervisor
parameters and should not have their own flag. Moreover querying of
vnc_bind_address should of course pass through the hv/ namespace.

Reviewed-by: iustinp

15 years agogrow-disk: wait until resync is completed
Iustin Pop [Tue, 14 Oct 2008 16:23:02 +0000 (16:23 +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.

This is a forward-port of rev 1183 on the 1.2 branch.

Reviewed-by: ultrotter

15 years agoBurnin OpGrowDisk
Iustin Pop [Tue, 14 Oct 2008 16:22:14 +0000 (16:22 +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.

and:

burnin: don't try to grow diskless instances

    When burnin is run on a diskless instance, it fails when trying
    GrowDisk, because a non-existant disk cannot be grown. This patch
    disables the test for that disk template.

This is a forward-port of revisions 1181 and 1606 on the 1.2 branch.

Original author: ultrotter
Reviewed-by: ultrotter

15 years agoConvert the KVM hypervisor to hvparams
Iustin Pop [Tue, 14 Oct 2008 14:47:32 +0000 (14:47 +0000)]
Convert the KVM hypervisor to hvparams

I'm not sure which parameters it should use, I took all I saw in the
code. Update: ultrotter says the list is OK for now.

Reviewed-by: ultrotter

15 years agoSome fixes related to auto_balance
Iustin Pop [Tue, 14 Oct 2008 14:42:49 +0000 (14:42 +0000)]
Some fixes related to auto_balance

Change the constant name to match the value (autobalance ->
auto_balance).

Also add the auto_balance header so that gnt-instance can list it.

Reviewed-by: ultrotter

15 years agoFix auto_balance and memory modification
Iustin Pop [Tue, 14 Oct 2008 14:42:39 +0000 (14:42 +0000)]
Fix auto_balance and memory modification

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

This is a forward-port from rev 1567 on the 1.2 branch.

Reviewed-by: ultrotter

15 years agoUse the auto_balance in cluster verify
Iustin Pop [Tue, 14 Oct 2008 14:42:31 +0000 (14:42 +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

Forward port from rev 1562 on the 1.2 branch.

Reviewed-by: ultrotter

15 years agoFix ordering of instance/nodes
Iustin Pop [Tue, 14 Oct 2008 14:42:23 +0000 (14:42 +0000)]
Fix ordering of instance/nodes

After the locking changes, and the partial locking of nodes, the
instance/node list is not ordered anymore. Reorder so that it behaves as
before.

Reviewed-by: ultrotter

15 years agoRemove old instance attributes
Iustin Pop [Tue, 14 Oct 2008 11:30:03 +0000 (11:30 +0000)]
Remove old instance attributes

Reviewed-by: ultrotter

15 years agoChange over to beparams
Iustin Pop [Tue, 14 Oct 2008 11:29:55 +0000 (11:29 +0000)]
Change over to beparams

This big patch changes the master code to use the beparams. Errors might
have crept in, but it passes a small burnin.

Reviewed-by: ultrotter

15 years agoChange the backend to use the beparams
Iustin Pop [Tue, 14 Oct 2008 11:29:44 +0000 (11:29 +0000)]
Change the backend to use the beparams

The backend.FinalizeExport function is changed to use the beparams
instead of the instance attributes. Future enhancements should be done
in order to export and import/reuse the whole be/hv params.

Reviewed-by: ultrotter

15 years agoChange hypervisors to use the beparams
Iustin Pop [Tue, 14 Oct 2008 11:29:36 +0000 (11:29 +0000)]
Change hypervisors to use the beparams

This patch changes the hypervisor functions to use the beparams dict
instead of the instance attributes.

Reviewed-by: ultrotter

15 years agoCorrectly fill the beparams too over RPC
Iustin Pop [Tue, 14 Oct 2008 11:29:28 +0000 (11:29 +0000)]
Correctly fill the beparams too over RPC

As for the hvparams, we need to replace the sent instance beparams.

Reviewed-by: ultrotter

15 years agoAdd cli function for beparams validation
Iustin Pop [Tue, 14 Oct 2008 11:29:20 +0000 (11:29 +0000)]
Add cli function for beparams validation

This is used to validate the parameters in both “gnt-instance add” and
“gnt-backup import”.

Reviewed-by: ultrotter

15 years agoModify the beparams constants
Iustin Pop [Tue, 14 Oct 2008 11:29:12 +0000 (11:29 +0000)]
Modify the beparams constants

Memory is renamed for easier use.

Reviewed-by: ultrotter

15 years agoFix a bug with instance creation and hvparameters
Iustin Pop [Tue, 14 Oct 2008 10:21:20 +0000 (10:21 +0000)]
Fix a bug with instance creation and hvparameters

When creating an instance, we need to check not the opcode hvparams, but
the final, filled hvparams against validity. While we do this for the
remote node calls (i.e. ValidateParams), we didn't do this for
CheckParameterSyntax.

Reviewed-by: imsnah

15 years agoAllow instance info to only query the config file
Iustin Pop [Tue, 14 Oct 2008 10:21:12 +0000 (10:21 +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.

This is a forward-port of rev 1570 on the ganeti-1.2 branch, resending
due to some conflicts.

Reviewed-by: imsnah

15 years agoConvert gnt-instance info to the hvparams model
Iustin Pop [Tue, 14 Oct 2008 10:21:00 +0000 (10:21 +0000)]
Convert gnt-instance info to the hvparams model

Some informations are not printed nicely (e.g. “virtual CDROM: False”),
but this is the first step.

Reviewed-by: imsnah

15 years agoChange gnt-instance modify to the hvparams model
Iustin Pop [Tue, 14 Oct 2008 10:20:50 +0000 (10:20 +0000)]
Change gnt-instance modify to the hvparams model

Reviewed-by: imsnah

15 years agoChange gnt-instance list to the hvparams model
Iustin Pop [Tue, 14 Oct 2008 10:20:32 +0000 (10:20 +0000)]
Change gnt-instance list to the hvparams model

This is just a change of the various hvm_ and pvm parameters to the hv
model. Parameters are queried via hv/$name or via the whole dict as
returned by hvparams.

Reviewed-by: ultrotter,imsnah

15 years agoSwitch instance hypervisor parameters to hvparams
Iustin Pop [Tue, 14 Oct 2008 10:20:21 +0000 (10:20 +0000)]
Switch instance hypervisor parameters to hvparams

This big patch changes instance create to the new hvparams structure.
Old parameters are removed, so old jobs or old instances file will break
current clusters.

Reviewed-by: ultrotter

15 years agoTemporary fix for dual hvm/pvm instances
Iustin Pop [Tue, 14 Oct 2008 10:20:10 +0000 (10:20 +0000)]
Temporary fix for dual hvm/pvm instances

We have a problem with the current model of combining instance lists
from multiple hypervisors: we don't allow duplicates, but "xm list"
gives the same output for both pvm and hvm. This is a lack in the actual
xen hypervisor implementation/split between pvm and hvm, but for now we
implement a weak workaround: identical instance params will be allowed,
and merged. This breaks because there is a delta in listing, and should
be treated as temporary workaround only.

Note that there are two cases for duplicate instance: the above one (xen
is the same, whether pvm or hvm), and the other case, the real error,
when we have two different hypervisors reporting the same instance name.
The latter case needs to be handled better (not by refusing to list the
instances in the backend).

Reviewed-by: ultrotter

15 years agoImplement FillHV for instance-related rpc calls
Iustin Pop [Tue, 14 Oct 2008 10:20:01 +0000 (10:20 +0000)]
Implement FillHV for instance-related rpc calls

We fill the instance hvparams with cluster defaults, and send a modified
dict over the wire to the node methods - they don't know anything about
cluster defaults versus instance parameters.

Reviewed-by: ultrotter

15 years agoExport the hypervisor.ValidateParameters over RPC
Iustin Pop [Tue, 14 Oct 2008 10:19:52 +0000 (10:19 +0000)]
Export the hypervisor.ValidateParameters over RPC

The newly-added node-specific ValidateParams hypervisor method is
exported over RPC, using the semi-standard (success, message) return
value. Multi-node call, so that we call on both primary and secondary at
once.

Reviewed-by: ultrotter

15 years agoImplement the new hypervisor API in base/xen
Iustin Pop [Tue, 14 Oct 2008 10:19:40 +0000 (10:19 +0000)]
Implement the new hypervisor API in base/xen

This patch adds the new methods CheckParameterSyntax and the
ValidateParameters in the base and xen hypervisors. It also changes the
xen hypervisor to use the new hvparams field on instance.

Reviewed-by: imsnah

15 years agoGet rid of httperror module
Michael Hanselmann [Tue, 14 Oct 2008 08:24:52 +0000 (08:24 +0000)]
Get rid of httperror module

This was a leftover from the early days of the remote API in Ganeti 1.2.

Reviewed-by: ultrotter

15 years agoImplement parameter removal in SplitKeyVal
Iustin Pop [Tue, 14 Oct 2008 06:38:44 +0000 (06:38 +0000)]
Implement parameter removal in SplitKeyVal

This patch adds paramter removal in SplitKeyVal, by prefixing a
value-less key with "-"; this is needed in resetting parameters back to
cluster defaults, but care must be applied now that None can come from
the parser.

Reviewed-by: imsnah

15 years agoAdd the hv/be params object attributes
Iustin Pop [Tue, 14 Oct 2008 06:36:39 +0000 (06:36 +0000)]
Add the hv/be params object attributes

This patch adds the instance and cluster be/hvparams attributes, and the
Fill* methods on the cluster object. Nothing else is changes, except
that these attributes exist now on the objects.

Reviewed-by: ultrotter

15 years agoAdd constants for the HV/BE parameter names
Iustin Pop [Tue, 14 Oct 2008 06:36:31 +0000 (06:36 +0000)]
Add constants for the HV/BE parameter names

Since we don't want the string values of the parameters (e.g.
“kernel_path”) spread over the code, we introduce constants for these.

Reviewed-by: ultrotter,schreiberal

15 years agoFix a few rpc-related errors
Iustin Pop [Mon, 13 Oct 2008 13:49:50 +0000 (13:49 +0000)]
Fix a few rpc-related errors

This fixes:
  - whitespace change, double lines between methods
  - duplication of call_upload_file, introduced by mistake in rev 1795
    and which went undetected because of the many changes in that ref
    (only diff -b shows it clearly)
  - call_instance_info didn't pass the hypervisor name parameter, but
    the backend requires it

Reviewed-by: ultrotter

15 years agoAdd two new options types for CLI usage
Iustin Pop [Mon, 13 Oct 2008 12:17:12 +0000 (12:17 +0000)]
Add two new options types for CLI usage

For the new 2.0-style command line options, we need to parse strings of
the type:
  ident:key=val[,...]
and
  key=val[,...]

This patch adds two new option builders for these two, which return
(ident, {key=val,}) and {key=val,} for the above two formats. It also
handles specially constructs of type “key” (val is set to True) and
“no_key” (val is set to False, and the ‘no_’ prefix is stripped).

Reviewed-by: imsnah

15 years agoSome small typos on design docs
Iustin Pop [Mon, 13 Oct 2008 12:15:58 +0000 (12:15 +0000)]
Some small typos on design docs

Reviewed-by: imsnah

15 years agoUpdate the cluster parameters design doc
Iustin Pop [Mon, 13 Oct 2008 09:19:31 +0000 (09:19 +0000)]
Update the cluster parameters design doc

As discussed, we update the design doc with the three classes of
parameters and other changes.

Reviewed-by: imsnah

15 years agoAbstract checking own address into a function
Iustin Pop [Sun, 12 Oct 2008 20:40:44 +0000 (20:40 +0000)]
Abstract checking own address into a function

Currently, we check if we have a given ip address (i.e. it's alive on
one of our interfaces) but manually calling TcpPing(source=localhost).
This works, but having it spread all over the code makes it hard to
change the implementation.

The patch abstracts this into a separate utils.OwnIpAddress(addr)
function. We add a rpc call for it, which we use instead of the
(single-use of) call_node_tcp_ping. We leave node_tcp_ping in, as seems
useful and eventually it should be removed in a separate patch.

Reviewed-by: imsnah

15 years agoMark call_node_leave_cluster as a static method
Michael Hanselmann [Fri, 10 Oct 2008 17:08:09 +0000 (17:08 +0000)]
Mark call_node_leave_cluster as a static method

Reviewed-by: iustinp

15 years agoOS API: support for multiple versions in an OS
Guido Trotter [Fri, 10 Oct 2008 16:04:43 +0000 (16:04 +0000)]
OS API: support for multiple versions in an OS

Allow multiple api versions in an OS. This is according to the OS API
changes design doc, by which an OS can support multiple versions of the
Ganeti API and if one is supported by Ganeti it will work. Since up to
version 5 of the API mandates an OS could support only one version, this
change is retrocompatible with it and requires no version bump up.

Reviewed-by: iustinp

15 years agoLUVerifyCluster: fix error from rpc call
Guido Trotter [Fri, 10 Oct 2008 16:04:07 +0000 (16:04 +0000)]
LUVerifyCluster: fix error from rpc call

When calling node_verify leads to an error _VerifyNodes tries to iterate
over a non-sequence. Catch the error before and avoid this from
happening.

Reviewed-by: iustinp

15 years agoConvert ganeti-noded to new HTTP server class
Michael Hanselmann [Fri, 10 Oct 2008 16:00:40 +0000 (16:00 +0000)]
Convert ganeti-noded to new HTTP server class

Reviewed-by: iustinp

15 years agoAdd new HTTP server implementation
Michael Hanselmann [Fri, 10 Oct 2008 16:00:25 +0000 (16:00 +0000)]
Add new HTTP server implementation

This patch adds another implementation of an HTTP server. It's
based on code of Python's BaseHTTPServer, from both version
2.4 and 3k. In the future we can write code to decide whether
we should fork for a request or not. Keep-alive is not supported.

Reviewed-by: iustinp

15 years agoAdd daemon library with mainloop
Michael Hanselmann [Fri, 10 Oct 2008 16:00:02 +0000 (16:00 +0000)]
Add daemon library with mainloop

This mainloop can be used in daemons like ganeti-noded.

Reviewed-by: iustinp

15 years agoSome updates on the job queue design doc
Iustin Pop [Fri, 10 Oct 2008 15:12:12 +0000 (15:12 +0000)]
Some updates on the job queue design doc

This clarifies the job storage and the reason for choosing it.

Reviewed-by: imsnah

15 years agoUpdate design-2.0-job-queue to reflect changes
René Nussbaumer [Fri, 10 Oct 2008 09:55:24 +0000 (09:55 +0000)]
Update design-2.0-job-queue to reflect changes

With change 1773 a new status WAITLOCK was introduced if a job/opcode is
waiting for a lock. This change updates the document about the job-queue
accordingly.

Reviewed-by: iustinp

15 years agoConvert rpc module to RpcRunner
Iustin Pop [Fri, 10 Oct 2008 09:55:02 +0000 (09:55 +0000)]
Convert rpc module to RpcRunner

This big patch changes the call model used in internode-rpc from
standalong function calls in the rpc module to via a RpcRunner class,
that holds all the methods. This can be used in the future to enable
smarter processing in the RPC layer itself (some quick examples are not
setting the DiskID from cmdlib code, but only once in each rpc call,
etc.).

There are a few RPC calls that are made outside of the LU code, and
these calls are left as staticmethods, so they can be used without a
class instance (which requires a ConfigWriter instance).

Reviewed-by: imsnah

15 years agoCleanup in cmdlib for standalone function calls
Iustin Pop [Fri, 10 Oct 2008 09:52:47 +0000 (09:52 +0000)]
Cleanup in cmdlib for standalone function calls

This patch is a cleanup of the standalone functions in cmdlib. Many of
them too as argument a ConfigWriter instance, but some also took other
parameters from the lu (e.g. proc), and in the future, if we want to
also pass the RpcRunner, we would have to add yet another parameter.

One option is to make all these methods of top-level LogicalUnit class.
I took another approach, and made (almost) all these functions take as
first parameter the lu instance. It's like methods, just not declared
under LogicalUnit.

Reviewed-by: imsnah

15 years agoSmall random fixes
Iustin Pop [Fri, 10 Oct 2008 09:51:34 +0000 (09:51 +0000)]
Small random fixes

Indentation in bootstrap was wrong and some names in cmdlib.py were not
right.

Reviewed-by: imsnah

15 years agoMove instance hypervisor check to ExpandNames
Iustin Pop [Thu, 9 Oct 2008 11:29:32 +0000 (11:29 +0000)]
Move instance hypervisor check to ExpandNames

This check can be done earlier, in ExpandNames, and is needed here for
the hypervisor parameter check.

Reviewed-by: ultrotter

15 years agoUpdate documentation & man pages for changed hypervisor names.
Alexander Schreiber [Wed, 8 Oct 2008 23:13:54 +0000 (23:13 +0000)]
Update documentation & man pages for changed hypervisor names.

Reviewed-by: imsnah

15 years agoAjust config unittest.
Oleksiy Mishchenko [Wed, 8 Oct 2008 18:48:19 +0000 (18:48 +0000)]
Ajust config unittest.

Reviewed-by: iustinp

15 years agoUpdate scripts and qa config for changed hypervisor names.
Alexander Schreiber [Wed, 8 Oct 2008 17:31:17 +0000 (17:31 +0000)]
Update scripts and qa config for changed hypervisor names.

Reviewed-by: ultrotter

15 years agoShorten variable names.
Alexander Schreiber [Wed, 8 Oct 2008 14:41:07 +0000 (14:41 +0000)]
Shorten variable names.

Reviewed-by: iustinp

15 years agoSanitize the hypervisor names
Iustin Pop [Wed, 8 Oct 2008 14:31:43 +0000 (14:31 +0000)]
Sanitize the hypervisor names

Since in 2.0 the user will possibly have more interaction with the
hypervisor names, we sanitize them by removing the version numbers
(the version can be a prerequisite for the ganeti installation, we
shouldn't document it in variable names).

Reviewed-by: schreiberal

15 years agoAlso export OS_API to the OS scripts
Iustin Pop [Wed, 8 Oct 2008 14:10:46 +0000 (14:10 +0000)]
Also export OS_API to the OS scripts

The idea is that if the OSes will support multiple version (e.g. both
1.2 and 2.0), then Ganeti should be able to talk to it using version
2.0, but then the script needs to be told nicely what version Ganeti is
using.

Reviewed-by: imsnah

15 years agoFix for gnt-cluster init.
Oleksiy Mishchenko [Wed, 8 Oct 2008 13:04:52 +0000 (13:04 +0000)]
Fix for gnt-cluster init.

Reviewed-by: iustinp

15 years agoMove the hypervisor attribute to the instances
Iustin Pop [Wed, 8 Oct 2008 10:36:29 +0000 (10:36 +0000)]
Move the hypervisor attribute to the instances

This (big) patch moves the hypervisor type from the cluster to the
instance level; the cluster attribute remains as the default hypervisor,
and will be renamed accordingly in a next patch. The cluster also gains
the ‘enable_hypervisors’ attribute, and instances can be created with
any of the enabled ones (no provision yet for changing that attribute).

The many many changes in the rpc/backend layer are due to the fact that
all backend code read the hypervisor from the local copy of the config,
and now we have to send it (either in the instance object, or as a
separate parameter) for each function.

The node list by default will list the node free/total memory for the
default hypervisor, a new flag to it should exist to select another
hypervisor. Instance list has a new field, hypervisor, that shows the
instance hypervisor. Cluster verify runs for all enabled hypervisor
types.

The new FIXMEs are related to IAllocator, since now the node
total/free/used memory counts are wrong (we can't reliably compute the
free memory).

Reviewed-by: imsnah