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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Iustin Pop [Wed, 16 Apr 2008 14:07:01 +0000 (14:07 +0000)]
A pure whitespace change for style compliance
Reviewed-by: amishchenko
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
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
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
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
Guido Trotter [Tue, 15 Apr 2008 16:12:25 +0000 (16:12 +0000)]
Fix two pylint uninitialized variable errors
Reviewed-by: iustinp
Manuel Franceschini [Tue, 15 Apr 2008 14:47:31 +0000 (14:47 +0000)]
Bugfix: wrong identifier in CheckPrereq message
Reviewed-by: iustinp
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Manuel Franceschini [Thu, 10 Apr 2008 09:12:38 +0000 (09:12 +0000)]
Small code style fix
Reviewed-by: imsnah
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
Manuel Franceschini [Tue, 8 Apr 2008 16:28:40 +0000 (16:28 +0000)]
Two small code style fixes
Reviewed-by: imsnah
Manuel Franceschini [Tue, 8 Apr 2008 16:01:56 +0000 (16:01 +0000)]
Modify gnt-instance to support file backend
Reviewed-by: ultrotter
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
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
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
Michael Hanselmann [Tue, 8 Apr 2008 15:05:14 +0000 (15:05 +0000)]
Bump version number to 1.3.0~alpha1
Reviewed-by: iustinp
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
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
Michael Hanselmann [Tue, 8 Apr 2008 12:54:22 +0000 (12:54 +0000)]
Remove support for Pickle configuration files
Reviewed-by: iustinp
Michael Hanselmann [Tue, 8 Apr 2008 12:54:08 +0000 (12:54 +0000)]
Add more explicit help for command line
Reviewed-by: iustinp
Michael Hanselmann [Tue, 8 Apr 2008 12:53:51 +0000 (12:53 +0000)]
Update copyright year, imports of cfgupgrade
Reviewed-by: iustinp
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
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
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
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
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
Manuel Franceschini [Sat, 5 Apr 2008 12:45:34 +0000 (12:45 +0000)]
rpc directory functions for file backend
Reviewed-by: ultrotter
Manuel Franceschini [Sat, 5 Apr 2008 12:40:22 +0000 (12:40 +0000)]
ganeti-noded directory functions for file backend
Reviewed-by: ultrotter
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
Manuel Franceschini [Fri, 4 Apr 2008 16:53:05 +0000 (16:53 +0000)]
Fix SetVGName() to access object not dict
Reviewed-by: imsnah
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
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
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
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
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
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
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
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
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
Guido Trotter [Wed, 2 Apr 2008 09:53:10 +0000 (09:53 +0000)]
Locking: fix one indentation error (codestyle)
Reviewed-by: imsnah
Guido Trotter [Wed, 2 Apr 2008 09:52:56 +0000 (09:52 +0000)]
Locking: fix superlong lines (codestyle)
Reviewed-by: imsnah
Michael Hanselmann [Tue, 1 Apr 2008 16:52:43 +0000 (16:52 +0000)]
Check whether path is valid before accessing it
Reviewed-by: ultrotter
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
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
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
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
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
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
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
Iustin Pop [Mon, 31 Mar 2008 13:12:04 +0000 (13:12 +0000)]
Change the gnt-backup export help text
Reviewed-by: ultrotter
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
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
Manuel Franceschini [Mon, 31 Mar 2008 11:00:24 +0000 (11:00 +0000)]
Map OpSetClusterParams to correponding LU
Reviewed-by: iustinp
Manuel Franceschini [Mon, 31 Mar 2008 11:00:10 +0000 (11:00 +0000)]
Add OpSetClusterParams to opcodes
Reviewed-by: iustinp
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
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
Manuel Franceschini [Mon, 31 Mar 2008 10:58:16 +0000 (10:58 +0000)]
Add method SetVGName() to config.py
Reviewed-by: iustinp
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
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
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
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