ganeti-local
13 years agoAdd _CheckIAllocatorOrNode for common iallocator/node checks
Apollon Oikonomopoulos [Thu, 8 Jul 2010 12:03:58 +0000 (15:03 +0300)]
Add _CheckIAllocatorOrNode for common iallocator/node checks

_CheckIAllocatorOrNode will be called by LUs wishing to use an instance
allocator or a target node. It performs sanity checks and will modify the LU's
opcode's iallocator slot to use the cluster-wide allocator if
appropriate.

Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoDocument the default instance allocator in gnt-cluster.sgml
Apollon Oikonomopoulos [Thu, 8 Jul 2010 12:03:26 +0000 (15:03 +0300)]
Document the default instance allocator in gnt-cluster.sgml

Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoAdd default_iallocator cluster parameter
Apollon Oikonomopoulos [Thu, 8 Jul 2010 12:02:55 +0000 (15:02 +0300)]
Add default_iallocator cluster parameter

Add a cluster parameter to hold the iallocator that will be used by default
when required and no alternative (manually-specified iallocator or
manually-specified node(s)) is given.

Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoLXC: Report actual number of CPUs
Balazs Lecz [Wed, 7 Jul 2010 15:57:00 +0000 (15:57 +0000)]
LXC: Report actual number of CPUs

Signed-off-by: Balazs Lecz <leczb@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoMerge branch 'devel-2.1'
Luca Bigliardi [Wed, 7 Jul 2010 14:48:37 +0000 (15:48 +0100)]
Merge branch 'devel-2.1'

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoMlockall: decrease warnings if ctypes module is not present
Luca Bigliardi [Tue, 6 Jul 2010 14:28:58 +0000 (15:28 +0100)]
Mlockall: decrease warnings if ctypes module is not present

Node daemon prints a lot of warnings if --no-mlock option is not specified and
ctypes module is not present.

With the following patch the warning is printed only at noded startup.

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoAdd a delay in master failover
Iustin Pop [Tue, 6 Jul 2010 12:20:15 +0000 (14:20 +0200)]
Add a delay in master failover

I have seen some very seldom errors where (it seems) the address is
still live for a short while after removing it from the old master, thus
the new master will fail in startup/adding its own IP address.

To prevent against this, we add a delay/retry before we proceed, if the
IP is still reachable.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
(cherry picked from commit 425f0f5470c912ff4a615d14c8b924116abe5c92)

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoLXC: Use lxc-info to get instance info
Balazs Lecz [Tue, 6 Jul 2010 17:58:09 +0000 (17:58 +0000)]
LXC: Use lxc-info to get instance info

Signed-off-by: Balazs Lecz <leczb@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoLXC: add lxc.console to the generated lxc.conf file
Balazs Lecz [Mon, 5 Jul 2010 14:48:39 +0000 (14:48 +0000)]
LXC: add lxc.console to the generated lxc.conf file

Signed-off-by: Balazs Lecz <leczb@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoMerge branch 'devel-2.1'
Iustin Pop [Wed, 7 Jul 2010 08:06:08 +0000 (10:06 +0200)]
Merge branch 'devel-2.1'

* devel-2.1:
  QA, burnin: allow selection of reboot types
  Add a QA option to disable reboots during burnin

Conflicts:
qa/qa-sample.json (trivial)
qa/qa_cluster.py  (trivial)

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Luca Bigliardi <shammash@google.com>

13 years agoQA, burnin: allow selection of reboot types
Iustin Pop [Tue, 6 Jul 2010 16:52:41 +0000 (18:52 +0200)]
QA, burnin: allow selection of reboot types

After some more investigation, only the soft reboot type fails for Xen
3.4 (due to the reboot/uptime time counter). As such, it's better to
allow selective testing, since we do want to test in general these
opcodes/the command line script.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Luca Bigliardi <shammash@google.com>

13 years agoFix a typo in gnt-instance's man page
Iustin Pop [Tue, 6 Jul 2010 14:55:56 +0000 (16:55 +0200)]
Fix a typo in gnt-instance's man page

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoRework the export failure handling
Iustin Pop [Tue, 6 Jul 2010 14:49:45 +0000 (16:49 +0200)]
Rework the export failure handling

Currently, the way to signal export failures is by the return value.
This means that if a client doesn't check the values (e.g. burnin), any
failure is being ignore. And this is what we've been doing forever in
burning (not actually testing that the export is successful).

This patch changes the behaviour of ExportInstance: it will abort with
an exception for any error, and removes the custom handling from
gnt-backup. This makes the behaviour consistent for any client (e.g.
RAPI), and it prevents false positives. If, for a given instance, a
subset of disks should not be backed up, the OS scripts should handle
that case.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agognt-instance: fix GenericManyOps
Iustin Pop [Tue, 6 Jul 2010 13:33:05 +0000 (15:33 +0200)]
gnt-instance: fix GenericManyOps

Currently, GenericManyOps ignores the actual success or failure results
from the invididual jobs. We change this to return '0' (i.e. success)
only when all jobs failed, as many times we have just one job.

Together with the JobExecutor change, this will report failures
correctly when used with a drained queue and submit only, or when used
normally and the opcode actually fails.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agocli.JobExecutor.WaitOrShow: always return status
Iustin Pop [Tue, 6 Jul 2010 13:29:36 +0000 (15:29 +0200)]
cli.JobExecutor.WaitOrShow: always return status

Currently, for the 'wait' case, we return a list of tuples (status,
result), in the order of submitted jobs, but we don't return anything
for the no-wait case.

This patch changes the no-wait case to return a list of tuples (status,
result), where result can be either a job ID or an error message.
Processing in clients can then ignore whether we did wait or not, and
test the overall or individual status.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoFix opcode transition from WAITLOCK to RUNNING
Iustin Pop [Tue, 6 Jul 2010 13:14:08 +0000 (15:14 +0200)]
Fix opcode transition from WAITLOCK to RUNNING

With the recent changes in the job queue, an old bug surfaced: we never
serialized the status change when in NotifyStart, thus a crash of the
master would have left the job queue oblivious to the fact that the job
was actually running.

In the previous implementation, queries against the job status were
using the in-memory object, so they 'saw' and reported correctly the
running status. But the new implementation just looks at the on-disk
version, and thus didn't see this transition.

The patch also moves NotifyStart to a decorator-based version (like the
other functions), which generates a lot of churn in the diff, sorry.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agohv_chroot: use utils.GetMounts()
Balazs Lecz [Mon, 5 Jul 2010 18:27:10 +0000 (18:27 +0000)]
hv_chroot: use utils.GetMounts()

Signed-off-by: Balazs Lecz <leczb@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoLXC: use utils.GetMounts()
Balazs Lecz [Mon, 5 Jul 2010 17:57:27 +0000 (17:57 +0000)]
LXC: use utils.GetMounts()

Signed-off-by: Balazs Lecz <leczb@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoAdd utils.GetMounts()
Balazs Lecz [Mon, 5 Jul 2010 16:20:17 +0000 (16:20 +0000)]
Add utils.GetMounts()

Signed-off-by: Balazs Lecz <leczb@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoAdd a delay in master failover
Iustin Pop [Tue, 6 Jul 2010 12:20:15 +0000 (14:20 +0200)]
Add a delay in master failover

I have seen some very seldom errors where (it seems) the address is
still live for a short while after removing it from the old master, thus
the new master will fail in startup/adding its own IP address.

To prevent against this, we add a delay/retry before we proceed, if the
IP is still reachable.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

13 years agognt-cluster: deal with drbd helper in init/modify/info
Luca Bigliardi [Mon, 28 Jun 2010 16:06:20 +0000 (17:06 +0100)]
gnt-cluster: deal with drbd helper in init/modify/info

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoAdd drbd helper and storage options
Luca Bigliardi [Mon, 28 Jun 2010 16:04:47 +0000 (17:04 +0100)]
Add drbd helper and storage options

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoReport drbd helper in query info LU
Luca Bigliardi [Mon, 28 Jun 2010 16:04:13 +0000 (17:04 +0100)]
Report drbd helper in query info LU

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoCheck and set drbd helper in set params LU
Luca Bigliardi [Mon, 28 Jun 2010 16:03:21 +0000 (17:03 +0100)]
Check and set drbd helper in set params LU

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoCheck and set drbd helper during bootstrap
Luca Bigliardi [Mon, 28 Jun 2010 15:51:06 +0000 (16:51 +0100)]
Check and set drbd helper during bootstrap

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoAdd drbd_helper rpc call
Luca Bigliardi [Mon, 28 Jun 2010 15:47:40 +0000 (16:47 +0100)]
Add drbd_helper rpc call

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoCheck drbd usermode helper in cluster verify
Luca Bigliardi [Fri, 25 Jun 2010 10:23:25 +0000 (11:23 +0100)]
Check drbd usermode helper in cluster verify

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoSet drbd usermode helper on config upgrade
Luca Bigliardi [Fri, 25 Jun 2010 10:01:10 +0000 (11:01 +0100)]
Set drbd usermode helper on config upgrade

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoGeneralize a recursive check on logical disks
Luca Bigliardi [Fri, 25 Jun 2010 14:39:47 +0000 (15:39 +0100)]
Generalize a recursive check on logical disks

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoAdd drbd_usermode_helper to configuration
Luca Bigliardi [Fri, 25 Jun 2010 09:57:55 +0000 (10:57 +0100)]
Add drbd_usermode_helper to configuration

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoVerifyNode: add usermode helper reply
Luca Bigliardi [Thu, 24 Jun 2010 10:02:23 +0000 (11:02 +0100)]
VerifyNode: add usermode helper reply

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoBaseDRBD: provide a way to query usermode_helper parameter
Luca Bigliardi [Wed, 16 Jun 2010 16:59:20 +0000 (17:59 +0100)]
BaseDRBD: provide a way to query usermode_helper parameter

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoFix a broken commandline switch option
René Nussbaumer [Mon, 5 Jul 2010 14:31:29 +0000 (16:31 +0200)]
Fix a broken commandline switch option

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoAdd a QA option to disable reboots during burnin
Iustin Pop [Mon, 5 Jul 2010 13:37:43 +0000 (15:37 +0200)]
Add a QA option to disable reboots during burnin

Since we have seen cases where (repeated) reboots are not supported
(e.g. Xen 3.4+), we need to be able to control this in the QA
configuration.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoCheck pycurl module at configure time
Guido Trotter [Sat, 3 Jul 2010 07:34:47 +0000 (08:34 +0100)]
Check pycurl module at configure time

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoAdd a QA option to disable reboots during burnin
Iustin Pop [Mon, 5 Jul 2010 13:37:43 +0000 (15:37 +0200)]
Add a QA option to disable reboots during burnin

Since we have seen cases where (repeated) reboots are not supported
(e.g. Xen 3.4+), we need to be able to control this in the QA
configuration.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoOpCreateInstance: do not require hv/be/os params
Iustin Pop [Mon, 5 Jul 2010 11:28:36 +0000 (13:28 +0200)]
OpCreateInstance: do not require hv/be/os params

It is perfectly legal to create an instance using only defaults
(although beparams will be most times passed in), so let's relax the
requirement for these three parameters.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoFix ganeti-rapi version string
Iustin Pop [Fri, 2 Jul 2010 15:20:51 +0000 (17:20 +0200)]
Fix ganeti-rapi version string

This was "broken" for almost a year :)

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoSilence the check-dirs check
Iustin Pop [Fri, 2 Jul 2010 15:19:22 +0000 (17:19 +0200)]
Silence the check-dirs check

The big shell fragment is just noise, for the common case where it
doesn't fail.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoRemove _CheckBooleanOpField
Iustin Pop [Thu, 1 Jul 2010 17:03:03 +0000 (19:03 +0200)]
Remove _CheckBooleanOpField

This is no longer used, and we can remove it.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoRework the "type" system
Iustin Pop [Thu, 1 Jul 2010 17:01:48 +0000 (19:01 +0200)]
Rework the "type" system

This patch merges the _OP_REQP and _OP_DEFS class attributes into a
_OP_PARAMS list, which holds both. The associated unittest checks that
all opcode attributes are declared and checked, and that no LU uses the
old fields (could be removed later).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoMake _CheckDiskTemplate a valid type checker
Iustin Pop [Thu, 1 Jul 2010 17:00:41 +0000 (19:00 +0200)]
Make _CheckDiskTemplate a valid type checker

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoA few more type definitions
Iustin Pop [Thu, 1 Jul 2010 17:00:06 +0000 (19:00 +0200)]
A few more type definitions

This is to simplify the type declarations in the actual LUs.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoMerge branch 'stable-2.1'
Guido Trotter [Thu, 1 Jul 2010 14:25:41 +0000 (15:25 +0100)]
Merge branch 'stable-2.1'

* stable-2.1:
  Bump up version for 2.1.5 release
  RapiClient: fix multi-authentication in Python 2.6
  Remove rapi-user and rapi-pass from qa-sample.json
  qa: fix gnt-instance modify -t drbd
  qa: shutdown instance before trying disk convert
  Fix check in gnt-instance modify -t
  Document optional ctypes dependency
  Update NEWS for the 2.1.5 release
  Pass force variant option at instance creation
  BatchCreate: get force_variant from specs not opts
  BatchCreate: set a default for force_variant

Conflicts:
INSTALL
  - merge
NEWS
  - merge
configure.ac
  - keep 2.2 version
lib/rapi/client.py
  - keep curl version

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoBump up version for 2.1.5 release v2.1.5
Guido Trotter [Wed, 30 Jun 2010 10:48:25 +0000 (11:48 +0100)]
Bump up version for 2.1.5 release

Also update the release date and the NEWS file.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoRapiClient: fix multi-authentication in Python 2.6
Guido Trotter [Thu, 1 Jul 2010 13:36:52 +0000 (14:36 +0100)]
RapiClient: fix multi-authentication in Python 2.6

In Python 2.6 the urllib2.HTTPBasicAuthHandler has a "retried" count for
failed authentications. The handler fails after 5 of them. To solve this
we reset the handler's "retried" member variable to 0 after every
successful request. This is a bit ugly, but makes the client work again
for more than 5 requests under all versions of Python.

Note that the digest authentication handler has a reset_retry_count()
method to do this, but the method is not defined for the basic
authentication handler, so we must reset the variable itself.

This member variable is unused in 2.4 and 2.5, so the change doesn't
affect the client under older Python versions.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoRemove rapi-user and rapi-pass from qa-sample.json
Guido Trotter [Thu, 1 Jul 2010 10:17:34 +0000 (11:17 +0100)]
Remove rapi-user and rapi-pass from qa-sample.json

After commit 725ec2f10019c35bafeb1aabfce6f14174bf4f46 they are unused.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoutils.OwnIpAddress: Change try/except for Python 2.4
Michael Hanselmann [Thu, 1 Jul 2010 11:45:49 +0000 (13:45 +0200)]
utils.OwnIpAddress: Change try/except for Python 2.4

Python 2.4 doesn't support “except” and “finally” in the same block.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoRAPI client: Switch to pycURL
Michael Hanselmann [Thu, 1 Jul 2010 11:38:59 +0000 (13:38 +0200)]
RAPI client: Switch to pycURL

Currently the RAPI client uses the urllib2 and httplib modules from
Python's standard library. They're used with pyOpenSSL in a very fragile
way, and there are known issues when receiving large responses from a RAPI
server.

By switching to PycURL we leverage the power and stability of the
widely-used curl library (libcurl). This brings us much more flexibility
than before, and timeouts were easily implemented (something that would
have involved a lot of work with the built-in modules).

There's one small drawback: Programs using libcurl have to call
curl_global_init(3) (available as pycurl.global_init) while exactly one
thread is running (e.g. before other threads) and are supposed to call
curl_global_cleanup(3) (available as pycurl.global_cleanup) upon exiting.
See the manpages for details. A decorator is provided to simplify this.

Unittests for the new code are provided, increasing the test coverage of
the RAPI client from 74% to 89%.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agobaserlib: Use boolean type for boolean variables
Michael Hanselmann [Wed, 30 Jun 2010 15:45:45 +0000 (17:45 +0200)]
baserlib: Use boolean type for boolean variables

This does not yet fix all issues in the RAPI interface which were
introduced with the type system. More testing is needed.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoqa: fix gnt-instance modify -t drbd
Guido Trotter [Thu, 1 Jul 2010 10:01:00 +0000 (11:01 +0100)]
qa: fix gnt-instance modify -t drbd

We need to pass the secondary node name, not a dict, which is an invalid
value.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoFixing Makefile.am to reflect the document move and adding of cluster merger
René Nussbaumer [Thu, 1 Jul 2010 11:29:12 +0000 (13:29 +0200)]
Fixing Makefile.am to reflect the document move and adding of cluster merger

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoAdding a user document for the use of cluster-merge
René Nussbaumer [Tue, 29 Jun 2010 13:58:16 +0000 (15:58 +0200)]
Adding a user document for the use of cluster-merge

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoMove cluster merger design doc to design-2.1.rst
René Nussbaumer [Wed, 30 Jun 2010 09:20:26 +0000 (11:20 +0200)]
Move cluster merger design doc to design-2.1.rst

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoqa: shutdown instance before trying disk convert
Guido Trotter [Wed, 30 Jun 2010 17:26:06 +0000 (18:26 +0100)]
qa: shutdown instance before trying disk convert

Because we have to. :)

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoFix check in gnt-instance modify -t
Guido Trotter [Wed, 30 Jun 2010 17:19:30 +0000 (18:19 +0100)]
Fix check in gnt-instance modify -t

Currently when changing the instance disks the instance status (which
must be down) is only checked if the target status is among the mirrored
ones. This is incorrect: the instance must be down either way, even if
the desired final status is non-mirrored.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoModify gnt-instance rename to support --no-check-name
René Nussbaumer [Wed, 30 Jun 2010 12:40:45 +0000 (14:40 +0200)]
Modify gnt-instance rename to support --no-check-name

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoAdding check_name option to the opcode and luxi call for instance rename
René Nussbaumer [Wed, 30 Jun 2010 12:37:24 +0000 (14:37 +0200)]
Adding check_name option to the opcode and luxi call for instance rename

This will allow instance rename without dns check as it does for instance
add.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoEnable utils.OwnIpAddress to work with IPv6 addresses
Manuel Franceschini [Wed, 30 Jun 2010 13:35:34 +0000 (15:35 +0200)]
Enable utils.OwnIpAddress to work with IPv6 addresses

Currently a TcpPing using the target address as source is used to
determine wheter or not an IP address belongs to a node. This does not
work for IPv6 anymore (I'm not sure why) as binding to IPv6 localhost as
source for the TCP connection in TcpPing still results in a successful
connection, even in case the target address is non-local.

Signed-off-by: Manuel Franceschini <livewire@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoBarebones LXC hypervisor
Iustin Pop [Tue, 20 Apr 2010 15:51:34 +0000 (17:51 +0200)]
Barebones LXC hypervisor

This needs lots of work, but it can successfully launch an LXC-based
instance.  See the docstring for the limitations/work to be done.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoDocument optional ctypes dependency
Luca Bigliardi [Wed, 30 Jun 2010 12:43:19 +0000 (13:43 +0100)]
Document optional ctypes dependency

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoDRBD IPv6 support
Manuel Franceschini [Tue, 29 Jun 2010 10:43:22 +0000 (12:43 +0200)]
DRBD IPv6 support

Support IPv6 configuration for 'drbdsetup show' parser and add unittests
concerning that case. Renames some data files to use consistent names
clarifying their usage.

Signed-off-by: Manuel Franceschini <livewire@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoIPv6 support for utils.TcpPing()
Manuel Franceschini [Wed, 30 Jun 2010 11:41:20 +0000 (13:41 +0200)]
IPv6 support for utils.TcpPing()

Signed-off-by: Manuel Franceschini <livewire@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoAdd function to retrieve family of an ip address
Manuel Franceschini [Thu, 24 Jun 2010 11:57:49 +0000 (13:57 +0200)]
Add function to retrieve family of an ip address

Signed-off-by: Manuel Franceschini <livewire@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoIntroduce utils.IsValidIP{4,6}()
Manuel Franceschini [Thu, 24 Jun 2010 09:49:54 +0000 (11:49 +0200)]
Introduce utils.IsValidIP{4,6}()

This patch introduces functions to check for valid IPv4 and IPv6
addresses and converts IsValidIP() to return True if it is either a IPv4
or a IPv6 address.

For now we do not change the functional behavior and replace IsValidIP
with IsValidIP4. This might change in the future.

Signed-off-by: Manuel Franceschini <livewire@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoUser assertFalse instead of assert_(not ...)
Manuel Franceschini [Tue, 29 Jun 2010 07:43:06 +0000 (09:43 +0200)]
User assertFalse instead of assert_(not ...)

Signed-off-by: Manuel Franceschini <livewire@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoFix osparams bug when gnt-cluster modify'ing
Manuel Franceschini [Wed, 30 Jun 2010 10:51:30 +0000 (12:51 +0200)]
Fix osparams bug when gnt-cluster modify'ing

Commit 625ac1135834c27a2e78fd61bf2df2ce29ad2966 introduced 'osparams'
slot in OPSetClusterParams which was not passed when invoked via
gnt-cluster modify.

Signed-off-by: Manuel Franceschini <livewire@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoIntroduce IPv6 constants
Manuel Franceschini [Tue, 29 Jun 2010 08:26:06 +0000 (10:26 +0200)]
Introduce IPv6 constants

Signed-off-by: Manuel Franceschini <livewire@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoReplace '0.0.0.0' with constant
Manuel Franceschini [Mon, 28 Jun 2010 16:58:16 +0000 (18:58 +0200)]
Replace '0.0.0.0' with constant

Signed-off-by: Manuel Franceschini <livewire@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoRename some constants to facilitate IPv6 support
Manuel Franceschini [Thu, 24 Jun 2010 09:01:38 +0000 (11:01 +0200)]
Rename some constants to facilitate IPv6 support

Signed-off-by: Manuel Franceschini <livewire@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoAdd missing pylint disable for "except:"
Guido Trotter [Wed, 30 Jun 2010 08:40:39 +0000 (09:40 +0100)]
Add missing pylint disable for "except:"

Why it's needed here but not a few lines above is a mistery that only
pylint understands.

Also fix an indentation error in another disable, for the same function.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoAdding design-doc for privilege separation work done on Ganeti 2.2
René Nussbaumer [Tue, 29 Jun 2010 12:56:08 +0000 (14:56 +0200)]
Adding design-doc for privilege separation work done on Ganeti 2.2

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoUpdate NEWS for the 2.1.5 release
Guido Trotter [Tue, 29 Jun 2010 15:59:50 +0000 (16:59 +0100)]
Update NEWS for the 2.1.5 release

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoPass force variant option at instance creation
Guido Trotter [Tue, 29 Jun 2010 15:31:40 +0000 (16:31 +0100)]
Pass force variant option at instance creation

This was supposed to be done in
"06073e857e3b518c7195d57306ae01793240c0c2" but by mistake the field was
added to batch create rather than the normal instance create.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agomasterd: use AsyncTerminatedMessageStream for luxi
Guido Trotter [Tue, 18 May 2010 11:13:34 +0000 (12:13 +0100)]
masterd: use AsyncTerminatedMessageStream for luxi

Each luxi connection now creates an asyncore MasterClientHandler (which
is an AsyncTerminatedMessageStream subclass, sending each message to a
client worker). This makes it harder to DOS the master daemon by just
creating luxi connections, as each of them will use memory and file
descriptors, but not a dedicated thread.

Each connection will only handle one message at a time.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoFix a few uncommon pylint errors in compat.py
Guido Trotter [Tue, 29 Jun 2010 12:07:21 +0000 (13:07 +0100)]
Fix a few uncommon pylint errors in compat.py

- It's ok if the optional modules functools, roman and hashlib are not there.
- It's ok to reference any and all before defining them. We're doing all
  this exactly because, under python 2.4, they are undefined.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoBatchCreate: get force_variant from specs not opts
Guido Trotter [Tue, 29 Jun 2010 11:20:20 +0000 (12:20 +0100)]
BatchCreate: get force_variant from specs not opts

There is no such option on the command line, and for batch creation it's
better to get the option from the json file (with a default of false, as
we fixed it in the previous patch).

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoAsyncTerminatedMessageStream: limit message count
Guido Trotter [Fri, 25 Jun 2010 15:44:35 +0000 (17:44 +0200)]
AsyncTerminatedMessageStream: limit message count

Currently the message stream can process any number of messages in
parallel (if they get dispatched to different threads or processes).
In order to limit their number we only handle messages and read from
the socket if we're under a certain limit of unanswered ones.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoAsyncTerminatedMessageStream: send_message
Guido Trotter [Fri, 25 Jun 2010 15:43:21 +0000 (17:43 +0200)]
AsyncTerminatedMessageStream: send_message

This function adds the ability for a AsyncTerminatedMessageStream to
have a thread-safe message delivery function.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoAdd test script for cfgupgrade
Michael Hanselmann [Mon, 28 Jun 2010 13:47:12 +0000 (15:47 +0200)]
Add test script for cfgupgrade

This should catch cases where we update the configuration version, but
forget to adjust cfgupgrade accordingly.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agocfgupgrade: Add option to override config verification
Michael Hanselmann [Mon, 28 Jun 2010 13:49:46 +0000 (15:49 +0200)]
cfgupgrade: Add option to override config verification

This is needed in a new test script for cfgupgrade where it's better
to only use the minimum parts necessary for testing cfgupgrade.
Including full configuration data to ensure verification doesn't fail
would make maintenance difficult.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agocfgupgrade: Fix bug when checking configuration directory
Michael Hanselmann [Mon, 28 Jun 2010 13:50:24 +0000 (15:50 +0200)]
cfgupgrade: Fix bug when checking configuration directory

In the condition for checking the configuration directory, one “or” should have
been an “and”. This bug was in cfgupgrade since commit 95e4a8142 (June 2008).
Found thanks to a test script.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agocfgupgrade: Add support for Ganeti 2.2
Michael Hanselmann [Mon, 28 Jun 2010 12:34:04 +0000 (14:34 +0200)]
cfgupgrade: Add support for Ganeti 2.2

Since configuration changes are now usually done in the configuration
writer class, cfgupgrade's only task is to change the config version.
This means we can easily support upgrading from Ganeti 2.0 and 2.1 to
2.2.

This patch also brings a couple of small cleanups.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoRemove dead code from cfgupgrade
Michael Hanselmann [Mon, 28 Jun 2010 12:09:48 +0000 (14:09 +0200)]
Remove dead code from cfgupgrade

Three constants were no longer user after commit 11c31f5cb5, which
removed support for upgrading from Ganeti 1.2.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoBatchCreate: set a default for force_variant
Guido Trotter [Tue, 29 Jun 2010 09:54:17 +0000 (10:54 +0100)]
BatchCreate: set a default for force_variant

Currently if the json file doesn't contain a "force_variant" parameter
BatchCreate stracktraces. We add a default so passing it explicitely is
not needed.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

13 years agoBetter specify old object slots removal policy
Guido Trotter [Mon, 28 Jun 2010 15:39:13 +0000 (16:39 +0100)]
Better specify old object slots removal policy

The comments seem to imply we can remove deprecated slots after 2.1 is
released. This is not quite true, if we still want to support upgrading
straight from 2.0. So let's specify better that they can be removed only
after upgrading from 2.0 can be deprecated.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoFix a type declaration error in LUTestAllocator
Iustin Pop [Mon, 28 Jun 2010 13:14:43 +0000 (15:14 +0200)]
Fix a type declaration error in LUTestAllocator

Also, improve logging of type errors, to ease debugging.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoFix _UpgradeConfig docstring
Guido Trotter [Mon, 28 Jun 2010 12:48:29 +0000 (13:48 +0100)]
Fix _UpgradeConfig docstring

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agojqueue: remove the _big_jqueue_lock module global
Guido Trotter [Fri, 25 Jun 2010 16:35:01 +0000 (18:35 +0200)]
jqueue: remove the _big_jqueue_lock module global

By using ssynchronized in the new way, we can remove the module-global
_big_jqueue_lock and revert back to an internal _lock inside the jqueue.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agossynchronized: act on a class member
Guido Trotter [Fri, 25 Jun 2010 16:09:19 +0000 (18:09 +0200)]
ssynchronized: act on a class member

The ssynchronized decorator takes the lock to act on in input.
With this change we allow a string to be passed, and if so we assume the
function it protects is a class method, and we act on the member of the
class itself named as the string we got.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoShare the jqueue lock on job-local changes
Guido Trotter [Tue, 15 Jun 2010 16:39:58 +0000 (17:39 +0100)]
Share the jqueue lock on job-local changes

We can share the jqueue lock when we do per-job updates. These only
conflict with updates/checks on the same job from another thread (eg.
CancelJob, ArchiveJob, which keep the lock unshared, since they are less
frequent).

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years ago_OpExecCallbacks abstract _AppendFeedback
Guido Trotter [Wed, 9 Jun 2010 16:24:15 +0000 (17:24 +0100)]
_OpExecCallbacks abstract _AppendFeedback

Move some code to a decorated function rather than explicitely
acquiring/releasing the lock in AppendFeedback.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoRemove utils.LockedMethod
Guido Trotter [Thu, 17 Jun 2010 10:49:25 +0000 (11:49 +0100)]
Remove utils.LockedMethod

All users of this function were converted to another method, hence we
can remove it.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agojqueue: convert to a SharedLock()
Guido Trotter [Fri, 4 Jun 2010 16:33:42 +0000 (17:33 +0100)]
jqueue: convert to a SharedLock()

Remove the jqueue _lock member and convert to a _big_jqueue_lock
sharedlock. This allows smooth transition from the old single lock to a
more granular approach.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoMarkUnfinishedOps: update job file on disk
Guido Trotter [Thu, 24 Jun 2010 14:41:58 +0000 (16:41 +0200)]
MarkUnfinishedOps: update job file on disk

Every time we call MarkUnfinishedOps we do it in a try/finally block
that updates the job file. With this patch we move the try/finally
inside. CancelJobUnlocked is removed, because it just becomes a wrapper
over MarkUnfinishedOps with two constant values.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoRemove spurious empty line
Guido Trotter [Thu, 24 Jun 2010 15:51:54 +0000 (17:51 +0200)]
Remove spurious empty line

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoRemove pred from compat.any/all
Guido Trotter [Wed, 23 Jun 2010 22:17:42 +0000 (00:17 +0200)]
Remove pred from compat.any/all

This makes it compatible with the python builtin, and we can even use
the builtin when running under the right version of python. The all and
any functions are renamed to _all and _any, so that they can be tested,
and (non)existing unittests are updated (translation: there are no unit
tests, so none are updated).

This patch also moves the code deciding which partial to use next to
the definition of the _partial function, rather than after TryToRoman.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoTwo more fixes for OS params and opcode defaults
Iustin Pop [Mon, 28 Jun 2010 10:32:11 +0000 (12:32 +0200)]
Two more fixes for OS params and opcode defaults

If the OS is not using API v20, the parameter verification should be
entirely skipped.

The second change is a simple typo.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoFix breakage due to OS parameters
Iustin Pop [Fri, 25 Jun 2010 15:19:11 +0000 (17:19 +0200)]
Fix breakage due to OS parameters

I was using wrong python installation path (thanks Guido!), so I was not
actually testing the new backend.py module. Two immediate things bugs
are fixed, and after these burnin passes again…

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoIntroduce constants.DTS_MAY_ADOPT
Apollon Oikonomopoulos [Wed, 23 Jun 2010 13:47:36 +0000 (16:47 +0300)]
Introduce constants.DTS_MAY_ADOPT

DTS_MAY_ADOPT include disk templates that may use disk adoption and will be
used in all respective checks.

Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>