ganeti-local
16 years agoMinor doc/help update
Iustin Pop [Mon, 5 May 2008 10:02:55 +0000 (10:02 +0000)]
Minor doc/help update

This shortens the help output in gnt-node so that the output looks
nicer, and improves the manual page for gnt-instance with the new
'status' field.

Reviewed-by: ultrotter

16 years agoImprove the gnt-* list field selection
Iustin Pop [Mon, 5 May 2008 10:02:28 +0000 (10:02 +0000)]
Improve the gnt-* list field selection

This patch allows the '-o' option to the list subcommands to add more
fields to the default list instead of replacing the default list by
prefixing the fields list with '+'.

The patch also moves the listing (in the help output) of the default
field list from hardcoded to built at runtime from the actual list.

Reviewed-by: ultrotter

16 years agoAdd node cpu count to gnt-node list
Iustin Pop [Mon, 5 May 2008 10:01:39 +0000 (10:01 +0000)]
Add node cpu count to gnt-node list

This patch adds the backend and frontend changes needed for being able
to list the cpu count.

Reviewed-by: ultrotter

16 years agoWrap exception in _DistributeConfig code
Guido Trotter [Mon, 5 May 2008 08:49:01 +0000 (08:49 +0000)]
Wrap exception in _DistributeConfig code

nodelist.remove(X) could potentially raise a ValueError (even if the chance
that the current node is not in the list are pretty scarce, and its absence
should raise a red flag anyway). If this happens let things go on, as that's
what the code which previously distributed the config did.

Reviewed-by: iustinp

16 years agoSimplify target generation in DistributeConfig
Guido Trotter [Mon, 5 May 2008 08:15:14 +0000 (08:15 +0000)]
Simplify target generation in DistributeConfig

Currently we get the list of nodes, and for each one extract all its info, and
just to exclude it if the name matches ours. Since the list of nodes is a list
of names just use .remove() to exclude ourself from it, and use that list
directly.

Reviewed-by: iustinp

16 years agossconf: update the SetKey docstring
Guido Trotter [Fri, 2 May 2008 09:36:21 +0000 (09:36 +0000)]
ssconf: update the SetKey docstring

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

Reviewed-by: iustinp

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

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

Reviewed-by: iustinp

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

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

Reviewed-by: iustinp

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

Reviewed-by: iustinp

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

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

Reviewed-by: iustinp

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

Reviewed-by: iustinp

16 years agoAdd cluster-verify hooks
Guido Trotter [Wed, 30 Apr 2008 09:29:58 +0000 (09:29 +0000)]
Add cluster-verify hooks

Only post-hooks are run on cluster verify, and then their output is sent back
to the LU, which upon failure displays it to the user and changes the result of
the execution to a failure.

Reviewed-by: iustinp

16 years agoAdd a LU Hooks notification function
Guido Trotter [Wed, 30 Apr 2008 09:29:49 +0000 (09:29 +0000)]
Add a LU Hooks notification function

Previously LUs could be failed by pre-hooks, and post-hooks just had effects by
themselves. This patch allows a LU to define the HooksCallBack function if it
wants to know about its hooks' results and alter its results in response.

The ChainOpCode execution path contains some commented out hooks code, which
this patch modifies to run the HooksCallBack function, so this is not forgot if
it ever gets uncommented out.

Reviewed-by: iustinp

16 years agoHooksMaster: Make RunPhase return the rpc output
Guido Trotter [Wed, 30 Apr 2008 09:29:39 +0000 (09:29 +0000)]
HooksMaster: Make RunPhase return the rpc output

Right now the hooks output is propagated from the nodes all the way up to
HooksMaster.RunPhase, which uses it for debugging PRE hooks, but then silently
discards them. We'll now propagate it up to the Processor.ExecOpCode function,
where they can be handled for other purposes (or discarded again, of course).
This patch also improves a bit the HooksMaster.RunPhase docstring.

Reviewed-by: iustinp

16 years agoRemove NoHooksLU.BuildHooksEnv
Guido Trotter [Wed, 30 Apr 2008 09:29:30 +0000 (09:29 +0000)]
Remove NoHooksLU.BuildHooksEnv

Since NoHooksLU defines HPATH as None, BuildHooksEnv will never be called (as
the LogicalUnit.BuildHooksEnv docstring correctly states). Removing the
function altogether, to avoid having dead code lying around, and to make sure
the non-implemented one in LogicalUnit will be called if someone mistakenly
tries to call it, so it's immediately clear that something is wrong.

Reviewed-by: iustinp

16 years agoLogicalUnit.BuildHooksEnv, update docstring
Guido Trotter [Wed, 30 Apr 2008 09:29:21 +0000 (09:29 +0000)]
LogicalUnit.BuildHooksEnv, update docstring

The LogicalUnit.BuildHooksEnv docstring used to say that the node list should
not include the master node. This is obviously not the case checking the
relevant code, and double-checking with iustin he confirmed it just document
some obsolete behaviour. This patch removes those remarks making the docstring
shorter, easier, and, last but not least, correct! ;)

Reviewed-by: iustinp

16 years agoRemove non-existing arguments from some docstrings
Guido Trotter [Wed, 30 Apr 2008 09:29:08 +0000 (09:29 +0000)]
Remove non-existing arguments from some docstrings

A fewdocstrings in the HooksRunner backend class list arguments the relevant
functions do not take.  Clean them up.

Reviewed-by: iustinp

16 years agoAdd file-based options to gnt-instance man-page
Manuel Franceschini [Tue, 29 Apr 2008 15:26:05 +0000 (15:26 +0000)]
Add file-based options to gnt-instance man-page

Reviewed-by: iustinp

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

Reviewed-by: iustinp

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

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

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

Reviewed-by: ultrotter

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

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

Reviewed-by: ultrotter

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

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

Reviewed-by: ultrotter

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

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

Reviewed-by: iustinp

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

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

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

Reviewed-by: imsnah,ultrotter

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

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

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

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

Reviewed-by: ultrotter

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

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

Reviewed-by: imsnah

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

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

Additionally fix the docstring of testSignal.

Reviewed-by: iustinp

16 years agoMove iallocator script execution to ganeti-noded
Iustin Pop [Mon, 28 Apr 2008 09:47:23 +0000 (09:47 +0000)]
Move iallocator script execution to ganeti-noded

Currently the iallocator execution takes place in the master, which is a
violation of the current architecture, and will create problems with a
threaded master daemon.

This patch moves the execution to the backend, similar to the hooks
runner, by:
  - introducing a new class that handles the execution in the backend
    (and could be used also for listing the allocators, etc.)
  - introducing a new rpc call
  - replacing the actual execution in IAllocator.Run() with a rpc call

This passes burnin with the dumb allocator

Reviewed-by: imsnah

16 years agoFix iallocator instance info
Iustin Pop [Mon, 28 Apr 2008 09:47:06 +0000 (09:47 +0000)]
Fix iallocator instance info

The commit "IAllocator: some more info exported" broke the instance list
generation due to a wrong index variable. This patch fixes that.

Reviewed-by: ultrotter

16 years agoExtend utils.WriteFile
Michael Hanselmann [Fri, 25 Apr 2008 13:37:08 +0000 (13:37 +0000)]
Extend utils.WriteFile

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

Reviewed-by: schreiberal

16 years agoIAllocator: some more info exported
Iustin Pop [Fri, 25 Apr 2008 12:07:13 +0000 (12:07 +0000)]
IAllocator: some more info exported

This patch adds the following information to the exported info:
  - hypervisor type (in the main dict)
  - total memory used by primary instances (in each node dict) (can be
    computed from the node+instance dicts, but it's cheap to compute
    from Ganeti) (this is not live data, just from the config)
  - total memory used by primary instances marked to be up, similar to
    the above

Reviewed-by: imsnah

16 years agoIAllocator: simplify node info computation
Iustin Pop [Fri, 25 Apr 2008 12:07:05 +0000 (12:07 +0000)]
IAllocator: simplify node info computation

Currently we try to convert the values returned by call_node_info to
ints, and if all succeed, we actually do the conversion. Simplify this
by doing it in one step.

The patch also adds exporting of node memory as 'reserved_memory'.

Reviewed-by: imsnah

16 years agopatch 1/4 extended HVM features for 1.2
Iustin Pop [Fri, 25 Apr 2008 12:03:57 +0000 (12:03 +0000)]
patch 1/4 extended HVM features for 1.2

This patch extends the config objects with the slots to handle
more HVM configuration items.

Author: schreiberal
Reviewed-by: iustinp,imsnah

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

Reviewed-by: iustinp

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

Reviewed-by: imsnah

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

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

Reviewed-by: ultrotter

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

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

Reviewed-by: imsnah

16 years agoImplement replace secondary via the iallocator
Iustin Pop [Thu, 24 Apr 2008 11:13:45 +0000 (11:13 +0000)]
Implement replace secondary via the iallocator

This patch implements secondary replace via the iallocator. The new
opcode parameter 'iallocator' behaves like this: if passed, it will
always compute and assign a new secondary, behaving in effect as if the
secondary node has been passed. It conflicts with actually giving the
secondary too.

[Note: not tested with remote_raid1, but the code should behave the
same, we only touch CheckPrereq and we assign a node.]

The patch also adds burnin support for the replace secondary operation;
with this in place, burnin can fully work with auto-assigned nodes.

Reviewed-by: ultrotter

16 years agoImplement memory size option for burnin
Iustin Pop [Thu, 24 Apr 2008 07:35:04 +0000 (07:35 +0000)]
Implement memory size option for burnin

This simple patch adds memory size for the burnin instances, which helps
testing allocator algorithm response based on the available node memory
and instance memory size values.

Reviewed-by: ultrotter

16 years agoFix generalized relocate mode of IAllocator
Iustin Pop [Thu, 24 Apr 2008 07:29:10 +0000 (07:29 +0000)]
Fix generalized relocate mode of IAllocator

The patch which generalized the IAllocator was half-true: it actually
put the selection of the node inside the IAllocator, so callers were not
able to specify replace primary node.

This patch does:
  - split the arguments to the constructor in three sets: mode and name
    are always passed, and then we differentiate between allocation
    parameters and relocation ones
  - add a new relocate_from option to the IAllocator constructor which
    is a list of nodes we want to move the instance off
  - rename the 'nodes' argument in the request object to 'relocate_from'
    since this is clearer and is not confused with the result field also
    called 'nodes'

Reviewed-by: ultrotter

16 years agoFix burnin ImportExport CreateInstance opcode
Manuel Franceschini [Wed, 23 Apr 2008 15:11:39 +0000 (15:11 +0000)]
Fix burnin ImportExport CreateInstance opcode

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

Reviewed-by: iustinp

16 years agoburnin: improve instance create message
Guido Trotter [Wed, 23 Apr 2008 14:51:47 +0000 (14:51 +0000)]
burnin: improve instance create message

When the allocator or a non-mirrored template are used the message shown by
burnin at instance creation time was wrong. Fixing it.

Reviewed-by: iustinp

16 years agoburnin: remove created exports
Guido Trotter [Wed, 23 Apr 2008 14:51:39 +0000 (14:51 +0000)]
burnin: remove created exports

Make burnin remove exports after importing the instance back.

Reviewed-by: iustinp

16 years agoAdd gnt-backup remove functionality
Guido Trotter [Wed, 23 Apr 2008 14:51:32 +0000 (14:51 +0000)]
Add gnt-backup remove functionality

This patch also fixes the LUExportInstance Prereq docstring.

Reviewed-by: iustinp

16 years agoAdd instance rename to burnin
Manuel Franceschini [Wed, 23 Apr 2008 12:27:48 +0000 (12:27 +0000)]
Add instance rename to burnin

This patch adds the possibility to execute instance renaming when
doing a cluster burnin. The optional parameter --rename takes
one 'spare' instance name.
Given this option it renames all given instances to the spare one
and back to their original name.

Reviewed-by: iustinp

16 years agoGeneralize the replace_secondary mode in iallocator
Iustin Pop [Wed, 23 Apr 2008 12:05:37 +0000 (12:05 +0000)]
Generalize the replace_secondary mode in iallocator

Currently the replace_secondary mode is too restrictive. This patch
changes this to a general 'relocate' mode where the node(s) to be
changed are specified via a new key in the request dict ('nodes') so
that we can change any of the instance's nodes.

Note that for the relocate mode, len(nodes) == required_nodes, so the
required nodes field is redundant, but it is provided for consistency
with the allocate mode.

Reviewed-by: ultrotter

16 years agoImplement replace_secondary in the dumb allocator
Iustin Pop [Wed, 23 Apr 2008 11:04:07 +0000 (11:04 +0000)]
Implement replace_secondary in the dumb allocator

This patch allows the dumb allocator to perform the replace secondary
request type. This is done simply by not allowing the current instances
nodes as a valid selection, and using the existing instance data instead
of the request (which doesn't have the instance info when doing the
replace_secondary).

Reviewed-by: ultrotter

16 years agoSend required_nodes field to the iallocator scripts
Iustin Pop [Wed, 23 Apr 2008 11:03:58 +0000 (11:03 +0000)]
Send required_nodes field to the iallocator scripts

This patch adds the 'required_nodes' field in the request dict for the
iallocator.

This means that the handmade-checks in the create instance can be
simplified, and that the dumb allocator can be made simple. Therefore
the patch also modifies it.

The patch also sends the disk_space_total to the script in realocate
mode and a small fix for showing errors (include stderr too).

Reviewed-by: ultrotter

16 years agoAllow burnin to use an iallocator in instance creation
Iustin Pop [Wed, 23 Apr 2008 11:00:06 +0000 (11:00 +0000)]
Allow burnin to use an iallocator in instance creation

This patch adds iallocator support to burnin, currently only in instance
creation. This means that, depending on the external algorithm, not all
nodes might get instances.

The patch also restricts node selection and iallocator options together.

Reviewed-by: ultrotter

16 years agoMove all iallocator functions into a class
Iustin Pop [Wed, 23 Apr 2008 10:57:47 +0000 (10:57 +0000)]
Move all iallocator functions into a class

This patch moves all the iallocator function into a separate class that
is then somewhat easier to use. It doesn't bring any new functionality.

The patch also changes the way the iallocator is called - the
OpTestAllocator opcode is no longer needed, and all its parameters
should be passed directly to the IAllocator constructor.

Reviewed-by: ultrotter

16 years agoCorrectly filter out Domain-0 from domain list if requested.
Alexander Schreiber [Tue, 22 Apr 2008 14:02:43 +0000 (14:02 +0000)]
Correctly filter out Domain-0 from domain list if requested.

Reviewed-by: ultrotter

16 years agoOnly change instance status if not already so
Iustin Pop [Mon, 21 Apr 2008 13:22:16 +0000 (13:22 +0000)]
Only change instance status if not already so

This patch makes the _SetInstanceStatus only change the status of the
instance (in the config file) if it's not already in the desired state.
This skips the increase of the config serial no without actual data
changes.

Reviewed-by: ultrotter

16 years agoReuse common code between MarkInstance{Up,Down}
Iustin Pop [Mon, 21 Apr 2008 13:22:07 +0000 (13:22 +0000)]
Reuse common code between MarkInstance{Up,Down}

This patch creates a new method ConfigWriter._SetInstanceStatus that
consists of the common code between MarkInstanceUp and MarkInstanceDown.
These two methods become wrappers over the _SetInstanceStatus.

Reviewed-by: ultrotter

16 years agoAbstract the json functions into a separate module
Iustin Pop [Mon, 21 Apr 2008 13:04:57 +0000 (13:04 +0000)]
Abstract the json functions into a separate module

This simple patch adds a new module that holds the simplejson functions
for serialization/deserialization. This reduces the amount of redundant
code.

The patch also adds some normalizations to the json output:
  - the output text will always have an EOL as last char
  - extra spaces before EOL are removed

Reviewed-by: ultrotter

16 years agoAdd --readd option to “gnt-node add”
Michael Hanselmann [Wed, 16 Apr 2008 18:22:26 +0000 (18:22 +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 agoA pure whitespace change for style compliance
Iustin Pop [Wed, 16 Apr 2008 14:07:01 +0000 (14:07 +0000)]
A pure whitespace change for style compliance

Reviewed-by: amishchenko

16 years agoIAllocator part 3: LUCreateInstance changes
Iustin Pop [Wed, 16 Apr 2008 13:57:20 +0000 (13:57 +0000)]
IAllocator part 3: LUCreateInstance changes

This (final) patch allows the instance's nodes to be selected
automatically based on the passed allocator algorithm.

The patch changes the pnode opcode parameter from required to optional,
now either the pnode or the iallocator must be passed.

A possible improvement could be to organize all the _IAllocator
functions into a separate class, but that can come later and the current
version is functionally ok.

Reviewed-by: ultrotter

16 years agoReorder checks in instance create
Iustin Pop [Wed, 16 Apr 2008 13:56:52 +0000 (13:56 +0000)]
Reorder checks in instance create

This patch reorders the checks in the instance create prereq so that all
checks and normalisations that are not node-dependent are done before
the node dependent checks.

This is done so that, after the instance-related opcode parameters are
checked and fixed, we can run the allocator and compute the primary (and
any secondary) nodes, and only then proceed with node-related checks.

Reviewed-by: ultrotter

16 years agoImplement 'out' direction on allocator tests
Iustin Pop [Wed, 16 Apr 2008 13:56:37 +0000 (13:56 +0000)]
Implement 'out' direction on allocator tests

This patch adds the paths for searching for instance allocators and
makes the LUTestAllocator code run the allocator and return the results
if the direction specified is 'out'. 'out' means that the opcode will
return the result of the allocator run, instead of the allocator input
file ('in').

The patch unifies all names to refer to 'iallocator' instead of plain
allocator.

The patch also adds an example allocator that can be used for testing
this new functionality.

Reviewed-by: ultrotter

16 years agoAllocator framework, 1st part: allocator input generation
Iustin Pop [Wed, 16 Apr 2008 13:56:00 +0000 (13:56 +0000)]
Allocator framework, 1st part: allocator input generation

In preparation for the introduction of automatic instance allocator,
this patch adds an allocator simulation opcode, that based on the input
parameters, will return either the input message to the allocator
(implemented) or the result of the allocator run (not yet implemented).

This allows algorithm tests against simulated allocations and the
current cluster state.

The patch adds the following:
  - a function that generates the generic cluster information for the
    allocator
  - a function that generates the 'new instance' information
  - a function that generates the 'replace_secondary' information

These three functions will be used by the allocator framework later to
generate the actual information for the external algorithms. Currently
we just return the json-serialized text.

Reviewed-by: imsnah

16 years agoFix two pylint uninitialized variable errors
Guido Trotter [Tue, 15 Apr 2008 16:12:25 +0000 (16:12 +0000)]
Fix two pylint uninitialized variable errors

Reviewed-by: iustinp

16 years agoBugfix: wrong identifier in CheckPrereq message
Manuel Franceschini [Tue, 15 Apr 2008 14:47:31 +0000 (14:47 +0000)]
Bugfix: wrong identifier in CheckPrereq message

Reviewed-by: iustinp

16 years agoModify burnin to support file storage backend
Manuel Franceschini [Tue, 15 Apr 2008 12:43:16 +0000 (12:43 +0000)]
Modify burnin to support file storage backend

This patch does two things:
- adjusts burnin to work with the file storage backend patches
- adds the possibilty to do a burnin for file based instances

Reviewed-by: iustinp

16 years agoMove the disk size computation to its own function
Iustin Pop [Tue, 15 Apr 2008 12:34:27 +0000 (12:34 +0000)]
Move the disk size computation to its own function

This is currently hard-coded for the two drive case and will need to be
reworked for multi-disk support.

The patch is needed to support passing the total required size to the
iallocator interface.

Reviewed-by: ultrotter

16 years agoSharedLock: restrict assertion condition
Guido Trotter [Tue, 15 Apr 2008 11:54:26 +0000 (11:54 +0000)]
SharedLock: restrict assertion condition

When we release a shared lock if there are no exclusive waiter then the number
of shared waiters must be exactly equal to the ones scheduled to pass.

Reviewed-by: iustinp

16 years agoMake the init script start the master daemon too
Iustin Pop [Fri, 11 Apr 2008 14:54:17 +0000 (14:54 +0000)]
Make the init script start the master daemon too

Reviewed-by: ultrotter

16 years agoVerify: make skipping checks possible
Guido Trotter [Thu, 10 Apr 2008 17:04:13 +0000 (17:04 +0000)]
Verify: make skipping checks possible

Add a general way to skip some checks at cluster-verify time and make the N+1
memory redundancy check optional.

Reviewed-by: iustinp

16 years agoVerify: add N+1 Memory redundancy verification
Guido Trotter [Thu, 10 Apr 2008 17:04:01 +0000 (17:04 +0000)]
Verify: add N+1 Memory redundancy verification

For every node we check that we can host all the instances it's currently
secondary for belonging to the same primary. This ensures that if a node fails
all its instances can fit on their secondary node. The code only works when
failover is forced to go to the secondary node, and cannot go to an arbitrary
node in the cluster, which is the case in Ganeti 1.2.

Reviewed-by: iustinp

16 years agoVerify: save instance config
Guido Trotter [Thu, 10 Apr 2008 17:03:54 +0000 (17:03 +0000)]
Verify: save instance config

Save the instance config after we queried it in an instance_cfg dict.  This can
be used later by any function that wants it, without reloading it from the
configuration module. It will be used for N+1 memory resilience checking.

Reviewed-by: iustinp

16 years agoVerify: add more instance information to node_info
Guido Trotter [Thu, 10 Apr 2008 17:03:46 +0000 (17:03 +0000)]
Verify: add more instance information to node_info

The sisnt-by-pnode field contains all secondary instances of a node, grouped by
their primary node. This information allows us to see quickly if when a node
dies some of its instances cannot be started on their secondary node.

Reviewed-by: iustinp

16 years agoVerify: add instance information to node_info
Guido Trotter [Thu, 10 Apr 2008 17:03:38 +0000 (17:03 +0000)]
Verify: add instance information to node_info

With this patch node_info is changed to store information about which primary
and secondary instances are configured on a node. This information is useful to
check memory and disk allocation. A list of non-redundant instances is also
collected at this stage.

Reviewed-by: iustinp

16 years agoVerify: Add and populate node_info dict
Guido Trotter [Thu, 10 Apr 2008 17:03:29 +0000 (17:03 +0000)]
Verify: Add and populate node_info dict

During information gathering we collect information from call_node_info, and
then when we cycle trough the nodes add it into a node_info dict containing a
node's free memory and disk. This will be useful later to verify that the
cluster is N+1 redundant. The disk space is saved as well because it can be
useful for checks about disk space redundancy.

Reviewed-by: iustinp

16 years agoRework the results of OpDiagnoseOS opcode
Iustin Pop [Thu, 10 Apr 2008 16:38:58 +0000 (16:38 +0000)]
Rework the results of OpDiagnoseOS opcode

Currently, the opcode DiagnoseOS is the only opcode that return a
structure of objects.OS (which is a custom class, and not a simple
python object) and furthermore all the processing of OS validity across
nodes is left to the clients of this opcode.

It would be more logical to have this opcode be similar to list
instances/nodes, in the sense that:
  - it should return a table of results
  - the fields in the table should be selectable

This patch does the above. The possible fields are:
  - name (os name)
  - valid (bool representing validity across all nodes)
  - node_status, which is a complicated structure required for ‘gnt-os
    diagnose’

With this patch, gnt-os list becomes a very simple iteration over the
list of results, filtering out non-valid ones. gnt-os diagnose is still
complicated, but no more than before.

The burnin tool has also been modified to work with the modified
results, and is simpler because of this (it only needs to know if an OS
is valid or not, not the per-node details).

Reviewed-by: imsnah

16 years agoAdd generic opcode submit functionality to gnt-debug
Iustin Pop [Thu, 10 Apr 2008 15:56:07 +0000 (15:56 +0000)]
Add generic opcode submit functionality to gnt-debug

This patch enhances gnt-debug to be able to submit any opcodes. The
opcodes are input from a json file containing a list of opcodes.

This allows enhanced testing of opcodes until the other gnt-* commands
are converted to use the master daemon.

Reviewed-by: ultrotter

16 years agoChange client protocol to raise exception on failures
Iustin Pop [Thu, 10 Apr 2008 15:46:44 +0000 (15:46 +0000)]
Change client protocol to raise exception on failures

Currently the luxi.client.SubmitJob and Query methods return the unserialized
result without processing it at all. This patch changes this by adding a
'RequestException' error that is raised if the query itself or the
submission of the job failed, and (if not) returning only the 'result'
field from the message.

The patch also does processing on the result of a query if we queried
for jobs, as the 'op_list' field in the result has serialized opcodes
and we need the de-serialized.

Reviewed-by: ultrotter

16 years agoAdd per-opcode results to job processing
Iustin Pop [Thu, 10 Apr 2008 15:36:29 +0000 (15:36 +0000)]
Add per-opcode results to job processing

This patch changes the definition of a job and introduces per-opcode
results.

First, the result and status fields of a job are condensed into a single
'status' attribute. Then, we introduce an opcode status and one result
list, that allow jobs to return values.

The gnt-job script is also modified to allow these new fields to be
queried.

Note that the patch changes the opcode field to op_list, and it changes
its return value from string to a list of (serialized) opcodes.

Reviewed-by: ultrotter

16 years agoMove the OS search code into an abstract function
Iustin Pop [Thu, 10 Apr 2008 13:41:01 +0000 (13:41 +0000)]
Move the OS search code into an abstract function

Based on the previous OS search code changes, we can now move the OS
search code into a generic look-for-file function in utils.py. This
means that the allocator code can use the same function.

Reviewed-by: ultrotter

16 years agoChange backend._OSSearch return values
Iustin Pop [Thu, 10 Apr 2008 13:40:50 +0000 (13:40 +0000)]
Change backend._OSSearch return values

Currently, the function backend._OSSearch() returns the (first) base dir
in which this OS can be found. Thereafter the full actual path to the OS
dir is built in the backend.OSFromDisk() function.

This patch changes this so that _OSSearch() always returns the full path
to the OS directory, and OSFromDisk uses that as returned (it will only
build it if it gets a base dir in the first place).

This patch is needed before we can abstract the _OSSearch into a generic
'look for file object' functionality that can be used for allocator
plugins search too.

Reviewed-by: ultrotter

16 years agoFix example scripts build dependencies
Iustin Pop [Thu, 10 Apr 2008 12:59:25 +0000 (12:59 +0000)]
Fix example scripts build dependencies

Currently, the example scripts (the init.d and the cron script) do not
depend on the Makefile, so if configure is rerun with different
parameters these scripts are not rebuild.

The patch adds Makefile as a dependency so changes to installation paths
or other parameters trigger the rebuild.

Reviewed-by: imsnah

16 years agoVerify: remove useless check in _VerifyInstance
Guido Trotter [Thu, 10 Apr 2008 10:18:43 +0000 (10:18 +0000)]
Verify: remove useless check in _VerifyInstance

The list of instances passed to _VerifyInstance is the one coming from
self.cfg.GetInstanceList(). So there's no point, inside that function, in
checking whether the current instance is a member of that list. Moreover
orphaned instance verification is already done in a separate step.

Reviewed-by: imsnah

16 years agoVerify: instance verification cleanup
Guido Trotter [Thu, 10 Apr 2008 10:18:33 +0000 (10:18 +0000)]
Verify: instance verification cleanup

The instance configuration is grabbed both in the _VerifyInstance function and
in the loop that calls it. Clean this up by passing the configuration as a
parameter.

Reviewed-by: imsnah

16 years agoVerify: fix crash when a node is down
Guido Trotter [Thu, 10 Apr 2008 10:18:24 +0000 (10:18 +0000)]
Verify: fix crash when a node is down

Currently if ganeti-noded doesn't respond on a node gnt-cluster verify will die
when verifying primary instances for that node. Fix this by just emitting an
error message if no information about running instances is returned from the
node.

Reviewed-by: iustinp

16 years agoVerify: fix ERROR message indentation
Guido Trotter [Thu, 10 Apr 2008 10:18:14 +0000 (10:18 +0000)]
Verify: fix ERROR message indentation

All ERROR messages in cluster verify are indented by four spaces, this one is
indented by two. Fixing this skew.

Reviewed-by: imsnah, iustinp

16 years agoFix spelling mistake in constants.py
Guido Trotter [Thu, 10 Apr 2008 10:18:05 +0000 (10:18 +0000)]
Fix spelling mistake in constants.py

Of course instance creation don't have any modem, and the comment was just
talking about modes. Sorry to everybody expecting whistles.

Reviewed-by: imsnah

16 years agoAdd lvm storage option to gnt-cluster man page
Manuel Franceschini [Thu, 10 Apr 2008 09:15:16 +0000 (09:15 +0000)]
Add lvm storage option to gnt-cluster man page

This patch adds the previously introduced lvm storage toggling
info to the gnt-cluster man page. It adds some info the the
gnt-cluster init -g option and adds the gnt-cluster modify command.

Reviewed-by: iustinp

16 years agoSmall code style fix
Manuel Franceschini [Thu, 10 Apr 2008 09:12:38 +0000 (09:12 +0000)]
Small code style fix

Reviewed-by: imsnah

16 years agoBugfix instance create when file-storage-dir None
Manuel Franceschini [Wed, 9 Apr 2008 17:45:40 +0000 (17:45 +0000)]
Bugfix instance create when file-storage-dir None

os.path.join does not like None as argument and fails with
AttributeError: 'NoneType' object has no attribute 'startswith'.

This patch makes sure the passed argument is a string in any case.

Reviewed-by: iustinp

16 years agoTwo small code style fixes
Manuel Franceschini [Tue, 8 Apr 2008 16:28:40 +0000 (16:28 +0000)]
Two small code style fixes

Reviewed-by: imsnah

16 years agoModify gnt-instance to support file backend
Manuel Franceschini [Tue, 8 Apr 2008 16:01:56 +0000 (16:01 +0000)]
Modify gnt-instance to support file backend

Reviewed-by: ultrotter

16 years agoAdd file_storage_dir,file_driver to OpCreateInstance
Manuel Franceschini [Tue, 8 Apr 2008 16:01:26 +0000 (16:01 +0000)]
Add file_storage_dir,file_driver to OpCreateInstance

Reviewed-by: ultrotter, iustinp

16 years agoModify LURenameInstance to support file backend
Manuel Franceschini [Tue, 8 Apr 2008 16:00:52 +0000 (16:00 +0000)]
Modify LURenameInstance to support file backend

This patch does two things:
- Modify LURenameInstance.Exec to rename directory
  when a file-based instance is renamed
- Modify config.RenameInstance() to replace the directory name in
  config.data for file devices

Reviewed-by: iustinp

16 years agoModify LUCreateInstance to support file backend
Manuel Franceschini [Tue, 8 Apr 2008 16:00:26 +0000 (16:00 +0000)]
Modify LUCreateInstance to support file backend

- Modfiy _GenerateDiskTemplate to support file-based disk template
- Modify _CreateDisks to create directory needed for file-based
  instances before creating the actual files
- Modify _RemoveDisks to delete directory for file-based instances
  after deleting their VBDs
- Add Prereq-check to check if given file-driver is valid
- Add Prereq-check to check if given file-storage-dir path is relative

Reviewed-by: iustinp

16 years agoBump version number to 1.3.0~alpha1
Michael Hanselmann [Tue, 8 Apr 2008 15:05:14 +0000 (15:05 +0000)]
Bump version number to 1.3.0~alpha1

Reviewed-by: iustinp

16 years agoProvide more flexible version numbers to the code
Michael Hanselmann [Tue, 8 Apr 2008 15:04:56 +0000 (15:04 +0000)]
Provide more flexible version numbers to the code

Having the individual parts in the code allows us to build version
numbers like "1.2" while leaving "3" out in a clean fashion, that is
without regular expressions or the like. This might be used together
with configuration format versions.

Why m4 code? AM_INIT_AUTOMAKE, which could take a shell variable, is
considered deprecated[1] and should be replaced by AC_INIT. Unfortunately,
AC_INIT is expanded at build time, so one has to use m4 to build
composite values like this version number[2].

[1] http://www.gnu.org/software/libtool/manual/automake/Public-macros.html
[2] http://www.mail-archive.com/autoconf@gnu.org/msg16720.html

Reviewed-by: iustinp

16 years agoModify hypervisor to support file backend
Manuel Franceschini [Tue, 8 Apr 2008 14:04:38 +0000 (14:04 +0000)]
Modify hypervisor to support file backend

The driver in the xen config file needs to be changed when dealing with
files rather then bdevs.

This patch does two things:
- Add _GetConfigFileDiskData to XenHypervisor which returns the correct
  disk xen config line. This function checks the logical disk type of
  every given block device, such that also hybrid (e.g. mixed drbd and
  file VBDs) are possible
- Make Xen[Pvm|Hvm]Hypervisor._WriteConfigFile() a classmethod to be
  able to call the helper function _GetConfigFileDiskData() in their
  parent XenHypervisor

Reviewed-by: iustinp

16 years agoRemove support for Pickle configuration files
Michael Hanselmann [Tue, 8 Apr 2008 12:54:22 +0000 (12:54 +0000)]
Remove support for Pickle configuration files

Reviewed-by: iustinp

16 years agoAdd more explicit help for command line
Michael Hanselmann [Tue, 8 Apr 2008 12:54:08 +0000 (12:54 +0000)]
Add more explicit help for command line

Reviewed-by: iustinp

16 years agoUpdate copyright year, imports of cfgupgrade
Michael Hanselmann [Tue, 8 Apr 2008 12:53:51 +0000 (12:53 +0000)]
Update copyright year, imports of cfgupgrade

Reviewed-by: iustinp

16 years agoImplement selective job query
Iustin Pop [Mon, 7 Apr 2008 11:18:04 +0000 (11:18 +0000)]
Implement selective job query

This patch implements query-ing of only selected jobs instead of all.

Reviewed-by: ultrotter

16 years agoMove some checks from cli.py to luxi.py
Iustin Pop [Mon, 7 Apr 2008 11:15:41 +0000 (11:15 +0000)]
Move some checks from cli.py to luxi.py

The idea of cli.py and luxi.py is that all protocol checks should be in
luxi, and cli.py should just offer some helpful shortcuts for the
command line scripts.

This patch removes the result checks from cli and adds some other checks
to luxi. It does no longer check the success/failure since it's not yet
clear how that should be handled - probably exceptions.

Reviewed-by: ultrotter