ganeti-local
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

16 years agoA small capitalization change (OpCode.LoadOpcode)
Iustin Pop [Mon, 7 Apr 2008 11:12:45 +0000 (11:12 +0000)]
A small capitalization change (OpCode.LoadOpcode)

This small patch fixed the opcodes.OpCode.LoadOpcode capitalization to
what was intented to be (as the comment says): LoadOpCode.

Reviewed-by: ultrotter

16 years agoImplement forking/master role checking in masterd
Iustin Pop [Sat, 5 Apr 2008 15:29:36 +0000 (15:29 +0000)]
Implement forking/master role checking in masterd

This patch adds checks for the master role and daemonize support to
ganeti-masterd.

The patch modifies the startup/shutdown of the server because:
  - we want bind()/listen() to the master socket to occur before forking
    so that we can return a correct exit code and write messages to
    stderr
  - but we want thread startup to occur after fork(), otherwise python
    threading gets confused

The patch also has some small cleanups:
  - remove the unix socket after closing it, so we don't need to remove
    it manually
  - instead of just telling the threads to terminate via the new_queue,
    we also join() them so that the logs show what thread clinging to
    life
  - the daemon logs to its own logfile now
  - there is command line parameter support :)

Reviewed-by: imsnah

16 years agoAdd FileStorage class
Manuel Franceschini [Sat, 5 Apr 2008 12:47:44 +0000 (12:47 +0000)]
Add FileStorage class

This is the representation of file VBDs on the backend. It's the first
implementation an supports only raw files.

Reviewed-by: iustinp

16 years agorpc directory functions for file backend
Manuel Franceschini [Sat, 5 Apr 2008 12:45:34 +0000 (12:45 +0000)]
rpc directory functions for file backend

Reviewed-by: ultrotter

16 years agoganeti-noded directory functions for file backend
Manuel Franceschini [Sat, 5 Apr 2008 12:40:22 +0000 (12:40 +0000)]
ganeti-noded directory functions for file backend

Reviewed-by: ultrotter

16 years agoBackend directory functions for file backend
Manuel Franceschini [Sat, 5 Apr 2008 12:07:10 +0000 (12:07 +0000)]
Backend directory functions for file backend

Add _[Create,Remove,Rename]FileStorageDir function which are needed for
file-based instance management. These function check whether the given
directory to operate on is under the cluster-wide defined default file
storage dir. If this is not the case the won't do anything and return
False. This is to prevent cluster manipulation or damage.

Reviewed-by: ultrotter

16 years agoFix SetVGName() to access object not dict
Manuel Franceschini [Fri, 4 Apr 2008 16:53:05 +0000 (16:53 +0000)]
Fix SetVGName() to access object not dict

Reviewed-by: imsnah

16 years agoAllow utils.Daemonize() to not close some fds
Iustin Pop [Fri, 4 Apr 2008 15:29:29 +0000 (15:29 +0000)]
Allow utils.Daemonize() to not close some fds

This patch implements an optional parameter to utils.Daemonize() which
allows that function to not close some file descriptors.

This will allow the master daemon to open the listening socket before
fork - in order to be able to notify errors and return a meaningful exit
code, and then when we fork we don't close that fd.

Reviewed-by: imsnah

16 years agoAdd a simple gnt-job script
Iustin Pop [Fri, 4 Apr 2008 12:44:20 +0000 (12:44 +0000)]
Add a simple gnt-job script

This patch adds a very basic gnt-job script that allows job querying.
This goes on top of the previous master daemon patches.

Currently, because of the not-changed cmd lock, you can't query the jobs
as long as a job is running - you have to rm the cmd lock and then you
can query the jobs.

Reviewed-by: imsnah

16 years agoMove the daemonize function to utils.py
Iustin Pop [Fri, 4 Apr 2008 12:02:17 +0000 (12:02 +0000)]
Move the daemonize function to utils.py

Currently, in ganeti-noded we have the createDaemon function. Since
we'll need the same in other daemons, we move this function to utils.py

With the move, a few changes were also done:
  - change the name to Daemonize()
  - add a parameter, logfile, as different daemons will want to log to
    different files
  - remove the try.. except.. around the fork calls, since they were
    only re-raising the OS exception with less data; unless we want to
    actually handle fork error (not just re-raising), these try blocks
    are not useful
  - change the return style at the end of the function

Reviewed-by: imsnah

16 years agoImprove disk consistency error message again
Guido Trotter [Wed, 2 Apr 2008 18:32:08 +0000 (18:32 +0000)]
Improve disk consistency error message again

This new version includes all the possible failure options.

Reviewed-by: iustinp

16 years agoFix misleading error message when checking disks
Guido Trotter [Wed, 2 Apr 2008 18:06:04 +0000 (18:06 +0000)]
Fix misleading error message when checking disks

_CheckDiskConsistency outputs "Can't get any data from node NODE" when no drbd
is found on the target node. This causes a misleading error message to be
output for example on failover (when the primary node is down, or the instance
is not running), stating that no data could be got from the secondary node,
which scares the user and misleads him. Changing this to "Disk degraded or not
found on node %s" still reports that something is missing, but on the other
hand doesn't make the user think the node is down, or has no data at all...

Reviewed-by: imsnah

16 years agoHandle better failing over non-running instances
Guido Trotter [Wed, 2 Apr 2008 18:05:54 +0000 (18:05 +0000)]
Handle better failing over non-running instances

Right now if you try to failover an instance which is not marked as up the
operation will fail unless you pass the --ignore-consistency flag because the
disks won't be considered to be consistent. Allow them to be if we know the
instance shouldn't be up.

Reviewed-by: imsnah

16 years agoImprove export and fix export-on-norun bug
Guido Trotter [Wed, 2 Apr 2008 18:05:45 +0000 (18:05 +0000)]
Improve export and fix export-on-norun bug

Currently gnt-backup export chains the ShutdownInstance and StartupInstance
opcodes to itself. This works but (a) it's suboptimal, because there's no need
to deactivate the instance's disks as we are about to restart it anyway, and
(b) doesn't take care of instances which are already down (and should be). This
patch takes care of this by just calling the shutdown rpc function instead of
the whole opcode, and just starting up the instance if it's configured as up in
the first place.

Reviewed-by: imsnah

16 years agoForcibly convert export data to str object
Michael Hanselmann [Wed, 2 Apr 2008 14:15:07 +0000 (14:15 +0000)]
Forcibly convert export data to str object

ConfigParser.SafeConfigParser doesn't support unicode string objects.
Unicode string objects are returned by simplejson.

Reviewed-by: iustinp

16 years agofailover: only start instance if we should
Guido Trotter [Wed, 2 Apr 2008 10:01:23 +0000 (10:01 +0000)]
failover: only start instance if we should

gnt-instance failover on an instance marked as down will mistakenly bring it
up. The watcher will then shut it down again, but it's a lot better (and safer)
not to start it at all.

Reviewed-by: imsnah

16 years agoLocking: fix one indentation error (codestyle)
Guido Trotter [Wed, 2 Apr 2008 09:53:10 +0000 (09:53 +0000)]
Locking: fix one indentation error (codestyle)

Reviewed-by: imsnah

16 years agoLocking: fix superlong lines (codestyle)
Guido Trotter [Wed, 2 Apr 2008 09:52:56 +0000 (09:52 +0000)]
Locking: fix superlong lines (codestyle)

Reviewed-by: imsnah

16 years agoCheck whether path is valid before accessing it
Michael Hanselmann [Tue, 1 Apr 2008 16:52:43 +0000 (16:52 +0000)]
Check whether path is valid before accessing it

Reviewed-by: ultrotter

16 years agoInitial tests with ganeti-masterd
Iustin Pop [Tue, 1 Apr 2008 14:45:47 +0000 (14:45 +0000)]
Initial tests with ganeti-masterd

This patch adds a very in-progress master daemon. This needs to be
launched manually, does not background itself, but can be used for
opcode execution.

Also parts of this code should be moved to luxi.py.

Reviewed-by: ultrotter

16 years agoFix gnt-instance failover help message
Guido Trotter [Tue, 1 Apr 2008 13:28:30 +0000 (13:28 +0000)]
Fix gnt-instance failover help message

The message used to misleadingly say that failover just works with remote_raid1
instances, while of course it works for drbd as well. Since remote_raid1 has
been removed from the main development branch only drbd will be shown.  Thanks
to Jesus Climent who spotted the bug.

Reviewed-by: imsnah

16 years agoAdd a gnt-debug tool
Iustin Pop [Tue, 1 Apr 2008 13:07:20 +0000 (13:07 +0000)]
Add a gnt-debug tool

This patch adds a script which submits a job consisting of the
OpTestDelay opcode. This can be helpful for debugging and can be
extended to execute other 'debug'-like tasks.

Reviewed-by: ultrotter

16 years agoAdd submit function to lib/cli.py
Iustin Pop [Tue, 1 Apr 2008 13:05:48 +0000 (13:05 +0000)]
Add submit function to lib/cli.py

This patch adds function that submit jobs or queries over the unix socket
interface to lib/cli.py. The will be used by the scripts instead of the
SubmitOpCode function.

Reviewed-by: ultrotter

16 years agoA dumb queue implementation
Iustin Pop [Tue, 1 Apr 2008 13:04:14 +0000 (13:04 +0000)]
A dumb queue implementation

This patch adds a very dumb in-memory only queue implementation.

Reviewed-by: imsnah

16 years agoInitial implementation of the client unix socket
Iustin Pop [Tue, 1 Apr 2008 07:15:25 +0000 (07:15 +0000)]
Initial implementation of the client unix socket

This patch adds an initial implementation of the client-side of the unix
socket interface. The code is not yet used by other parts of ganeti.

Reviewed-by: imsnah

16 years agoChange the 'gnt-cluster command' execution order
Iustin Pop [Mon, 31 Mar 2008 14:39:50 +0000 (14:39 +0000)]
Change the 'gnt-cluster command' execution order

This patch makes the command execute last on the master (if the master
is selected). The order for the other nodes is unchanged.

The patch also updates the man page with some explanations and an
example.

Reviewed-by: imsnah

16 years agoChange the gnt-backup export help text
Iustin Pop [Mon, 31 Mar 2008 13:12:04 +0000 (13:12 +0000)]
Change the gnt-backup export help text

Reviewed-by: ultrotter

16 years agoparms->params Refactoring
Manuel Franceschini [Mon, 31 Mar 2008 12:04:01 +0000 (12:04 +0000)]
parms->params Refactoring

- Substitute all occurences of name 'parms' with 'params'
- Small codestyle fix

Reviewed-by: ultrotter

16 years agognt-cluster option to toggle lvm-storage
Manuel Franceschini [Mon, 31 Mar 2008 11:01:07 +0000 (11:01 +0000)]
gnt-cluster option to toggle lvm-storage

This patch does two things:
- Add gnt-cluster modify
- Add --no-lvm-storage option to gnt-cluster init

Reviewed-by: iustinp

16 years agoMap OpSetClusterParams to correponding LU
Manuel Franceschini [Mon, 31 Mar 2008 11:00:24 +0000 (11:00 +0000)]
Map OpSetClusterParams to correponding LU

Reviewed-by: iustinp

16 years agoAdd OpSetClusterParams to opcodes
Manuel Franceschini [Mon, 31 Mar 2008 11:00:10 +0000 (11:00 +0000)]
Add OpSetClusterParams to opcodes

Reviewed-by: iustinp

16 years agoSkip HasValidVG when --no-lvm-storage on cluster init
Manuel Franceschini [Mon, 31 Mar 2008 10:59:54 +0000 (10:59 +0000)]
Skip HasValidVG when --no-lvm-storage on cluster init

This patch does two things:
- Remove "vg_name" from _OP_REQP due to the introduction of
  --no-lvm-storage. Since vg_name option has as default now None and is
  only set to the DEFAULT_VG if lvm_storage is enabled, this is needed
- It changes LUInitCluster.CheckPrereq() to skip _HasValidVG check
  initializing the cluster with --no-lvm-storage. Furthermore it adds to
  the help message the statement of the possibility to use
  --no-lvm-storage if no 'xenvg' volume group is found.

Reviewed-by: iustinp

16 years agoAdd LUSetClusterParams to cmdlib
Manuel Franceschini [Mon, 31 Mar 2008 10:59:17 +0000 (10:59 +0000)]
Add LUSetClusterParams to cmdlib

Add LUSetClusterParams, which is the LU to modify cluster options.
This includes checks:
- not to disable lvm storage when it's already disabled
- not to enable lvm storage when it is already enabled
- not to disable lvm when lvm-based instances are present
- that the specified volume group is valid on all cluster-nodes
  when lvm-storage is going to be enabled

Reviewed-by: iustinp

16 years agoAdd method SetVGName() to config.py
Manuel Franceschini [Mon, 31 Mar 2008 10:58:16 +0000 (10:58 +0000)]
Add method SetVGName() to config.py

Reviewed-by: iustinp

16 years agoAdd lvm-storage check when creating instances
Manuel Franceschini [Mon, 31 Mar 2008 10:57:58 +0000 (10:57 +0000)]
Add lvm-storage check when creating instances

This adds a check to fail instance creation if lvm-storage is disabled
(cluster-wide). If lvm-storage is disabled (by initializing the cluster
with --no-lvm-storage) only instances with disk template in frozenset
DTS_NOT_LVM are allowed to create.

Reviewed-by: iustinp

16 years agoAdd DEFAULT_VG and DTS_NOT_LVM to constants.py
Manuel Franceschini [Mon, 31 Mar 2008 10:57:21 +0000 (10:57 +0000)]
Add DEFAULT_VG and DTS_NOT_LVM to constants.py

DTS_NOT_LVM:
This constant is needed when checking if an instance can be created with
the given disk template if no lvm-storage is available, i.e. the ganeti
cluster does not have a volume group

DEFAULT_VG:
'xenvg' has been hardcoded before.

Reviewed-by: iustinp

16 years agoChange the order of config updates in some LUs
Iustin Pop [Sun, 30 Mar 2008 14:54:34 +0000 (14:54 +0000)]
Change the order of config updates in some LUs

In the start and stop instance LUs, the configuration update is done
right at the end. This means that if, for example, the instance shutdown
succeeds, but the drive deactivation fails, the next run of the watcher
will start the instance again, as it's still marked in running mode.

This patch changes these two LUs so that first the update the
configuration to the desired state, and only then we proceed to update
the config. This ensures that the state saved is the desired state.

Because the config might be updated even though the LU failed, this
patch also modifies the mcpu.Processor.ExecOpCode method to run the
RunConfigUpdate hook in a finally: phase while the lu.Exec is done in
its try phase. This ensures that config update hooks (tries to) run at
all times when the config is updated.

Reviewed-by: schreiberal

16 years agoFix a bug in interactive confirmation of instances
Iustin Pop [Thu, 27 Mar 2008 15:52:21 +0000 (15:52 +0000)]
Fix a bug in interactive confirmation of instances

This oneliner fixes a bug in listing more than twenty instances for
multiple operations (shutdown, startup, etc.).

Reviewed-by: imsnah

16 years agoReduce log noise for the new http-based rpc
Iustin Pop [Thu, 27 Mar 2008 15:46:50 +0000 (15:46 +0000)]
Reduce log noise for the new http-based rpc

This patch just removes an extraneous \n from the log message making it
nicer to view.

Reviewed-by: schreiberal

16 years agoAdd QA test for “gnt-instance console”
Michael Hanselmann [Thu, 27 Mar 2008 14:40:08 +0000 (14:40 +0000)]
Add QA test for “gnt-instance console”

Reviewed-by: iustinp

16 years agoAdd --print parameter to “gnt-instance console”
Michael Hanselmann [Thu, 27 Mar 2008 14:39:47 +0000 (14:39 +0000)]
Add --print parameter to “gnt-instance console”

This enables us to run automated tests on “gnt-instance console”, at least
to some degree.

Reviewed-by: iustinp

16 years agoReturn first parameter of console command only once
Michael Hanselmann [Thu, 27 Mar 2008 14:39:25 +0000 (14:39 +0000)]
Return first parameter of console command only once

Reviewed-by: iustinp

16 years agoModify Disk.GetNodes() to support LD_FILE
Manuel Franceschini [Tue, 25 Mar 2008 17:48:41 +0000 (17:48 +0000)]
Modify Disk.GetNodes() to support LD_FILE

Reviewed-by: iustinp

16 years agoAdd constants for file-based storage
Manuel Franceschini [Tue, 25 Mar 2008 17:48:09 +0000 (17:48 +0000)]
Add constants for file-based storage

Reviewed-by: iustinp

16 years agoRemove the option to create md/drbd7 instances
Iustin Pop [Tue, 25 Mar 2008 16:30:28 +0000 (16:30 +0000)]
Remove the option to create md/drbd7 instances

This patch removes the options that allow to create local_raid1 or
remote_raid1 instances. It also modifies the documentation and removes
these disk templates from burnin and from qa.

Reviewed-by: imsnah

16 years agoRemove the add/remove mirror operations
Iustin Pop [Tue, 25 Mar 2008 16:30:01 +0000 (16:30 +0000)]
Remove the add/remove mirror operations

These two operations are related to md/drbd7 code (remote_raid1). Remove
them as part of the md/drbd7 removal.

Reviewed-by: imsnah

16 years agoModify cluster-init to create file-storage-dir
Manuel Franceschini [Thu, 20 Mar 2008 15:55:17 +0000 (15:55 +0000)]
Modify cluster-init to create file-storage-dir

This patch adds three things:
- it normalizes the file storage directory path passed to gnt-cluster init
- if the file-storage-path doesn't exist on the master node, ganeti
  tries to create it
- adds additional check if the passed file-storage-dir is not a directory

Reviewed-by: iustinp

16 years agoRemove some deprecated code in bdev.py
Iustin Pop [Thu, 20 Mar 2008 10:51:55 +0000 (10:51 +0000)]
Remove some deprecated code in bdev.py

The BlockDev.GetStatus() method and some associated constants were never
used in the rest of the code. This patch removes them.

Reviewed-by: imsnah

16 years agoChange the opcode hierarchy and implementation
Iustin Pop [Wed, 19 Mar 2008 16:55:05 +0000 (16:55 +0000)]
Change the opcode hierarchy and implementation

This patch adds a new top-level class (BaseJO) that is used for both
opcodes and a new Job class.

This new class and the related changes to the OpCode abstract class are
used to implement simple to-dict/from-dict transformations, so that we
can easily serialize the classes using json.

Reviewed-by: imsnah

16 years agoAdd option to change default file_storage_dir
Manuel Franceschini [Wed, 19 Mar 2008 10:47:30 +0000 (10:47 +0000)]
Add option to change default file_storage_dir

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd support for file_storage_dir to LUInitCluster
Manuel Franceschini [Wed, 19 Mar 2008 10:47:10 +0000 (10:47 +0000)]
Add support for file_storage_dir to LUInitCluster

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd file_storage_dir to opcodes.OpInitCluster
Manuel Franceschini [Wed, 19 Mar 2008 10:46:50 +0000 (10:46 +0000)]
Add file_storage_dir to opcodes.OpInitCluster

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd SS_FILE_STORAGE_DIR to ssconf
Manuel Franceschini [Wed, 19 Mar 2008 10:46:28 +0000 (10:46 +0000)]
Add SS_FILE_STORAGE_DIR to ssconf

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd DEFAULT_FILE_STORAGE_DIR to constants
Manuel Franceschini [Wed, 19 Mar 2008 10:45:22 +0000 (10:45 +0000)]
Add DEFAULT_FILE_STORAGE_DIR to constants

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd FILE_STORAGE_DIR to be in lib/_autoconf.py
Manuel Franceschini [Wed, 19 Mar 2008 10:45:03 +0000 (10:45 +0000)]
Add FILE_STORAGE_DIR to be in lib/_autoconf.py

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoAdd file-storage-dir to configure.ac
Manuel Franceschini [Wed, 19 Mar 2008 10:44:28 +0000 (10:44 +0000)]
Add file-storage-dir to configure.ac

This adds the possibility to specify at configure-time the default file-storage-dir.

Author: manuel.franceschini
Reviewed-by: iustinp

16 years agoMake ganeti-noded create BDEV_CACHE_DIR automatically
Iustin Pop [Wed, 19 Mar 2008 10:17:36 +0000 (10:17 +0000)]
Make ganeti-noded create BDEV_CACHE_DIR automatically

Currently in order to deal with tmpfs /var/run, we create the
BDEV_CACHE_DIR in the init script. However, that does not cover all the
cases, and it's not a proper place to deal with it: for example, dealing
with not initialized clusters and the master node is more complicated.

Therefore, this patch does:
  - make ganeti-noded create the directory automatically
  - make ganeti-noded error out if it can't create it or it's already
    there but not a directory
  - remove the creation from the init.d script

Reviewed-by: ultrotter

16 years agoUse constants for “ssh” and “scp” binaries instead of magic values
Michael Hanselmann [Tue, 18 Mar 2008 13:04:33 +0000 (13:04 +0000)]
Use constants for “ssh” and “scp” binaries instead of magic values

Reviewed-by: ultrotter

16 years agoUse new ssh.WriteKnownHostsFile function
Michael Hanselmann [Tue, 18 Mar 2008 13:04:12 +0000 (13:04 +0000)]
Use new ssh.WriteKnownHostsFile function

This replaces very old code.

Reviewed-by: ultrotter

16 years agoUse new cluster alias in known_hosts file
Michael Hanselmann [Tue, 18 Mar 2008 13:03:59 +0000 (13:03 +0000)]
Use new cluster alias in known_hosts file

Reviewed-by: ultrotter

16 years agoUse new “tty” parameter on SshRunner.BuildCmd for “gnt-instance console”
Michael Hanselmann [Tue, 18 Mar 2008 13:03:40 +0000 (13:03 +0000)]
Use new “tty” parameter on SshRunner.BuildCmd for “gnt-instance console”

Reviewed-by: ultrotter

16 years agoAdd “tty” parameter to SshRunner.BuildCmd
Michael Hanselmann [Tue, 18 Mar 2008 13:03:21 +0000 (13:03 +0000)]
Add “tty” parameter to SshRunner.BuildCmd

This allows callers to allocate a pseudo-TTY easily.

Reviewed-by: ultrotter

16 years agoOrder SSH options alphabetically
Michael Hanselmann [Tue, 18 Mar 2008 13:03:07 +0000 (13:03 +0000)]
Order SSH options alphabetically

Reviewed-by: ultrotter

16 years agoMove SSH functions into a class
Michael Hanselmann [Tue, 18 Mar 2008 13:02:53 +0000 (13:02 +0000)]
Move SSH functions into a class

This renames some functions and does some minor codestyle cleanup.

Reviewed-by: ultrotter

16 years agoAdd function to write cluster SSH key to known_hosts file
Michael Hanselmann [Tue, 18 Mar 2008 13:02:14 +0000 (13:02 +0000)]
Add function to write cluster SSH key to known_hosts file

The whole Ganeti cluster has a single SSH key. Its fingerprint is
written to Ganeti's known_hosts file, together with an alias. This
allows us to always use that alias instead of the real hostname,
making management of the known_hosts file much easier.

This patch does not handle an upgrade from an earlier version.

Reviewed-by: ultrotter

16 years agoLocking: remove an empty space at End Of Line
Guido Trotter [Tue, 18 Mar 2008 10:09:04 +0000 (10:09 +0000)]
Locking: remove an empty space at End Of Line

Reviewed-by: imsnah

16 years agoIncrease SharedLock fairness
Guido Trotter [Tue, 18 Mar 2008 10:08:45 +0000 (10:08 +0000)]
Increase SharedLock fairness

Previously if a shared thread was notified, together with the rest, and was not
fast enough in waking up and acquiring the lock, another one could release it,
decide there were no more sharers, and let an exclusive one in instead. With
this patch we make sure all the shared holders which were waiting have passed,
before declaring it's time to make an exclusive one pass.

This also allows us to reintroduce a slight variation of the assertion removed
in r665, which makes our code safer.

Reviewed-by: imsnah

16 years agoSpecify better gnt-instance(8) replace-disks
Guido Trotter [Tue, 11 Mar 2008 10:33:04 +0000 (10:33 +0000)]
Specify better gnt-instance(8) replace-disks

The -s option when changing secondary node on a drbd template is implied, and
thus optional. Specify this in the manpage.

Reviewed-by: iustinp

16 years agoDisable cluster init with a reachable IP
Iustin Pop [Tue, 11 Mar 2008 07:44:49 +0000 (07:44 +0000)]
Disable cluster init with a reachable IP

Make the cluster init fail if the IP to which the cluster name resolved
is already reachable by the master node. This is not a foolproof
solution, but it allows a cheap method of detecting simple mistakes.

It will also disallow using the master node name as cluster name (which
is something good).

The only drawbacks that I see are:
  - you are not allowed to do this, which might come in handy in cluster
    upgrades; but since we support rename, this is mitigated
  - cluster init takes longer now (+the timeout value, set to 5
    seconds), but since this is a one-off operation, it should be ok

Reviewed-by: ultrotter

16 years agoModify utils.TcpPing to make source address optional
Iustin Pop [Tue, 11 Mar 2008 07:44:36 +0000 (07:44 +0000)]
Modify utils.TcpPing to make source address optional

This patch modifies TcpPing and its callers to make the source address
selection optional. Usually, the kernel will know better what
source address to use, just in some cases we want to enforce a given
source address so it makes sense to make this optional.

Reviewed-by: ultrotter

16 years agoFix gnt-instance replace-disks online help
Guido Trotter [Thu, 6 Mar 2008 16:34:08 +0000 (16:34 +0000)]
Fix gnt-instance replace-disks online help

The "quick" online help just reported the option to change secondary node. Add
the ones to just replace the disk locally on-primary or on-secondary. It is of
course impossible to espress in one line everything needed to use this command,
but at least now the most common options are spelled out immediately.

Reviewed-by: iustinp, imsnah

16 years agoReplace custom file writing code with utils.WriteFile
Michael Hanselmann [Wed, 5 Mar 2008 16:48:39 +0000 (16:48 +0000)]
Replace custom file writing code with utils.WriteFile

Reviewed-by: ultrotter

16 years agoCodestyle fixes: adding a few empty lines
Michael Hanselmann [Wed, 5 Mar 2008 14:39:41 +0000 (14:39 +0000)]
Codestyle fixes: adding a few empty lines

Reviewed-by: ultrotter

16 years agoLockSet: handle empty case
Guido Trotter [Tue, 4 Mar 2008 17:12:55 +0000 (17:12 +0000)]
LockSet: handle empty case

A LockSet is mostly useful when it has some locks in it. On the other hand
there are cases in which it must function even when empty. For example if a
cluster has no instances in it there's no reason why locking all of them
shouldn't work anyway. This patch adds test code for that situation and
implements the necessary fixes to make it work.

Reviewed-by: imsnah

16 years agoLockSet: add missing check code
Guido Trotter [Tue, 4 Mar 2008 17:12:33 +0000 (17:12 +0000)]
LockSet: add missing check code

This check that no operation had been performed before release() was missing in
the test code. Adding it.

Reviewed-by: imsnah