ganeti-github.git
10 years agodevel/review: make the range argument optional
Guido Trotter [Mon, 17 May 2010 12:30:46 +0000 (13:30 +0100)]
devel/review: make the range argument optional

Rather than calling devel/review with from..to target we can just use
target, and assume target..HEAD as the range. This makes it a lot
easier, as now you just have to say something like "devel/review
devel-2.1" if you're already on the branch you want to commit, and want
to commit it to devel-2.1.

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

10 years agoAbstract the LUXI eom into a constant
Guido Trotter [Tue, 18 May 2010 09:37:15 +0000 (10:37 +0100)]
Abstract the LUXI eom into a constant

Currently the EOM terminator is hardcoded on the server side, and is
customizable in the Transport object (with the default being the same as
the value found in the server), but not in the luxi client.

With this patch we move the value to constants, and remove the "fake"
customizability, which would just break client/server communication. If
we ever need to have a luxi transport with a different terminator it's
easy enough to add it back.

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

10 years agoKVM: vhost net acceleration support
Guido Trotter [Mon, 17 May 2010 12:05:13 +0000 (13:05 +0100)]
KVM: vhost net acceleration support

This will only work on patched or newer (>= 2.6.34) kernels and with a
patched version of qemu-kvm.

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

10 years agoganeti-cleaner: Write log file with removed files
Michael Hanselmann [Mon, 17 May 2010 13:48:15 +0000 (15:48 +0200)]
ganeti-cleaner: Write log file with removed files

Logfiles can be useful for debugging.

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

10 years agoRAPI client: Handle urllib2.HTTPError and raise GanetiApiError
Michael Hanselmann [Mon, 17 May 2010 11:49:41 +0000 (13:49 +0200)]
RAPI client: Handle urllib2.HTTPError and raise GanetiApiError

This allows users of the RAPI client to catch GanetiApiError for all HTTP
errors.

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

10 years agoRAPI: /2/{nodes,instances}/$name should return 404 for unknown items
Michael Hanselmann [Fri, 14 May 2010 17:08:21 +0000 (19:08 +0200)]
RAPI: /2/{nodes,instances}/$name should return 404 for unknown items

Currently they return a 500 Server Error, not really useful
for detecting nonexistent items.

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

10 years agoganeti-masterd: Improve error logging for client requests
Michael Hanselmann [Fri, 14 May 2010 17:07:24 +0000 (19:07 +0200)]
ganeti-masterd: Improve error logging for client requests

Ganeti errors should also be logged with a backtrace.

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

10 years agoReturn disk_template from LUQueryInstanceData
Michael Hanselmann [Fri, 14 May 2010 16:26:30 +0000 (18:26 +0200)]
Return disk_template from LUQueryInstanceData

Inter-cluster instance moves need the disk template. As they run
LUQueryInstanceData to get an instance's details, the disk template
must be returned.

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

10 years agoRAPI client: Rename Get{Node,Instance}Info, add new GetInstanceInfo
Michael Hanselmann [Fri, 14 May 2010 16:25:12 +0000 (18:25 +0200)]
RAPI client: Rename Get{Node,Instance}Info, add new GetInstanceInfo

GetInstanceInfo should return the resource /2/instances/$name/info,
but so far it returns /2/instances/$name. The same applies to
GetNodeInfo, which returns /2/nodes/$name. Both names are stripped
of their “Info” suffix and a new method, GetInstanceInfo, is added
for /2/instances/$name/info. There's no equivalent for nodes.

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

10 years agoRAPI client: Log request to be made
Michael Hanselmann [Fri, 14 May 2010 16:12:42 +0000 (18:12 +0200)]
RAPI client: Log request to be made

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

10 years agoAdd missing documentation for RAPI instance creation mode
Michael Hanselmann [Fri, 14 May 2010 10:33:01 +0000 (12:33 +0200)]
Add missing documentation for RAPI instance creation mode

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

10 years agoAdd checks for master IP in cluster verify
Iustin Pop [Mon, 17 May 2010 09:54:34 +0000 (11:54 +0200)]
Add checks for master IP in cluster verify

This also updates a comment in the unittest for utils.py. We unittest
the new function for two things: correct reporting on real case (for
localhost), and correct reporting with a mocked-out TcpPing that returns
false.

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

10 years agoRemove unused import from daemon.py
Guido Trotter [Fri, 14 May 2010 16:01:52 +0000 (17:01 +0100)]
Remove unused import from daemon.py

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

10 years agoutils.IgnoreSignals
Guido Trotter [Fri, 14 May 2010 13:44:23 +0000 (14:44 +0100)]
utils.IgnoreSignals

Remove duplicate code between a couple of asyncore related function by
having a function in charge of handling EINTR errors. Unittests included.

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

10 years agoAsyncUDPSocket.handle_error
Guido Trotter [Fri, 14 May 2010 13:52:58 +0000 (14:52 +0100)]
AsyncUDPSocket.handle_error

By overriding the default asyncore handle_error (which closes the
socket) with our own version, which logs what happened but tries to
proceed, we can get rid of a couple of try/except blocks. The resulting
churn is deindentation of the internal code.

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

10 years agoAdd a forgotten comment about overriding a method
Guido Trotter [Fri, 14 May 2010 13:46:36 +0000 (14:46 +0100)]
Add a forgotten comment about overriding a method

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

10 years agoganeti-noded: add the --no-mlock option
Guido Trotter [Fri, 14 May 2010 07:45:53 +0000 (08:45 +0100)]
ganeti-noded: add the --no-mlock option

While mlock on noded is definitely good in most situations, there are
some - namely my laptop - where it has no benefit, and uses precious
non-swappable memory. To avoid this we make it optional, with a new
--no-mlock option. Note that only the main node daemon and its http
children are affected: the powercycle node child still uses mlock, which
doesn't harm, since it's a short lived process happening just before
node reboot anyway. The manpage is updated.

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

10 years agoDescribe more ganeti-noded options in the manpage
Guido Trotter [Fri, 14 May 2010 07:42:08 +0000 (08:42 +0100)]
Describe more ganeti-noded options in the manpage

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

10 years agoFix some pylint warnings
Luca Bigliardi [Thu, 13 May 2010 15:49:35 +0000 (16:49 +0100)]
Fix some pylint warnings

Disable warnings for:
- except Exception,
- use of __errno_location,
- redeclaration of handleError()

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

10 years agoFix logging string format
Luca Bigliardi [Thu, 13 May 2010 15:33:04 +0000 (16:33 +0100)]
Fix logging string format

Fix this pylint warning:
[W6501, Mlockall] Specify string format arguments as logging function parameters

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

10 years agoFix Filehandler / FileHandler typo
Luca Bigliardi [Thu, 13 May 2010 15:14:08 +0000 (16:14 +0100)]
Fix Filehandler / FileHandler typo

Fix typo spotted by pylint:
E1101:2095:LogFileHandler.handleError: Module 'logging' has no 'Filehandler' member

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

10 years agoQA: Test instance creation/deletion via RAPI client
Michael Hanselmann [Wed, 12 May 2010 18:06:35 +0000 (20:06 +0200)]
QA: Test instance creation/deletion via RAPI client

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

10 years agoRAPI client: Implement instance creation
Michael Hanselmann [Wed, 12 May 2010 17:56:20 +0000 (19:56 +0200)]
RAPI client: Implement instance creation

Currently this only supports the new instance creation request data
format version 1, but support for the old version can be easily
implemented.

Most arguments are optional and documented in the RAPI documentation.

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

10 years agoRAPI: Add new request data format for instance creation
Michael Hanselmann [Wed, 12 May 2010 17:45:10 +0000 (19:45 +0200)]
RAPI: Add new request data format for instance creation

As mentioned in commit d975f482d, the current way of creating an
instance via RAPI is not very flexible. With this patch, a new
instance creation request data format is introduced and documented.
Support can be detected by checking the list of features returned
by the /2/features resource for the value "instance-create-reqv1".

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

10 years agoMention RAPI client in documentation
Michael Hanselmann [Wed, 12 May 2010 17:42:22 +0000 (19:42 +0200)]
Mention RAPI client in documentation

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

10 years agorapi.baserlib: Add function to check variable type
Michael Hanselmann [Wed, 12 May 2010 17:41:03 +0000 (19:41 +0200)]
rapi.baserlib: Add function to check variable type

Also add a separate function to retrieve body parameters. Having
it separate (independent of a class instance) will make it easier
to unittest users of this function.

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

10 years agoAdd new /2/features RAPI resource
Michael Hanselmann [Wed, 12 May 2010 17:37:11 +0000 (19:37 +0200)]
Add new /2/features RAPI resource

The /2/features RAPI resource can be used to detect optional
features implemented by the RAPI server. This will be used
to recognize servers implementing a new request format for
instance creation requests.

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

10 years agoUse console_logging in node daemon
Luca Bigliardi [Thu, 13 May 2010 12:58:31 +0000 (13:58 +0100)]
Use console_logging in node daemon

Node daemon logs will be printed on system console if writing on the log file
fails.

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

10 years agoDaemons conditionally setup console logging
Luca Bigliardi [Wed, 12 May 2010 11:01:31 +0000 (12:01 +0100)]
Daemons conditionally setup console logging

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

10 years agoUse LogFileHandler conditionally in SetupLogging
Luca Bigliardi [Wed, 12 May 2010 10:44:37 +0000 (11:44 +0100)]
Use LogFileHandler conditionally in SetupLogging

Add a parameter to SetupLogging to use LogFileHandler (default is off)

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

10 years agoIntroduce LogFileHandler class
Luca Bigliardi [Wed, 5 May 2010 16:09:55 +0000 (17:09 +0100)]
Introduce LogFileHandler class

Add a log handler class which logs to /dev/console in case of logging errors.

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

10 years agoAdd /dev/console constant
Luca Bigliardi [Wed, 12 May 2010 10:35:51 +0000 (11:35 +0100)]
Add /dev/console constant

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

10 years agoLock PowercycleNode child in memory
Luca Bigliardi [Thu, 6 May 2010 15:16:49 +0000 (16:16 +0100)]
Lock PowercycleNode child in memory

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

10 years agoLock node daemon children in memory
Luca Bigliardi [Thu, 6 May 2010 15:16:01 +0000 (16:16 +0100)]
Lock node daemon children in memory

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

10 years agoLock node daemon in memory
Luca Bigliardi [Thu, 6 May 2010 14:58:52 +0000 (15:58 +0100)]
Lock node daemon in memory

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

10 years agoIntroduce Mlockall()
Luca Bigliardi [Tue, 4 May 2010 13:55:21 +0000 (14:55 +0100)]
Introduce Mlockall()

Add Mlockall() utility to lock current process' virtual adress space into RAM.

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

10 years agoNode daemon availability improvements proposal
Luca Bigliardi [Wed, 12 May 2010 15:02:36 +0000 (16:02 +0100)]
Node daemon availability improvements proposal

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

10 years agoFix wrong variable name in commit d975f482
Michael Hanselmann [Wed, 12 May 2010 12:12:00 +0000 (14:12 +0200)]
Fix wrong variable name in commit d975f482

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

10 years agoRAPI: Add initial support for instance creation request version
Michael Hanselmann [Wed, 12 May 2010 11:30:27 +0000 (13:30 +0200)]
RAPI: Add initial support for instance creation request version

The way the resource /2/instances expects its request data (e.g.
instance name, disks, NICs) to be formatted in a dict is not
very extensible. HV and BE parameters are interleaved with all
other values. In commit 495cfdf0 a new parameter “mode” was added
which can be misunderstood as the instance creation mode, but is
actually a mode for the network interface.

Short of bumping the whole RAPI version (currently 2), which would
involve many, many other changes and potentially break clients,
we can not change the request format easily as it needs to stay
backwards and future-compatible as far as possible. This is not an
internal API, but one used by several external applications.

By introducing a data format version per request, we can still
support the old request format, and thereby not break existing users,
while we can add a more flexible request format which will, for
example, support multiple NICs and move HV/BE parameters to separate
containers, avoiding conflicts.

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

10 years agoConvert some ReadFile calls to ReadOneLineFile
Guido Trotter [Wed, 12 May 2010 10:09:33 +0000 (11:09 +0100)]
Convert some ReadFile calls to ReadOneLineFile

For passwords we require strict oneliners, we're a bit more lax with pid
and uid files.

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

10 years agoutils.ReadOneLineFile()
Guido Trotter [Tue, 11 May 2010 16:00:22 +0000 (17:00 +0100)]
utils.ReadOneLineFile()

Read the first non-empty file line. When strict is set, abort if more
than one line is non-empty. Some unittests inspired by the reverted ones
from commit b774bb106cc28d008e790ad2666eb64c76866fa0, and some new ones.

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

10 years agoRemove oneline= parameter from utils.ReadFile
Guido Trotter [Tue, 11 May 2010 15:32:03 +0000 (16:32 +0100)]
Remove oneline= parameter from utils.ReadFile

This partially reverts commit b774bb106cc28d008e790ad2666eb64c76866fa0.
Unittests unrelated to that particular functionality but introduced in
that commit are left untouched. Since the temporary directory is now
only used to check for a non-existing file, it is removed as well, and
a convenient very-very-unlikely-to-exist file is used instead.

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

10 years agoinstall.rst: update os version and add KVM notes
Guido Trotter [Wed, 12 May 2010 08:40:15 +0000 (09:40 +0100)]
install.rst: update os version and add KVM notes

The 0.7 version was just an example, but since we're on 0.9 now,
updating the number cannot be wrong. The new admonition helps KVM users
to configure debootstrap correctly so that instances can be shutdown
cleanly.

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

10 years agoINSTALL: update hypervisor requirements
Guido Trotter [Wed, 12 May 2010 08:30:03 +0000 (09:30 +0100)]
INSTALL: update hypervisor requirements

Xen: Just specify 3.0 or above as a requirement, as versions above 3.1
have been tested and work fine with Ganeti. Also note that the Xen
dependency is optional, if one wants to work with KVM.

KVM: list as an alternative, specify that 72 (the one shipped with
lenny) is the bare minimum, but newer qemu-kvm is recommended.

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

10 years agoRAPI client: Fix SSL error reporting for real
Michael Hanselmann [Wed, 12 May 2010 09:28:38 +0000 (11:28 +0200)]
RAPI client: Fix SSL error reporting for real

My previous patch, commit 857705e8, helped in one particular
situation where the exception didn't contain any arguments
(pyOpenSSL reporting a WantReadError, which shouldn't occur with a
blocking socket anyway). With this patch, more common and uncommon
errors should be easy to recognize.

SSL errors without any of these patches:
“ganeti.rapi.client.CertificateError: SSL issue:
[('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE',
'certificate verify failed')]”

SSL errors with both patches:
“ganeti.rapi.client.CertificateError: SSL issue:
[('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE',
'certificate verify failed')] (<OpenSSL.SSL.Error
instance at 0x…>)”

WantReadError without any of these two patches:
“ganeti.rapi.client.CertificateError: SSL issue: ”

WantReadError with both patches:
“ganeti.rapi.client.CertificateError: SSL issue:
(<OpenSSL.SSL.WantReadError instance at 0x…>)”

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

10 years agoRAPI client: Improve SSL error reporting
Michael Hanselmann [Tue, 11 May 2010 16:58:40 +0000 (18:58 +0200)]
RAPI client: Improve SSL error reporting

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

10 years agoRAPI client: Don't check node role in client
Michael Hanselmann [Tue, 11 May 2010 15:55:45 +0000 (17:55 +0200)]
RAPI client: Don't check node role in client

Only the server knows which node roles can be set via RAPI.
Constants are provided for convenience.

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

10 years agoRAPI client: Update ReplaceInstanceDisks
Michael Hanselmann [Tue, 11 May 2010 15:50:50 +0000 (17:50 +0200)]
RAPI client: Update ReplaceInstanceDisks

- The RAPI client shouldn't check the replacement mode as only
  the server knows which ones are valid (constants are still
  provided for convenience)
- Disks shouldn't be a list of names, but of indexes

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

10 years agoRAPI client: Fix behaviour of “allocatable” storage flag
Michael Hanselmann [Tue, 11 May 2010 14:22:29 +0000 (16:22 +0200)]
RAPI client: Fix behaviour of “allocatable” storage flag

When modifying a storage unit, the “allocatable” flag should default
to “no modification”. This replicates the behaviour of the command
line interface.

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

10 years agoRAPI client: Encode boolean and None query values
Michael Hanselmann [Tue, 11 May 2010 16:19:12 +0000 (18:19 +0200)]
RAPI client: Encode boolean and None query values

Boolean values must be passed as 0 or 1. None should be an empty
value ("").

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

10 years agoRAPI client: No longer check storage type locally
Michael Hanselmann [Tue, 11 May 2010 14:14:30 +0000 (16:14 +0200)]
RAPI client: No longer check storage type locally

Only the RAPI server (actually masterd) knows which storage types
are valid. The exception can no longer be raised as the type is
only checked in the job.

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

10 years agoRAPI client: Add constant for RAPI version
Michael Hanselmann [Tue, 11 May 2010 14:08:40 +0000 (16:08 +0200)]
RAPI client: Add constant for RAPI version

This reverts a60e3cb0a partially by moving the RAPI version into a constant.

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

10 years agoRAPI QA: Use RAPI client
Michael Hanselmann [Mon, 10 May 2010 15:26:32 +0000 (17:26 +0200)]
RAPI QA: Use RAPI client

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

10 years agoQA: Restore RAPI cert after “gnt-cluster renew-crypto”
Michael Hanselmann [Mon, 10 May 2010 15:21:45 +0000 (17:21 +0200)]
QA: Restore RAPI cert after “gnt-cluster renew-crypto”

The RAPI tests will depend on the certificate.

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

10 years agoQA: Add function create temporary backup file
Michael Hanselmann [Mon, 10 May 2010 15:21:59 +0000 (17:21 +0200)]
QA: Add function create temporary backup file

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

10 years agoRAPI client: Don't assume job IDs to be numeric
Michael Hanselmann [Mon, 10 May 2010 14:10:30 +0000 (16:10 +0200)]
RAPI client: Don't assume job IDs to be numeric

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoAdd RAPI client utility module with RAPI PollJob function
Michael Hanselmann [Mon, 10 May 2010 14:09:37 +0000 (16:09 +0200)]
Add RAPI client utility module with RAPI PollJob function

The RAPI client module shouldn't depend on any Ganeti module, yet it's
useful to have some Ganeti-specific code, like a PollJob function for
RAPI.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRAPI client: Include HTTP error code in GanetiApiError exception
Michael Hanselmann [Tue, 11 May 2010 12:45:56 +0000 (14:45 +0200)]
RAPI client: Include HTTP error code in GanetiApiError exception

Having the HTTP error code allows users of the class to act differently based
on the error code.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoSupport different HTTP error codes in RAPI client unittest mock
Michael Hanselmann [Tue, 11 May 2010 12:47:15 +0000 (14:47 +0200)]
Support different HTTP error codes in RAPI client unittest mock

This allows testing error conditions (e.g. if a job wasn't found).

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRAPI client: Fix error message for unsupported methods in unittest
Michael Hanselmann [Fri, 7 May 2010 18:54:45 +0000 (20:54 +0200)]
RAPI client: Fix error message for unsupported methods in unittest

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRAPI client: Allow waiting for job changes
Michael Hanselmann [Fri, 7 May 2010 19:04:33 +0000 (21:04 +0200)]
RAPI client: Allow waiting for job changes

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

10 years agoRAPI: Allow waiting for job changes
Michael Hanselmann [Tue, 4 May 2010 17:02:54 +0000 (19:02 +0200)]
RAPI: Allow waiting for job changes

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

10 years agoRAPI client: Rename “DeleteJob” to “CancelJob”
Michael Hanselmann [Fri, 7 May 2010 18:29:18 +0000 (20:29 +0200)]
RAPI client: Rename “DeleteJob” to “CancelJob”

Jobs can't be deleted, but cancelled (even though the HTTP method
“DELETE” is used).

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRAPI client: Various code style changes
Michael Hanselmann [Fri, 7 May 2010 17:56:59 +0000 (19:56 +0200)]
RAPI client: Various code style changes

- Replace hardcoded values with constants
- Code formatting
- Exception messages without periods and fixed string formatting

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRAPI client: Add missing unittest for RepairNodeStorageUnits
Michael Hanselmann [Fri, 7 May 2010 17:40:59 +0000 (19:40 +0200)]
RAPI client: Add missing unittest for RepairNodeStorageUnits

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRAPI client: Always pass _SendRequest args as positional
Michael Hanselmann [Fri, 7 May 2010 17:40:43 +0000 (19:40 +0200)]
RAPI client: Always pass _SendRequest args as positional

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRAPI client: Simplify URL construction
Michael Hanselmann [Fri, 7 May 2010 17:28:49 +0000 (19:28 +0200)]
RAPI client: Simplify URL construction

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRAPI client: Instantiate JSON encoder only once
Michael Hanselmann [Fri, 7 May 2010 17:22:31 +0000 (19:22 +0200)]
RAPI client: Instantiate JSON encoder only once

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRAPI client: Always return job ID
Michael Hanselmann [Fri, 7 May 2010 17:17:07 +0000 (19:17 +0200)]
RAPI client: Always return job ID

Even removing tags returns a job ID.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRAPI client: Hardcode version in URLs
Michael Hanselmann [Fri, 7 May 2010 17:12:56 +0000 (19:12 +0200)]
RAPI client: Hardcode version in URLs

If the version changes, the API is likely to change as well. Not
having to ask for the version first makes the code simpler.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: David Knowles <dknowles@google.com>

10 years agoRemove httplib2 dependency from ganeti.rapi.client
Michael Hanselmann [Fri, 7 May 2010 17:05:38 +0000 (19:05 +0200)]
Remove httplib2 dependency from ganeti.rapi.client

- It's possible to implement all functionality in ganeti.rapi.client
  using Python's standard modules httplib and urllib2
- By doing so, proper SSL certificate verification is implemented
- Adjust some of the code to Ganeti's code style (this is not yet
  finished)

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

10 years agoutils.ReadFile: Add parameter to read only one line
Michael Hanselmann [Tue, 11 May 2010 11:01:27 +0000 (13:01 +0200)]
utils.ReadFile: Add parameter to read only one line

Reading only one line is useful for reading passwords from files. This
also adds unittests for utils.ReadFile.

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

10 years agoFix tiny typo in cluster verify
Iustin Pop [Tue, 11 May 2010 08:26:25 +0000 (10:26 +0200)]
Fix tiny typo in cluster verify

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

10 years agocli: Make PollJob generic to support other protocols
Michael Hanselmann [Mon, 10 May 2010 11:57:04 +0000 (13:57 +0200)]
cli: Make PollJob generic to support other protocols

By separating the LUXI-specific code and stdio-related code
into separate classes, we can make cli.PollJob protocol-
agnostic, allowing it to be used with RAPI.

This patch also adds unittests for cli.PollJob.

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

10 years agoNEWS: fix empty lines
Guido Trotter [Mon, 10 May 2010 09:16:31 +0000 (10:16 +0100)]
NEWS: fix empty lines

Make sure there are exactly two empty lines between different versions
(rather than 1 or 3).

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

10 years agoFix a unittest name and docstring
Guido Trotter [Mon, 10 May 2010 09:15:24 +0000 (10:15 +0100)]
Fix a unittest name and docstring

The docstring has been copied by the name, but the name reports a
misspell of the function it is actually testing.

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

10 years agoForce ssh to allocate a tty
Balazs Lecz [Fri, 7 May 2010 18:14:36 +0000 (19:14 +0100)]
Force ssh to allocate a tty

This is required to avoid the
"Pseudo-terminal will not be allocated because stdin is not a terminal."
ssh error message in case a Ganeti script is run non-interactively.

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

10 years agoFix a unittest docstring
Guido Trotter [Mon, 10 May 2010 08:59:09 +0000 (09:59 +0100)]
Fix a unittest docstring

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

10 years agoIsProcessAlive: retry stat() a few times
Guido Trotter [Fri, 7 May 2010 08:11:37 +0000 (10:11 +0200)]
IsProcessAlive: retry stat() a few times

On multiprocessor dom0 stat() on /proc can sometimes return EINVAL.
Before giving up, we try a few times to get a consistent answer.

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

10 years agoRetry{Again,Timeout}: explain reraising
Guido Trotter [Fri, 7 May 2010 15:02:36 +0000 (17:02 +0200)]
Retry{Again,Timeout}: explain reraising

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

10 years agoutils.Retry: pass up timeout arguments
Guido Trotter [Fri, 7 May 2010 08:09:45 +0000 (10:09 +0200)]
utils.Retry: pass up timeout arguments

If Retry has to fail with RetryTimeout, it might be useful to pass the
Retry argument to RetryTimeout, to help debugging outside the Retry
cycle. We also define a RetryTimeout.RaiseInner() helper, to re-raise an
exception passed to RetryAgain. All served with a side of unit tests.

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

10 years agoAdd a few Retry unittests
Guido Trotter [Fri, 7 May 2010 08:51:56 +0000 (10:51 +0200)]
Add a few Retry unittests

Check that Retry actually times out, and actually retries.

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

10 years agoMerge branch 'stable-2.1' into devel-2.1
Guido Trotter [Fri, 7 May 2010 14:25:03 +0000 (16:25 +0200)]
Merge branch 'stable-2.1' into devel-2.1

* stable-2.1:
  Bump version for 2.1.2.1 release
  Update NEWS for Ganeti 2.1.2.1
  KVM: only export instance tags if present

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

10 years agoBump version for 2.1.2.1 release v2.1.2.1
Guido Trotter [Fri, 7 May 2010 13:05:58 +0000 (15:05 +0200)]
Bump version for 2.1.2.1 release

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

10 years agoUpdate NEWS for Ganeti 2.1.2.1
Guido Trotter [Fri, 7 May 2010 13:54:36 +0000 (15:54 +0200)]
Update NEWS for Ganeti 2.1.2.1

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

10 years agoKVM: only export instance tags if present
Guido Trotter [Fri, 7 May 2010 13:03:57 +0000 (15:03 +0200)]
KVM: only export instance tags if present

Currently non-tagged instances fail starting with a TypeError.

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

10 years agossh.GetUserFiles: move to EnsureDirs
Guido Trotter [Wed, 5 May 2010 15:10:29 +0000 (17:10 +0200)]
ssh.GetUserFiles: move to EnsureDirs

We also create a generic SECURE_DIR_MODE constant, rather than
hardcoding 0700 in the code.

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

10 years agoHypervisors: use utils.EnsureDirs
Guido Trotter [Wed, 5 May 2010 14:46:45 +0000 (16:46 +0200)]
Hypervisors: use utils.EnsureDirs

Swap a few os.mkdir calls with utils.EnsureDirs

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

10 years agobackend: remove a couple of useless mkdir calls
Guido Trotter [Wed, 5 May 2010 14:36:25 +0000 (16:36 +0200)]
backend: remove a couple of useless mkdir calls

Those directories must exist for the node daemon to run (it's in the
node daemon's list of ensured directories) and those functions are only
called by the node daemon, so there's no point in those checks+mkdir
calls.

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

10 years agodaemon.GenericMain: fix docstring
Guido Trotter [Wed, 5 May 2010 14:30:55 +0000 (16:30 +0200)]
daemon.GenericMain: fix docstring

The docstring reports a wrong type for the "dirs" argument. Fixing.

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

10 years agojstore: use EnsureDirs, and add more constants
Guido Trotter [Wed, 5 May 2010 14:09:24 +0000 (16:09 +0200)]
jstore: use EnsureDirs, and add more constants

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

10 years agoBump version for 2.1.2 release v2.1.2
Iustin Pop [Thu, 6 May 2010 09:58:14 +0000 (11:58 +0200)]
Bump version for 2.1.2 release

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

10 years agoUpdate NEWS file for 2.1.2
Iustin Pop [Wed, 5 May 2010 13:08:31 +0000 (15:08 +0200)]
Update NEWS file for 2.1.2

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

10 years agoAdd dates to the NEWS file
Iustin Pop [Wed, 5 May 2010 12:28:31 +0000 (14:28 +0200)]
Add dates to the NEWS file

Just for easier history digging…

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

10 years agoRAPI QA: Test instance creation/removal via RAPI
Michael Hanselmann [Wed, 5 May 2010 10:17:52 +0000 (12:17 +0200)]
RAPI QA: Test instance creation/removal via RAPI

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

10 years agoRAPI QA: Support for request body
Michael Hanselmann [Tue, 4 May 2010 15:40:56 +0000 (17:40 +0200)]
RAPI QA: Support for request body

- Add support for sending JSON-encoded body to RAPI daemon
  (required to test more complex resources)
- Expand names when testing resources against config

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

10 years agoSmall fixes for RAPI client
David Knowles [Fri, 30 Apr 2010 15:38:34 +0000 (11:38 -0400)]
Small fixes for RAPI client

- Always check SSL certificate for validity
- Actually JSON-encode HTTP content

Signed-off-by: David Knowles <dknowles@google.com>
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

10 years agocfgupgrade: allow working with relative paths
Iustin Pop [Mon, 3 May 2010 13:57:20 +0000 (15:57 +0200)]
cfgupgrade: allow working with relative paths

Since utils.WriteFile requires an absolute path, cfgupgrade needs to
normalize the directory it is given.

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

10 years agoCleanup /etc/hosts during node removal
Iustin Pop [Mon, 3 May 2010 13:32:00 +0000 (15:32 +0200)]
Cleanup /etc/hosts during node removal

It seems that commit d8470559 dropped the cleanup of /etc/hosts when a
node is removed from the cluster. I don't know for sure, but it seems
accidental. As long as we add it to /etc/hosts, we should clean it up
too.

The patch also adds two FIXMEs since this kind of modifications should
be done via RPC calls to the master's node daemon, not directly.

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

10 years agoverify cluster: check /etc/hosts consistency
Iustin Pop [Mon, 3 May 2010 13:31:11 +0000 (15:31 +0200)]
verify cluster: check /etc/hosts consistency

If we are told to modify /etc/hosts, then verify its consistency during
cluster verify.

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