ganeti-local
15 years agojqueue: Always print message for 100% when inspecting queue
Michael Hanselmann [Fri, 28 Nov 2008 10:29:04 +0000 (10:29 +0000)]
jqueue: Always print message for 100% when inspecting queue

Reviewed-by: iustinp

15 years agognt-job: Print message from CancelJob to standard output
Michael Hanselmann [Fri, 28 Nov 2008 10:28:43 +0000 (10:28 +0000)]
gnt-job: Print message from CancelJob to standard output

Reviewed-by: iustinp

15 years agojqueue: Allow jobs waiting for locks to be canceled
Michael Hanselmann [Fri, 28 Nov 2008 10:28:31 +0000 (10:28 +0000)]
jqueue: Allow jobs waiting for locks to be canceled

- Add new "canceling" status
- Notify clients when job is canceled
- Give a return value from CancelJob
- Handle it in the client library

Reviewed-by: iustinp

15 years agoImprove the node add operation
Iustin Pop [Thu, 27 Nov 2008 10:38:41 +0000 (10:38 +0000)]
Improve the node add operation

Currently, the node add operation uses a job to query the node name and
the bootstrap function directly reads the config file for the cluster
name.

This patch changes to that both the cluster name and the verification of
the node is done via queries to the master.

Reviewed-by: ultrotter

15 years agoFix logic bug in rev 2072
Iustin Pop [Thu, 27 Nov 2008 10:21:46 +0000 (10:21 +0000)]
Fix logic bug in rev 2072

In revision 2072 "ConfigWriter: change cluster serial meaning" I misread
the serial_no update logic: it was about updating the serial number on
the object itself, not on the cluster.

So we don't actually have at all cluster serial number increase when a
node is changed (not removed/added).

This patch revers to the original always increase the target serial
number and adds increase of the cluster serial number in case a node has
been changed.

Reviewed-by: ultrotter

15 years agojqueue: fix a bug in an error path
Iustin Pop [Thu, 27 Nov 2008 03:13:49 +0000 (03:13 +0000)]
jqueue: fix a bug in an error path

Dictionaries raise KeyError, and not ValueError when invalid keys are
passes to del.

Reviewed-by: imsnah

15 years agoConfigWriter: change cluster serial meaning
Iustin Pop [Thu, 27 Nov 2008 03:13:37 +0000 (03:13 +0000)]
ConfigWriter: change cluster serial meaning

Currently, we increase the cluster serial number for instance additions,
removals and renames. This is conforming with the REST paradigm, however
it means that for each of these operations, we need to push ssconf
updates to all nodes.

In order to support future cases with reduced set of master-eligible
nodes, we want to reduce the ssconf pushes (which need to be to all
nodes). This patch changes the meaning for the cluster serial number so
that it doesn't track instance operations at all.

This means that addition of an instance can fail due to concurrent
additions, even if the cluster serial has not changed. It slightly
breaks the REST paradigm, but IMHO it's better for actual usage.

Reviewed-by: ultrotter

15 years agoinstance import: adapt to multi-disk/nic world
Iustin Pop [Thu, 27 Nov 2008 03:13:27 +0000 (03:13 +0000)]
instance import: adapt to multi-disk/nic world

This is mostly a copy from gnt-instance add; import works, but it's not
optimal - device count/parametrs should be able to be reused.

Reviewed-by: ultrotter

15 years agoFix gnt-backup export
Iustin Pop [Thu, 27 Nov 2008 03:13:17 +0000 (03:13 +0000)]
Fix gnt-backup export

This patch fixes a bug in disk calculation for gnt-backup export, which
completely broke one-disk instance export.

The patch also corrects some error messages and style issues.

Reviewed-by: ultrotter

15 years agoFix a message in LUExportInstance
Iustin Pop [Thu, 27 Nov 2008 03:13:05 +0000 (03:13 +0000)]
Fix a message in LUExportInstance

We never verified the node name before, so this is most likely not a
non-retrieve but a wrong name case.

Reviewed-by: ultrotter

15 years agoAllow network-less instances
Iustin Pop [Thu, 27 Nov 2008 03:12:53 +0000 (03:12 +0000)]
Allow network-less instances

Currently there's no way to specify no NICs for an instance, even though
this is a supported configuration.

The patch adds a --no-nics option to gnt-instance add.

Reviewed-by: amishchenko

15 years agoFix gnt-job submit
Iustin Pop [Thu, 27 Nov 2008 03:12:43 +0000 (03:12 +0000)]
Fix gnt-job submit

The submit function was using a very old API. This patch brings it up to
date.

Reviewed-by: imsnah

15 years agoSmall change to job failure output
Iustin Pop [Thu, 27 Nov 2008 03:12:31 +0000 (03:12 +0000)]
Small change to job failure output

Currently, job failures are done by raising OpExecError(job result). For
a one-opcode job that failed, this is very non-intuitive:
Failure: command execution error:
[u'Disk size change not possible, use grow-disk']

This patch changes the output in two ways:
 - for a job which didn't have opcodes which succeeded, it changes it
   to:
   Failure: command execution error:
   Disk size change not possible, use grow-disk
 - for a job with partial completion, to:
   Failure: command execution error:
   partial failure (opcode 1): Cannot remove the last disk of an
   instance

The actual error type is not changed. A job that doesn't have at least
an error-ed opcode is shown as before.

Reviewed-by: imsnah

15 years agoFix file-based block devices
Iustin Pop [Thu, 27 Nov 2008 03:12:18 +0000 (03:12 +0000)]
Fix file-based block devices

We changed a while ago the protocol for opening block devices, but
FileStorage was not changed. This patch makes it work again.

Reviewed-by: imsnah

15 years agoFix instance creation
Iustin Pop [Thu, 27 Nov 2008 03:12:07 +0000 (03:12 +0000)]
Fix instance creation

This patch fixes the diskless and drbd/file based instances. Sorry :(

Reviewed-by: ultrotter

15 years agoganeti-masterd: create RUN_GANETI_DIR as well
Guido Trotter [Wed, 26 Nov 2008 16:49:33 +0000 (16:49 +0000)]
ganeti-masterd: create RUN_GANETI_DIR as well

Since we're not sure ganeti-noded has started yet, we need to create
RUN_GANETI_DIR before SOCKET_DIR as well, with the proper permissions.

Reviewed-by: imsnah

15 years agoconvert run dir mode to constant
Guido Trotter [Wed, 26 Nov 2008 16:49:19 +0000 (16:49 +0000)]
convert run dir mode to constant

ganeti-noded used to create all directories under /var/run with an
hard-coded mode. convert it to a constant.

Reviewed-by: imsnah

15 years agojqueue: Log progress and load jobs one by one
Michael Hanselmann [Wed, 26 Nov 2008 16:16:03 +0000 (16:16 +0000)]
jqueue: Log progress and load jobs one by one

By logging more information, a user can see how far it is in inspecting
the queue. This can be useful with a large number of jobs. Also, instead
of loading all jobs in one go, load only the list of job IDs and then
load jobs one by one.

Reviewed-by: ultrotter

15 years agojqueue: Shutdown workerpool in case of a problem
Michael Hanselmann [Wed, 26 Nov 2008 16:15:34 +0000 (16:15 +0000)]
jqueue: Shutdown workerpool in case of a problem

Reviewed-by: ultrotter

15 years agoRAPI: Make calls safier
Oleksiy Mishchenko [Wed, 26 Nov 2008 11:25:34 +0000 (11:25 +0000)]
RAPI: Make calls safier

Reviewed-by: imsnah

15 years agoReduce duplication of work in rpc.Client
Iustin Pop [Wed, 26 Nov 2008 01:23:04 +0000 (01:23 +0000)]
Reduce duplication of work in rpc.Client

This patch removes the duplicate serialization and calls to
utils.GetNodeDaemonPort in rpc.Client, and instead moves them to calling
functions (the _*NodeCall ones recently introduced).

Reviewed-by: ultrotter

15 years agoMove the MASTER_SOCKET to SOCKET_DIR
Guido Trotter [Tue, 25 Nov 2008 17:11:27 +0000 (17:11 +0000)]
Move the MASTER_SOCKET to SOCKET_DIR

Before it was in the abstract linux namespace, where unfortunately we
couldn't easily check from python the credentials of the connecting
clients. Now we also have to remove the file on exit and when starting.

Reviewed-by: imsnah

15 years agoganeti-masterd: create SOCKET_DIR
Guido Trotter [Tue, 25 Nov 2008 17:11:13 +0000 (17:11 +0000)]
ganeti-masterd: create SOCKET_DIR

If SOCKET_DIR doesn't exist we create it in the master daemon, before
trying to put a socket inside it.

Reviewed-by: imsnah

15 years agoAdd SOCKET_DIR_MODE constant
Guido Trotter [Tue, 25 Nov 2008 17:10:58 +0000 (17:10 +0000)]
Add SOCKET_DIR_MODE constant

We want the socket dir to have a restricted permission.

Reviewed-by: imsnah

15 years agoAdd SOCKET_DIR constant
Guido Trotter [Tue, 25 Nov 2008 17:10:45 +0000 (17:10 +0000)]
Add SOCKET_DIR constant

This new directory under /var/run will be used for file based unix
sockets.

Reviewed-by: imsnah

15 years agoAdd very basic online help to devel/upload
Guido Trotter [Tue, 25 Nov 2008 17:10:33 +0000 (17:10 +0000)]
Add very basic online help to devel/upload

Reviewed-by: imsnah

15 years agoImplement support for multi devices changes
Iustin Pop [Tue, 25 Nov 2008 12:57:29 +0000 (12:57 +0000)]
Implement support for multi devices changes

This big patch adds support for:
  - changing NIC/disks in the multi-device model
  - adding/removing NICs
  - adding/removing disks

The patch is big and not very nice; the error checking paths are not
very clear.

The biggest problem is that from a simple instance.ATTR=VAL change
(which didn't throw errors before) now we are creating and removing
disks in this LU.

Reviewed-by: imsnah

15 years agoSlight change to the LU initialization code
Iustin Pop [Tue, 25 Nov 2008 12:57:13 +0000 (12:57 +0000)]
Slight change to the LU initialization code

This patch adds support for a separate LU.CheckArguments() method which
should do syntactic checks without holding locks and without polluting
the ExpandNames which is a lock-related function. See for example the
FIXME in LUSetInstanceParams.CheckPrereq.

The patch also removes the REQ_MASTER and IsCluster checks since with
the current architecture, inside LU code we are always in a valid
cluster and we are always running on the master node.

Reviewed-by: ultrotter

15 years agoFix a bug in LUSetInstanceParams
Iustin Pop [Tue, 25 Nov 2008 12:51:02 +0000 (12:51 +0000)]
Fix a bug in LUSetInstanceParams

The wrong names were reused in a copy-paste.

Reviewed-by: imsnah

15 years agoShow disk access mode in gnt-instance info
Iustin Pop [Tue, 25 Nov 2008 12:50:49 +0000 (12:50 +0000)]
Show disk access mode in gnt-instance info

The mode parameter needs to be exported and shown in the info output.

Reviewed-by: imsnah

15 years agoChange _GenerateDiskTemplate iv_name generation
Iustin Pop [Tue, 25 Nov 2008 12:50:35 +0000 (12:50 +0000)]
Change _GenerateDiskTemplate iv_name generation

Currently the _GenerateDiskTemplate assumes it does initial creation of
disks (i.e. it starts with index 0).

For dynamic disk adds, we need to pass an additional offset. This patch
adds this offset and modifies its sole current caller.

Reviewed-by: imsnah

15 years agoSlighly improve multi-nic in gnt-instance info
Iustin Pop [Tue, 25 Nov 2008 12:50:23 +0000 (12:50 +0000)]
Slighly improve multi-nic in gnt-instance info

Previously we had only one nic, so the NIC information was all on one
line. This patch changes it to:

    - NICs:
      - nic/0: MAC: aa:00:00:e8:b2:ef, IP: None, bridge: None
      - nic/1: MAC: aa:00:00:53:ca:92, IP: None, bridge: xen-br0
      - nic/2: MAC: aa:00:00:ba:e5:30, IP: None, bridge: None

Reviewed-by: ultrotter

15 years agoPass ssconf values from master to node
Michael Hanselmann [Tue, 25 Nov 2008 12:37:13 +0000 (12:37 +0000)]
Pass ssconf values from master to node

Instead of parsing the configuration on the node, we pass the ssconf
values from the master.

Reviewed-by: iustinp

15 years agoganeti.http: Don't reuse key and cert objects
Michael Hanselmann [Tue, 25 Nov 2008 11:18:58 +0000 (11:18 +0000)]
ganeti.http: Don't reuse key and cert objects

Reusing the private key and certificate objects gave us problems. This
patch changes the code to only cache the PEM data, but the objects
themselves. For every socket, the private key and certificate objects
are created again.

Reviewed-by: iustinp

15 years agoFix unittests broken by rev 2015
Michael Hanselmann [Mon, 24 Nov 2008 15:39:23 +0000 (15:39 +0000)]
Fix unittests broken by rev 2015

Ssconf files shouldn't be updated when running unittests.

Reviewed-by: ultrotter

15 years agoganeti.rpc: Read SSL certificate and key only once per request
Michael Hanselmann [Mon, 24 Nov 2008 13:38:06 +0000 (13:38 +0000)]
ganeti.rpc: Read SSL certificate and key only once per request

There's no need to read the SSL certificate and key for every node
in a request. Also add a TODO for better error reporting.

Reviewed-by: amishchenko

15 years agoDocumentation updates for mcpu.py
Iustin Pop [Mon, 24 Nov 2008 11:01:24 +0000 (11:01 +0000)]
Documentation updates for mcpu.py

This is the only change needed to make mcpu epydoc-compliant.

Reviewed-by: ultrotter

15 years agoLUCreateInstance: Fix import mac AUTO mode
Guido Trotter [Mon, 24 Nov 2008 09:48:11 +0000 (09:48 +0000)]
LUCreateInstance: Fix import mac AUTO mode

Previously on import LUCreateInstance used to recycle the mac if the instance
name was the same than the one used at export time. Now we do the same, but
apply the setting separately for each nic.

Reviewed-by: iustinp

15 years agoBurner: fix ImportExport
Guido Trotter [Mon, 24 Nov 2008 09:47:58 +0000 (09:47 +0000)]
Burner: fix ImportExport

Update the call to CreateInstance used in ImportExport to the new API for
multidisk/nic.

Reviewed-by: iustinp

15 years agoLUCreateInstance unlock all nodes mid-way
Guido Trotter [Mon, 24 Nov 2008 09:47:45 +0000 (09:47 +0000)]
LUCreateInstance unlock all nodes mid-way

When creating a new instance, after saving the instance data to the config file
and creating the disks, but before waiting for sync and installing the OS, we
release the node locks, to allow for more instance creations to proceed in
parallel.

Reviewed-by: iustinp

15 years agoIAllocator: subtract down instances from free mem
Guido Trotter [Mon, 24 Nov 2008 09:47:32 +0000 (09:47 +0000)]
IAllocator: subtract down instances from free mem

Currently free_memory just reports the amount of free ram, as seen by the
hypervisor. We adjust this amount by subtracting the memory for any instance
which is down, and the difference for any instance which is configured to have
more memory than the amount it's currently running at.

Reviewed-by: iustinp

15 years agoCorrect GetAllInstancesInfo rtype
Guido Trotter [Mon, 24 Nov 2008 09:46:49 +0000 (09:46 +0000)]
Correct GetAllInstancesInfo rtype

GetAllInstancesInfo, in the backend, returns just a dict, not a dict of dicts.

Reviewed-by: iustinp

15 years agoIAllocator: use the right hypervisor
Guido Trotter [Mon, 24 Nov 2008 09:46:21 +0000 (09:46 +0000)]
IAllocator: use the right hypervisor

Since the hypervisor is instance dependent we'll get one on instance creation,
and use the one in the instance config on relocation.

Reviewed-by: iustinp

15 years agoIAllocator: fill i_list in a more proper way
Guido Trotter [Mon, 24 Nov 2008 09:46:05 +0000 (09:46 +0000)]
IAllocator: fill i_list in a more proper way

- reuse the previously called cluster_info, rather than calling it again
- get all the instances from the config atomically, to prevent race conditions
- use a list comprehension, for simplicity

Reviewed-by: iustinp

15 years agoParallelize instance operations on the same node
Guido Trotter [Mon, 24 Nov 2008 09:45:11 +0000 (09:45 +0000)]
Parallelize instance operations on the same node

With static minors we don't have a race condition anymore when
starting/stopping/rebooting/reinstalling more than one instance on the same
node, so we'll drop node locking altogether.

Reviewed-by: iustinp

15 years agoConvert iallocator to the new _ComputeDiskSize
Guido Trotter [Mon, 24 Nov 2008 09:44:29 +0000 (09:44 +0000)]
Convert iallocator to the new _ComputeDiskSize

_ComputeDiskSize's API was changed for multidisk support in r2010, but
iallocator's call to it were not fixed. Converting them now.

Reviewed-by: iustinp

15 years agoDocumentation updates for cmdlib.py
Iustin Pop [Sun, 23 Nov 2008 15:35:26 +0000 (15:35 +0000)]
Documentation updates for cmdlib.py

This makes cmdlib.py not throw epydoc errors anymore.

Reviewed-by: ultrotter

15 years agoSlight change to the apidoc build
Iustin Pop [Sun, 23 Nov 2008 15:35:14 +0000 (15:35 +0000)]
Slight change to the apidoc build

Currently the temporary directory used for modules is under the current
directory; this patch changes it so a temp directory is used; so we
could build the apidocs with a R/O filesystem.

Reviewed-by: ultrotter

15 years agoOnly update ssconf on cluster serial change
Iustin Pop [Sun, 23 Nov 2008 15:35:02 +0000 (15:35 +0000)]
Only update ssconf on cluster serial change

There is no need to update ssconf if the cluster serial number has not
changed.

Reviewed-by: ultrotter

15 years agoEnable auto-unit formatting in script output
Iustin Pop [Sun, 23 Nov 2008 15:34:50 +0000 (15:34 +0000)]
Enable auto-unit formatting in script output

This patch enables by default the old 'human-readable' option, but in a
slightly different model.

The option is now called "units" and takes either:
 - 'h' for automatic formatting
 - 'm', 'g' or 't' for mebi/gibi/tebibytes

If 'h' is used, we add a unit suffix, otherwise nothing is added so that
parsing is easy.

The default value of this unit is:
  - 'h' if a separator is not passed
  - 'm' if a separator is passed

Reviewed-by: ultrotter

15 years agoImprovements to CLI output
Iustin Pop [Sun, 23 Nov 2008 15:34:30 +0000 (15:34 +0000)]
Improvements to CLI output

This patch adds nicer formatting for some gnt-instance list operations.

Reviewed-by: ultrotter

15 years agoRAPI: Cancel a job
Oleksiy Mishchenko [Fri, 21 Nov 2008 15:55:25 +0000 (15:55 +0000)]
RAPI: Cancel a job

Reviewed-by: imsnah

15 years agoMake cli.py use FieldSet for matching fields
Iustin Pop [Fri, 21 Nov 2008 15:36:08 +0000 (15:36 +0000)]
Make cli.py use FieldSet for matching fields

This changes cli.py to FieldSet usage so that gnt-instance list will
format nicely the disk.size/*, and the count of disks/nics.

Reviewed-by: ultrotter

15 years agoMove FieldSet class to utils.py
Iustin Pop [Fri, 21 Nov 2008 15:35:52 +0000 (15:35 +0000)]
Move FieldSet class to utils.py

Since we can use the FieldSet class in cli.py to nicely format disk
sizes and such, we move it to utils.py and also move its associated
unittest. I didn't remove the cmdlib.py unittest file as that's not the
good direction :)

Reviewed-by: ultrotter

15 years agoSmall burnin info message change
Iustin Pop [Fri, 21 Nov 2008 15:35:30 +0000 (15:35 +0000)]
Small burnin info message change

This looks beter than '0 disk'.

Reviewed-by: ultrotter

15 years agoburnin: fix default growth parameter
Iustin Pop [Fri, 21 Nov 2008 15:35:18 +0000 (15:35 +0000)]
burnin: fix default growth parameter

Reviewed-by: ultrotter

15 years agoChange disk index validation to FindDisk
Iustin Pop [Fri, 21 Nov 2008 15:35:06 +0000 (15:35 +0000)]
Change disk index validation to FindDisk

This patch replaces the hand validation of the disk index with the
instance.FindDisk method (actually reverting to previous method, before
the multi-disk, but now with indexes).

Reviewed-by: ultrotter

15 years agoChange GrowDisk to work with multi-disk
Iustin Pop [Fri, 21 Nov 2008 15:34:53 +0000 (15:34 +0000)]
Change GrowDisk to work with multi-disk

This patch changes the instance.FindDisk method to take index arguments
(instead of iv_names), and changes GrowDisk and list instances
accordingly.

Reviewed-by: ultrotter

15 years agoUse SSL for master/node RPC
Michael Hanselmann [Fri, 21 Nov 2008 10:47:15 +0000 (10:47 +0000)]
Use SSL for master/node RPC

This patch enables SSL between masterd and noded.

Reviewed-by: iustinp

15 years agoGet rid of node daemon password
Michael Hanselmann [Fri, 21 Nov 2008 10:46:58 +0000 (10:46 +0000)]
Get rid of node daemon password

With the new SSL client certificate stuff it's no longer needed.

Reviewed-by: iustinp

15 years agoganeti.http: Add another class to contain SSL key and certificate
Michael Hanselmann [Fri, 21 Nov 2008 10:46:34 +0000 (10:46 +0000)]
ganeti.http: Add another class to contain SSL key and certificate

Otherwise we would read them for every request the HTTP client
makes against a server and this is not needed.

Reviewed-by: iustinp

15 years agoganeti-masterd: Remove PID file at the end
Michael Hanselmann [Fri, 21 Nov 2008 10:46:12 +0000 (10:46 +0000)]
ganeti-masterd: Remove PID file at the end

Removing the PID file should be the last thing done. This patch makes
sure it's also removed when master.server_cleanup() throws an exception.

Also initialize logging only after writing the PID file.

Reviewed-by: iustinp

15 years agoReuse HTTP client pool for RPC
Michael Hanselmann [Fri, 21 Nov 2008 10:45:56 +0000 (10:45 +0000)]
Reuse HTTP client pool for RPC

ganeti-masterd: Add initialization and shutdown of RPC pool. It needs
to be shutdown before forking.

ganeti.cli: Add decorator function to initialize and shutdown RPC pool.

ganeti.rpc: Add functions to initialize and shutdown RPC pool. Throw
exception when used without proper initialization.

gnt-cluster, gnt-node: Use decorator function to initialize and shutdown
RPC pool.

Reviewed-by: iustinp

15 years agoWrite ssconf files when updating configuration
Michael Hanselmann [Fri, 21 Nov 2008 10:42:37 +0000 (10:42 +0000)]
Write ssconf files when updating configuration

Reviewed-by: ultrotter

15 years agoAdd RPC call to update ssconf files
Michael Hanselmann [Fri, 21 Nov 2008 10:42:07 +0000 (10:42 +0000)]
Add RPC call to update ssconf files

Reviewed-by: iustinp

15 years agoChange replace secondary to work with multi-disk
Iustin Pop [Fri, 21 Nov 2008 06:22:01 +0000 (06:22 +0000)]
Change replace secondary to work with multi-disk

Also fix an error in the CheckPrereq.

Reviewed-by: imsnah

15 years agoganeti.ssconf: Add function to write ssconf files
Michael Hanselmann [Thu, 20 Nov 2008 12:50:54 +0000 (12:50 +0000)]
ganeti.ssconf: Add function to write ssconf files

This function will be used to write ssconf files from the node daemon.
By creating a lock file, we synchronize different child processes of
ganeti-noded to not overwrite each other's changes. Also, external
processes could use this lock to make sure they don't read ssconf
files while changes are going on.

The socket module is not used (anymore) in ganeti.ssconf, removing it.

Reviewed-by: iustinp

15 years agoConvert replace-disks (same nodes) to multi-disk
Iustin Pop [Thu, 20 Nov 2008 06:22:52 +0000 (06:22 +0000)]
Convert replace-disks (same nodes) to multi-disk

This patch changes the drbd8 replace disk only (no secondary change) to
work in with multi-disk. This mode of replaces works correctly with
replacing only a subset of disks.

Reviewed-by: imsnah

15 years agoInitial multi-disk/multi-nic support
Iustin Pop [Thu, 20 Nov 2008 06:22:39 +0000 (06:22 +0000)]
Initial multi-disk/multi-nic support

This patch adds support for mult-disk/multi-nic in:
  - instance add
  - burnin

The start/stop/failover/cluster verify work as expected. Replace disk
and grow disk are TODO.

There's also a change gnt-job to allow dictionaries to be listed in
gnt-job info.

Reviewed-by: imsnah

15 years agoAdd more disk/nic listing options in gnt-instance
Iustin Pop [Thu, 20 Nov 2008 06:19:19 +0000 (06:19 +0000)]
Add more disk/nic listing options in gnt-instance

This adds some more listing cases (useful for scripting/rapi):
  - disk.sizes for a list of all sizes
  - nic.(ips|macs|bridges)

Reviewed-by: imsnah

15 years agoChange Xen hypervisor to not use iv_name
Iustin Pop [Thu, 20 Nov 2008 06:18:45 +0000 (06:18 +0000)]
Change Xen hypervisor to not use iv_name

Currently the iv_name is very linux-specific, and will break with the
multi-disk changes.

The patch changes this to generate sdX names based on the disk index in
the disks structure, instead of relying on the iv_name.

Reviewed-by: imsnah

15 years agoganeti.rpc: Use central functions for actual RPC calls
Michael Hanselmann [Wed, 19 Nov 2008 13:18:41 +0000 (13:18 +0000)]
ganeti.rpc: Use central functions for actual RPC calls

Before we had lots, lots and lots of code duplication. This patch
changes the code to use four central functions.

Reviewed-by: iustinp

15 years agoMake HttpClientManager threadsafe
Michael Hanselmann [Wed, 19 Nov 2008 13:18:08 +0000 (13:18 +0000)]
Make HttpClientManager threadsafe

This allows a single HttpClientManager to be used from more than one
thread at the same time. We discussed having one HttpClientManager
per job queue thread. Assuming there should be one HTTP thread per
node, this would mean quadratic growth with the number of nodes. By
being able to reuse the manager, this problem is a defused a bit.

This patch also fixes a typo in HttpClientRequestExecutor.

Reviewed-by: iustinp

15 years agoHTTP server: Do not decode empty entity body
Oleksiy Mishchenko [Wed, 19 Nov 2008 12:59:08 +0000 (12:59 +0000)]
HTTP server: Do not decode empty entity body

Reviewed-by: imsnah

15 years agoRAPI: Instance modify.
Oleksiy Mishchenko [Wed, 19 Nov 2008 11:09:26 +0000 (11:09 +0000)]
RAPI: Instance modify.

Split parameters filter to the separate function and reuse it in instance creation.

15 years agoSkip another testWaitingXblocksY
Iustin Pop [Tue, 18 Nov 2008 11:30:26 +0000 (11:30 +0000)]
Skip another testWaitingXblocksY

The waiting sharer blocks exclusive is another not-possible to test
right now.

Sorry for missing it the first time; there are no other testWaiting...
tests.

Reviewed-by: ultrotter

15 years agoAllow querying of variable number of parameters
Iustin Pop [Tue, 18 Nov 2008 10:06:01 +0000 (10:06 +0000)]
Allow querying of variable number of parameters

This patch adds support for querying in gnt-instance list of:
  - disk.count
  - nic.count
  - disk.size/$N
  - nic.(ip|mac|bridge)/$N

The patch also disables the exception raised when the header description
is missing, that should be fixed in the future (together with better
handling of variable numeric fields).

Reviewed-by: imsnah

15 years agoConvert cmdlib.py to _FieldSet
Iustin Pop [Tue, 18 Nov 2008 10:04:34 +0000 (10:04 +0000)]
Convert cmdlib.py to _FieldSet

This patch converts the current usage of _CheckOutputFields to the
FieldSet class, but it doesn't start to use its variable matching
features.

Reviewed-by: ultrotter

15 years agoAdd a FieldSet class for variable parameter sets
Iustin Pop [Tue, 18 Nov 2008 10:00:28 +0000 (10:00 +0000)]
Add a FieldSet class for variable parameter sets

This patch adds a _FieldSet class that can be used for the new variable
parameter sets: e.g. the sda_size will change to disk/0.size (or
similar) and we need to both check validity and extract the index of the
parameter easily.

The patch also sorts the unittest list in Makefile.am.

Reviewed-by: ultrotter

15 years agoSkip the waitingExclusiveBlockSharer test
Iustin Pop [Tue, 18 Nov 2008 09:58:07 +0000 (09:58 +0000)]
Skip the waitingExclusiveBlockSharer test

Until we have a way to properly test this, we'll skip the test.

Reviewed-by: imsnah

15 years agoMore updates to the documentation
Iustin Pop [Mon, 17 Nov 2008 11:30:42 +0000 (11:30 +0000)]
More updates to the documentation

This patch removes the client-api.txt document (since it's obsoleted by
the documentation inside the design-2.0.rst document) and adds many
updates to the latter.

Reviewed-by: imsnah

15 years agoFix distcheck with the new dot/png rules
Iustin Pop [Mon, 17 Nov 2008 11:30:21 +0000 (11:30 +0000)]
Fix distcheck with the new dot/png rules

Adding a new filetype/make rule requires more work than the previous
patch. Sorry! Now pases distcheck.

Reviewed-by: imsnah

15 years agoAdd a cluster architecture diagram
Iustin Pop [Sun, 16 Nov 2008 06:24:27 +0000 (06:24 +0000)]
Add a cluster architecture diagram

This adds a simple diagram for the cluster architecture and also adds a
dependency on graphviz (both doc and in configure).

Reviewed-by: imsnah

15 years agoCombine the 2.0 design documents into one
Iustin Pop [Sun, 16 Nov 2008 06:24:08 +0000 (06:24 +0000)]
Combine the 2.0 design documents into one

This patch combines all the design documents for 2.0 except the
security one into a single document, in order to ease reading and reduce
duplication of information.

Future patches will start removing wrong pointers to old document names
and some better integration between the sections.

Reviewed-by: imsnah

15 years agoRAPI: Instance startup/shutdown resources
Oleksiy Mishchenko [Fri, 14 Nov 2008 16:59:23 +0000 (16:59 +0000)]
RAPI: Instance startup/shutdown resources

Reviewed-by: imsnah

15 years agoRAPI: Implement an instance reboot
Oleksiy Mishchenko [Fri, 14 Nov 2008 10:34:34 +0000 (10:34 +0000)]
RAPI: Implement an instance reboot

Reviewed-by: imsnah

15 years agoUse utils.ReadFile to read SSL certificate
Michael Hanselmann [Wed, 12 Nov 2008 12:52:18 +0000 (12:52 +0000)]
Use utils.ReadFile to read SSL certificate

Reviewed-by: iustinp

15 years agoganeti.rpc: Use utils.ReadFile instead of reading file directly
Michael Hanselmann [Wed, 12 Nov 2008 12:52:07 +0000 (12:52 +0000)]
ganeti.rpc: Use utils.ReadFile instead of reading file directly

Reviewed-by: iustinp

15 years agoutils.SetupLogging: Remove previously setup handlers
Michael Hanselmann [Wed, 12 Nov 2008 12:51:54 +0000 (12:51 +0000)]
utils.SetupLogging: Remove previously setup handlers

If a logging function is called before the logging module is setup
using utils.SetupLogging, it calls logging.basicConfig, which adds
a StreamHandler, on its own. If we leave it in, all log output will
be printed twice on stderr. This patch makes sure to remove all
handlers before adding our own.

Reviewed-by: iustinp

15 years agojqueue: Always use rpc.RpcRunner
Michael Hanselmann [Wed, 12 Nov 2008 12:51:39 +0000 (12:51 +0000)]
jqueue: Always use rpc.RpcRunner

"from ganeti.rpc import RpcRunner" does not conform to the style guide.

Reviewed-by: iustinp

15 years agobootstrap: Always use rpc.RpcRunner
Michael Hanselmann [Wed, 12 Nov 2008 12:51:28 +0000 (12:51 +0000)]
bootstrap: Always use rpc.RpcRunner

"from ganeti.rpc import RpcRunner" does not conform to the style guide.

Reviewed-by: iustinp

15 years agoganeti.rpc: Convert to ganeti.serializer
Michael Hanselmann [Wed, 12 Nov 2008 12:50:53 +0000 (12:50 +0000)]
ganeti.rpc: Convert to ganeti.serializer

This is one of the last places where the simplejson module is
used directly.

Reviewed-by: iustinp

15 years agoConvert RPC module to new HTTP client
Michael Hanselmann [Wed, 12 Nov 2008 12:50:41 +0000 (12:50 +0000)]
Convert RPC module to new HTTP client

Currently, HttpClientManager is instantiated for every RPC call. This
will be changed with another patch, as will the use of SSL. The “Run”
method is no longer needed.

Reviewed-by: iustinp

15 years agoConvert the locking unittests to repetition-test
Iustin Pop [Wed, 12 Nov 2008 06:25:11 +0000 (06:25 +0000)]
Convert the locking unittests to repetition-test

Currently the locking tests are using timeouts to ensure an event will
'never happen'. However, this is suboptimal.

The patch converts all of these to instead: not wait, but sequence the
operations logically and expect that they execute as such. In case of
not so, they will timeout with a big (60s) timeout.

The 'never happen' is tested by multiple repetitions of the same test -
this is not perfect, but again 'X will never happen' is not actually
testable.

This patch reduces the runtime of the tests from ~5.4 to ~0.8 seconds
(with 8 repetitions of each test thas has 'never happen' situations).

Reviewed-by: imsnah

15 years agoFix utils.KillProcess
Iustin Pop [Wed, 12 Nov 2008 03:43:12 +0000 (03:43 +0000)]
Fix utils.KillProcess

Rev 1978 introduced a breakage on the SIGKILL finall signal to the
process, due to mistyped variable.

Reviewed-by: francis.perron

15 years agoganeti.http: Implement SSL for HTTP client
Michael Hanselmann [Tue, 11 Nov 2008 16:16:08 +0000 (16:16 +0000)]
ganeti.http: Implement SSL for HTTP client

Implementing SSL for the HTTP client required more work than I expected.
For correct error handling, quite a lot of code is needed. To avoid
code duplication, I moved a lot of the socket handling code into a
single function named _SocketOperation. It takes care of the polling
and error handling for OpenSSL. At the same time, the functions calling
it become a lot smaller.

This patch brings a few more changes:
- Error handling for socket.connect_ex (e.g. name resolution failures)
- Rename "ResponseError" exception class to "_HttpClientError" --
  it's an internal class anyway

Reviewed-by: iustinp

15 years agoganeti.daemon: Add timers to Mainloop
Michael Hanselmann [Tue, 11 Nov 2008 11:02:49 +0000 (11:02 +0000)]
ganeti.daemon: Add timers to Mainloop

This is a fallout from my work on the HTTP client class. Repeating
timers are prepared, but not yet implemented.

Reviewed-by: iustinp

15 years agoConvert trunk to posix-compatibility
Iustin Pop [Tue, 11 Nov 2008 10:58:50 +0000 (10:58 +0000)]
Convert trunk to posix-compatibility

We change two functions to use RunCmd without shell, and the other
(which needs a ssh command line) is changed to the '>... 2>&1' syntax.

Reviewed-by: imsnah

15 years agoAbstract runtime creation of dirs into a function
Iustin Pop [Tue, 11 Nov 2008 10:58:39 +0000 (10:58 +0000)]
Abstract runtime creation of dirs into a function

Currently the dir creation in ganeti-noded is in the main function. This
is not nice: we move it into a separate function and also add creation
of the OS_LOG_DIR (with different permissions, but in the same way).
This will permit cleanup of the creation of the OS_LOG_DIR from the
backend module (it's done multiple places currently).

Reviewed-by: imsnah

15 years agoRemove zombie special case from IsProcessAlive
Iustin Pop [Tue, 11 Nov 2008 10:58:28 +0000 (10:58 +0000)]
Remove zombie special case from IsProcessAlive

Based on the discussion on the mailing list, we remove the special
casing of zombie processes.

Note we don't use kill -0 since that has a different meaning than "check
process is alive", so this function is still linux-specific.

Reviewed-by: imsnah