ganeti-local
13 years agorlib2: Set tag operation param “name” to None for cluster tags
Michael Hanselmann [Wed, 15 Sep 2010 19:39:05 +0000 (21:39 +0200)]
rlib2: Set tag operation param “name” to None for cluster tags

Otherwise parameter verification in the master daemon fails.

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

13 years agoFix OS_VARIANT variable setting
Vitaly Kuznetsov [Wed, 8 Sep 2010 16:57:45 +0000 (16:57 +0000)]
Fix OS_VARIANT variable setting

This was introduced in efaa9b06d1e1e6d1678d0edd75b1ba37cf0de3d9.

 in OSCoreEnv:
  inst_os.name is pure operating system name (without variant) as variant is stripped
   in OSFromDisk(). So we always get variant = inst_os.supported_variants[0] (first
   variant in variants list).
  Adding argument os_name with full name (including variant) solves this problem.

Signed-off-by: Vitaly Kuznetsov <vitty@altlinux.ru>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
[modified by iustin to handle the call to OSCoreEnv from ValidateOS too]
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoFix pylint warning in http/__init__.py
Michael Hanselmann [Fri, 10 Sep 2010 11:48:53 +0000 (13:48 +0200)]
Fix pylint warning in http/__init__.py

My bad for not seeing this before:
R0201:614:HttpBase.GetSslCiphers: Method could be a function

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

13 years agoAllow SSL ciphers to be overridden in HTTP server
Michael Hanselmann [Fri, 10 Sep 2010 11:14:04 +0000 (13:14 +0200)]
Allow SSL ciphers to be overridden in HTTP server

Users of this class, such as the RAPI server, might want to override or adjust
the default SSL cipher defined in a constant.

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

13 years agoIf we had any errors in setup in one of the hosts, exit with non-zero
René Nussbaumer [Thu, 9 Sep 2010 11:13:08 +0000 (13:13 +0200)]
If we had any errors in setup in one of the hosts, exit with non-zero

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

13 years agoFix breakage introduced by commit 8044bf655
Michael Hanselmann [Thu, 2 Sep 2010 16:34:38 +0000 (18:34 +0200)]
Fix breakage introduced by commit 8044bf655

Note to self: even patches removing one line can break everything.

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

13 years agoRemove “dry_run” from opcodes.OpCreateInstance
Michael Hanselmann [Thu, 2 Sep 2010 15:52:44 +0000 (17:52 +0200)]
Remove “dry_run” from opcodes.OpCreateInstance

I'ts declared twice, once in opcodes.OpCode and here, and this one
is redundant.

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

13 years agoDisable the RAPI CA checks in watcher
Iustin Pop [Thu, 2 Sep 2010 09:18:27 +0000 (11:18 +0200)]
Disable the RAPI CA checks in watcher

Since the RAPI certificate is not necessarily self-signed, and we
currently don't have any configuration variable for the real CA file, we
disable for now the CA checks. This fixes the 'restart RAPI every 5
minutes' problem with non-self-signed certs.

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

13 years agomove-instance: Fix parameter order in _CreateInstance
Manuel Franceschini [Wed, 1 Sep 2010 09:34:30 +0000 (11:34 +0200)]
move-instance: Fix parameter order in _CreateInstance

This patch fixes a bug, which caused the primary and secondary
destination nodes to be revered on the destination cluster after an
instance move.

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

13 years agoUse one function to parse “--fields” option values
Michael Hanselmann [Mon, 23 Aug 2010 15:14:11 +0000 (17:14 +0200)]
Use one function to parse “--fields” option values

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

13 years agolocking.LockSet: Use function to get member lock name
Michael Hanselmann [Mon, 23 Aug 2010 12:15:46 +0000 (14:15 +0200)]
locking.LockSet: Use function to get member lock name

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

13 years agoFinalize removal of “lock_status” job field
Michael Hanselmann [Mon, 23 Aug 2010 14:54:22 +0000 (16:54 +0200)]
Finalize removal of “lock_status” job field

When removing the field in commit 9bdab62198, I forgot to remove some parts.

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

13 years agoPrepare 2.2.0~rc1 release v2.2.0rc1
Michael Hanselmann [Mon, 23 Aug 2010 11:58:41 +0000 (13:58 +0200)]
Prepare 2.2.0~rc1 release

Update NEWS and version number.

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

13 years agosetup-ssh: fix updating of authorized_keys
Iustin Pop [Sun, 22 Aug 2010 07:00:20 +0000 (09:00 +0200)]
setup-ssh: fix updating of authorized_keys

Due to what seems like a bug (or inconsistency) in paramiko, files
opened with a+ over SFTP need a seek() in order for the user to be able
to read data from them. We implement this, and rely on the fact that we
do iterate over all lines before writing and that the file is opened in
append mode (which at least on Linux should work correctly).

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

13 years agosetup-ssh: Also use keys from the ssh-agent
Iustin Pop [Sun, 22 Aug 2010 06:37:32 +0000 (08:37 +0200)]
setup-ssh: Also use keys from the ssh-agent

Currently, setup-ssh only uses one disk-based key. This means that any
setup where we use keys from ssh-agent (which do not necessarily exist
on disk) will break when moving from the old method to setup-ssh.

This patch moves the SSH key handling to separate functions, and uses
both the disk key (first) and the agent keys for login.

The patch also fixes the root_logger setup level (I tried to hard to
reduce noise and broke the debug level, sorry).

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

13 years agosetup-ssh: try to use key auth first
Iustin Pop [Fri, 20 Aug 2010 13:12:02 +0000 (15:12 +0200)]
setup-ssh: try to use key auth first

This patch changes the setup-ssh workflow to try key authentication
first, and then fall-back to password authentication. The password is
also read lazily, with no prompts if we can authenticate via keys.

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

13 years agosetup-ssh: redo the logging levels
Iustin Pop [Fri, 20 Aug 2010 13:02:12 +0000 (15:02 +0200)]
setup-ssh: redo the logging levels

There is not enough logged by default on stderr, and way too much
information in the log file.

Since we don't want to debug paramiko itself, we filter only warnings
and above.

Otherwise, we make WARNINGS the default level, with verbose meaning INFO
and debug, well, DEBUG.

Additionally, a message is improved.

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

13 years agosetup-ssh: only read the ssh port once
Iustin Pop [Fri, 20 Aug 2010 12:09:44 +0000 (14:09 +0200)]
setup-ssh: only read the ssh port once

Then reuse it. With certain setups, this could be slow when pre-seeding
an entire cluster.

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

13 years agosetup-ssh: fix the logging error message
Iustin Pop [Fri, 20 Aug 2010 11:54:54 +0000 (13:54 +0200)]
setup-ssh: fix the logging error message

This took a bit of interesting debugging, but the issue seems to be that
on older python/logging/paramiko (I'm not sure which is at fault here),
the other threads are finishing later than the main thread, so the
logging module closes the logging file (but doesn't unregister it)
before the paramiko thread(s) get a change to finish their logging.

Tested on both old versions (Dapper) and new versions (Lucid) of these
three pieces of the puzzle.

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

13 years agoUse Sphinx' :rfc: extension to refer to RFCs
Michael Hanselmann [Fri, 20 Aug 2010 13:13:51 +0000 (15:13 +0200)]
Use Sphinx' :rfc: extension to refer to RFCs

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

13 years agoDocument non-standard usage of JSON in RAPI
Michael Hanselmann [Fri, 20 Aug 2010 13:13:11 +0000 (15:13 +0200)]
Document non-standard usage of JSON in RAPI

This was requested in issue 118.

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

13 years agoFix small spelling mistake
Manuel Franceschini [Fri, 20 Aug 2010 09:46:24 +0000 (11:46 +0200)]
Fix small spelling mistake

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

13 years agoExplicitly add dry-run to some commands
Iustin Pop [Thu, 19 Aug 2010 12:25:50 +0000 (14:25 +0200)]
Explicitly add dry-run to some commands

Based on manual inspection (that the command only does a submit of some
jobs/opcodes), we re-add the dry-run option on a subset of the existing
commands.

A few more commands could use dry-run, but the code doesn't deal nicely
with no results, so fixing those is left for later patches.

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

13 years agoStop adding the dry-run option by default
Iustin Pop [Thu, 19 Aug 2010 10:40:22 +0000 (12:40 +0200)]
Stop adding the dry-run option by default

Currently cli.py unconditionally adds the dry-run option. This patch
disables this, and exports dry-run as a normal option.

The other alternative I tried to implement (adding a new fake option for
disabling the auto-add per individual command) would require changes in
more places, as the list of options is no longer a homogeneous list.

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

13 years agoFix a few commands behaviour with dry-run
Iustin Pop [Thu, 19 Aug 2010 13:51:00 +0000 (15:51 +0200)]
Fix a few commands behaviour with dry-run

These commands use or display the result from the LU, so in case of
dry-run, they will crash or display just 'None'. At least checking that
the result is 'true' (in the boolean sense) will make them work better.

As for gnt-os modify, it didn't pass the 'opts' parameter properly to
SubmitOpCode, so the dry-run option was silently ignored.

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

13 years agojqueue: Remove lock status field
Michael Hanselmann [Wed, 18 Aug 2010 15:19:44 +0000 (17:19 +0200)]
jqueue: Remove lock status field

With the job queue changes for Ganeti 2.2, watched and queried jobs are
loaded directly from disk, rendering the in-memory “lock_status” field
useless. Writing it to disk would be possible, but has a huge cost at
runtime (when tested, processing 1'000 opcodes involved 4'000 additional
writes to job files, even with replication turned off).

Using an additional in-memory dictionary to just manage this field turned
out to be a complicated task due to the necessary locking.

The plan is to introduce a more generic lock debugging mechanism in the
near future. Hence the decision is to remove this field now instead of
spending a lot of time to make it working again.

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

13 years agoQA: Run simple job queue test
Michael Hanselmann [Wed, 18 Aug 2010 13:01:31 +0000 (15:01 +0200)]
QA: Run simple job queue test

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

13 years agoMerge branch 'devel-2.1' into devel-2.2
Guido Trotter [Thu, 19 Aug 2010 13:56:40 +0000 (14:56 +0100)]
Merge branch 'devel-2.1' into devel-2.2

* devel-2.1:
  Don't ignore secondary node silently

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

13 years agoDon't ignore secondary node silently
Guido Trotter [Thu, 19 Aug 2010 12:59:55 +0000 (13:59 +0100)]
Don't ignore secondary node silently

Currently on non-mirrored disk templates the secondary node is ignored
silently. This patch adds a check for this case, and warns the user
should this be happening. This solves issue 113.

The patch also moves a prereq check to an argument check. This is ok
because the iallocator framework already checks it has a secondary node,
when it needs one.

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

13 years agoetags: force Python as a language
Iustin Pop [Thu, 19 Aug 2010 11:41:04 +0000 (13:41 +0200)]
etags: force Python as a language

etags has cannot properly identify the scripts/gnt-* files as Python, so
we statically force the language to Python.

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

13 years agoMerge branch 'devel-2.1' into devel-2.2
Guido Trotter [Wed, 18 Aug 2010 16:44:12 +0000 (17:44 +0100)]
Merge branch 'devel-2.1' into devel-2.2

* devel-2.1:
  Fix --master-netdev arg name in gnt-cluster(8)
  Restore 'tablet mouse on vnc' behavior
  Document the usb_mouse hv parameter
  Revert "Add -usbdevice tablet to KVM when using vnc"

Conflicts:
man/gnt-instance.sgml
  - merge

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

13 years agoRAPI client: Support modifying instances
Michael Hanselmann [Tue, 17 Aug 2010 16:50:37 +0000 (18:50 +0200)]
RAPI client: Support modifying instances

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

13 years agoRAPI: Allow modifying instance
Michael Hanselmann [Tue, 17 Aug 2010 16:50:11 +0000 (18:50 +0200)]
RAPI: Allow modifying instance

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

13 years agoSmall fixes for instance creation via RAPI documentation
Michael Hanselmann [Tue, 17 Aug 2010 15:16:38 +0000 (17:16 +0200)]
Small fixes for instance creation via RAPI documentation

- Inconsistencies
- Missing types

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

13 years agognt-debug: Extend job queue tests
Michael Hanselmann [Fri, 13 Aug 2010 10:22:43 +0000 (12:22 +0200)]
gnt-debug: Extend job queue tests

Test multiple opcodes, also with failure.

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

13 years agojqueue: Mark opcodes following failed ones as failed, too
Michael Hanselmann [Tue, 17 Aug 2010 13:52:11 +0000 (15:52 +0200)]
jqueue: Mark opcodes following failed ones as failed, too

When an opcode fails, the job queue would leave following opcodes as “queued”,
which can be quite confusing. With this patch, they're all marked as failed and
assertions are added to check this.

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

13 years agojqueue: Work around race condition between job processing and archival
Michael Hanselmann [Tue, 17 Aug 2010 13:33:52 +0000 (15:33 +0200)]
jqueue: Work around race condition between job processing and archival

This is a simplified version of a patch I sent earlier to make sure the job
file is only written once with a finalized status.

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

13 years agojqueue: More checks for cancelling queued job
Michael Hanselmann [Fri, 13 Aug 2010 17:18:36 +0000 (19:18 +0200)]
jqueue: More checks for cancelling queued job

We can also check when the lock status is updated. This will
improve job cancelling.

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

13 years agoerrors: Function to check whether value is encoded error
Michael Hanselmann [Fri, 13 Aug 2010 17:19:07 +0000 (19:19 +0200)]
errors: Function to check whether value is encoded error

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

13 years agojqueue: Add more debug output
Michael Hanselmann [Thu, 12 Aug 2010 11:08:46 +0000 (13:08 +0200)]
jqueue: Add more debug output

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

13 years agognt-backup: Pass error code to OpPrereqError
Michael Hanselmann [Mon, 16 Aug 2010 13:53:41 +0000 (15:53 +0200)]
gnt-backup: Pass error code to OpPrereqError

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

13 years agoMerge branch 'devel-2.1'
Iustin Pop [Tue, 17 Aug 2010 12:42:58 +0000 (14:42 +0200)]
Merge branch 'devel-2.1'

* devel-2.1:
  Fix path in ganeti-rapi man page
  Adjust message in case ~/.ssh is no directory

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

13 years agoRe-add the 'live' parameter to migration opcodes
Iustin Pop [Tue, 17 Aug 2010 12:18:34 +0000 (14:18 +0200)]
Re-add the 'live' parameter to migration opcodes

This patch reintroduces the live parameter, for backwards compatibility
at the Luxi level. This way, clients can work transparently with both
2.1 and 2.2, even though sub-optimally.

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

13 years agoFix --master-netdev arg name in gnt-cluster(8)
Guido Trotter [Thu, 12 Aug 2010 15:50:47 +0000 (11:50 -0400)]
Fix --master-netdev arg name in gnt-cluster(8)

This fixes Issue 114.

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

13 years agoRestore 'tablet mouse on vnc' behavior
Guido Trotter [Mon, 9 Aug 2010 18:30:17 +0000 (14:30 -0400)]
Restore 'tablet mouse on vnc' behavior

We needed to revert commit 5b062a58ac76b39c2dc6a7e1543affdf43dc7ee7
because it was in conflict with the usb_mouse hv parameter. Here we
reintroduce its functionality only when usb_mouse is not specified.

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

13 years agoDocument the usb_mouse hv parameter
Guido Trotter [Mon, 9 Aug 2010 16:19:07 +0000 (12:19 -0400)]
Document the usb_mouse hv parameter

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

13 years agoRevert "Add -usbdevice tablet to KVM when using vnc"
Guido Trotter [Mon, 9 Aug 2010 16:11:07 +0000 (12:11 -0400)]
Revert "Add -usbdevice tablet to KVM when using vnc"

This reverts commit 5b062a58ac76b39c2dc6a7e1543affdf43dc7ee7.
This fixes issue 109. The mouse type can be set with the usb_mouse
hv parameter.

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

13 years agoFix path in ganeti-rapi man page
Michael Hanselmann [Mon, 16 Aug 2010 13:54:26 +0000 (15:54 +0200)]
Fix path in ganeti-rapi man page

This takes care of issue 116.

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

13 years agoworkerpool: Don't keep reference to task arguments
Michael Hanselmann [Fri, 13 Aug 2010 10:26:31 +0000 (12:26 +0200)]
workerpool: Don't keep reference to task arguments

The workerpool should not keep any reference to task arguments after
they were processed by RunTask. Doing so led to jobs being cached
by the job queue's WeakValueDictionary for longer than they should've
been.

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

13 years agocli.SubmitOpCode: Pass keyword parameter as keyword
Michael Hanselmann [Fri, 13 Aug 2010 10:21:28 +0000 (12:21 +0200)]
cli.SubmitOpCode: Pass keyword parameter as keyword

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

13 years agognt-backup: Don't show confusing message w/o target node
Michael Hanselmann [Tue, 10 Aug 2010 15:54:42 +0000 (17:54 +0200)]
gnt-backup: Don't show confusing message w/o target node

“gnt-backup export” requires the target node. Until now, the master
daemon would complain that the “parameter
'OP_BACKUP_EXPORT.target_node' fails validation”. With this patch,
an additional check is done in the client program.

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

13 years agomasterd.instance: Add missing argument
Michael Hanselmann [Tue, 10 Aug 2010 14:41:50 +0000 (16:41 +0200)]
masterd.instance: Add missing argument

_DiskTransferPrivate takes three parameters, not two.

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

13 years agoAdjust message in case ~/.ssh is no directory
Michael Hanselmann [Tue, 10 Aug 2010 13:51:11 +0000 (15:51 +0200)]
Adjust message in case ~/.ssh is no directory

Use actual path, not something hardcoded.

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

13 years agoRAPI client: Fix docstring for migrating instance
Michael Hanselmann [Fri, 30 Jul 2010 18:47:50 +0000 (20:47 +0200)]
RAPI client: Fix docstring for migrating instance

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

13 years agoQA: Test renaming instance via RAPI
Michael Hanselmann [Fri, 30 Jul 2010 17:52:43 +0000 (19:52 +0200)]
QA: Test renaming instance via RAPI

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

13 years agoRAPI client: Support renaming instances
Michael Hanselmann [Fri, 30 Jul 2010 17:33:31 +0000 (19:33 +0200)]
RAPI client: Support renaming instances

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

13 years agoAllow renaming instances via RAPI
Michael Hanselmann [Fri, 30 Jul 2010 17:12:32 +0000 (19:12 +0200)]
Allow renaming instances via RAPI

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

13 years agoRAPI client: Don't re-use PycURL object
Michael Hanselmann [Fri, 30 Jul 2010 18:44:07 +0000 (20:44 +0200)]
RAPI client: Don't re-use PycURL object

With this patch, a new PycURL object will be created for each request.
This should make the RAPI client safe for simultaneous calls from
multiple threads. Unittests are adjusted accordingly.

An unnecessary variable assignment is also removed from the unittest
script.

This patch survived a small QA and unittests.

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

13 years agoAdd --no-name-check to 'gnt-instance rename' man page
Manuel Franceschini [Mon, 9 Aug 2010 15:49:23 +0000 (17:49 +0200)]
Add --no-name-check to 'gnt-instance rename' man page

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

13 years agoFix bug in bdev when drbd version format is x.x.x.x
Manuel Franceschini [Thu, 5 Aug 2010 12:56:12 +0000 (14:56 +0200)]
Fix bug in bdev when drbd version format is x.x.x.x

This patch fixes a bug reported in [0]. Newer drbd versions can have
another digit beyond the regular major, minor and point release digits.
We modify the regex used to match that with an optional parts which is
not saved.

Furthermore it adds unittests that test for these different cases. Now
the data read from /proc is passed into the _GetVersion method, which
makes testing easier.

[0] http://code.google.com/p/ganeti/issues/detail?id=110

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

13 years agoBump version to 2.2.0~rc0 v2.2.0rc0
Iustin Pop [Fri, 30 Jul 2010 16:11:12 +0000 (12:11 -0400)]
Bump version to 2.2.0~rc0

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

13 years agomove-instance: Use constants for parameters
Michael Hanselmann [Fri, 30 Jul 2010 14:32:56 +0000 (16:32 +0200)]
move-instance: Use constants for parameters

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

13 years agoAllow instance NIC's IP address to be None
Michael Hanselmann [Fri, 30 Jul 2010 14:32:33 +0000 (16:32 +0200)]
Allow instance NIC's IP address to be None

Also add some assertions.

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

13 years agoTest instance NIC and disk parameter names
Michael Hanselmann [Fri, 30 Jul 2010 14:32:00 +0000 (16:32 +0200)]
Test instance NIC and disk parameter names

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

13 years agoAdd new parameter type “maybe string”
Michael Hanselmann [Fri, 30 Jul 2010 14:31:26 +0000 (16:31 +0200)]
Add new parameter type “maybe string”

Before strict checking was implemented, NIC IP addresses could be set
to “None”. Commit bd061c35 added more strict checking, including
enforcing the IP address to be a string. With this new type, it
can again be set to None.

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

13 years agocmdlib: Change expected type for source CA on remote import
Michael Hanselmann [Thu, 29 Jul 2010 15:55:38 +0000 (17:55 +0200)]
cmdlib: Change expected type for source CA on remote import

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

13 years agomove-instance: Pass OS parameters to new instance
Michael Hanselmann [Thu, 29 Jul 2010 15:55:14 +0000 (17:55 +0200)]
move-instance: Pass OS parameters to new instance

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

13 years agoUpdate NEWS file for the first release candidate
Iustin Pop [Fri, 30 Jul 2010 14:15:48 +0000 (10:15 -0400)]
Update NEWS file for the first release candidate

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

13 years agoFix a few job archival issues
Iustin Pop [Thu, 29 Jul 2010 23:00:19 +0000 (19:00 -0400)]
Fix a few job archival issues

This patch fixes two issues with job archival. First, the
LoadJobFromDisk can return 'None' for no-such-job, and we shouldn't add
None to the job list; we can't anyway, as this raises an exception:

  node1# gnt-job archive foo
  Unhandled protocol error while talking to the master daemon:
  Caught exception: cannot create weak reference to 'NoneType' object

After fixing this, job archival of missing jobs will just continue
silently, so we modify gnt-job archive to log jobs which were not
archived and to return exit code 1 for any missing jobs.

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

13 years agoburning: fix handling of empty job sets
Iustin Pop [Thu, 29 Jul 2010 22:37:10 +0000 (18:37 -0400)]
burning: fix handling of empty job sets

If we call burning with only existing instance, then it will fail to
create any of them, and thus in the removal phase it won't have anything
to remove. Since calling luxi.SUBMIT_MULTIPLE_JOBS with an empty job set
is an error (and will raise an exception), this creates a very strange
error in burnin (which is unfortunately hidden by ExecJobSet()).

As such, we modify CommitQueue to return immediately if it has an empty
op queue.

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

13 years agoChange semantics of --force-multi for reinstall
Iustin Pop [Thu, 29 Jul 2010 22:13:58 +0000 (18:13 -0400)]
Change semantics of --force-multi for reinstall

Currently, we require both --force and --force-multiple for skipping the
confirmation on instance reinstalls. After offline conversations, this
has been deemed to be excessive, and this patch changes the meaning of
--force-multiple to be a “stronger” force, and not require both.

So, to skip the prompts:
- single instance reinstallation requires either --force or
  --force-multiple
- multiple instance reinstallation requires --force-multiple

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

13 years agoChange handling of non-Ganeti errors in jqueue
Iustin Pop [Thu, 29 Jul 2010 21:14:19 +0000 (17:14 -0400)]
Change handling of non-Ganeti errors in jqueue

Currently, if a job execution raises a Ganeti-specific error (i.e.
subclass of GenericError), then we encode it as (error class, [error
args]). This matches the RAPI documentation.

However, if we get a non-Ganeti error, then we encode it as simply
str(err), a single string. This means that the opresult field is not
according to the RAPI docs, and thus it's hard to reliably parse the
job results.

This patch changes the encoding of a failed job (via failure) to always
be an OpExecError, so that we always encode it properly. For the command
line interface, the behaviour is the same, as any non-Ganeti errors get
re-encoded as OpExecError anyway. For the RAPI clients, it only means
that we always present the same type for results. The actual error value
is the same, since the err.args is either way str(original_error);
compare the original (doesn't contain the ValueError):

  "opresult": [
    "invalid literal for int(): aa"
  ],

with:

  "opresult": [
    [
      "OpExecError",
      [
        "invalid literal for int(): aa"
      ]
    ]
  ],

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

13 years agoImplement gnt-cluster master-ping
Iustin Pop [Thu, 29 Jul 2010 21:41:24 +0000 (17:41 -0400)]
Implement gnt-cluster master-ping

This can be used from shell-scripts to quickly check the status of the
master node, before launching a series of jobs (and handling the failure
of the jobs due to masterd other issues).

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

13 years agoInstance migration: remove error on missing link
Iustin Pop [Thu, 29 Jul 2010 18:41:09 +0000 (14:41 -0400)]
Instance migration: remove error on missing link

Since we don't support upgrades from 1.2.4 without restarting the
instance, the 'not restarted since 1.2.5' check/error is
wrong/misleading.

Since the live migration works anyway without the links (it recreates
them during the disk reconfiguration anyway), we remove the check and we
transform it into a warning (to the node daemon log only,
unfortunately).

For 2.3, we'll need to change the symlink creation from instance start
time to disk activation time (but that requires more RPC changes).

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

13 years agoAdd check for RAPI paths to start with /2
Michael Hanselmann [Thu, 29 Jul 2010 16:08:11 +0000 (18:08 +0200)]
Add check for RAPI paths to start with /2

During a discussion in July 2010 it was decided that we'll stabilize on /2. See
message ID <20100716180012.GA9423@google.com> for reference.

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

13 years agoEnsure assertions are evaluated in tests
Michael Hanselmann [Thu, 29 Jul 2010 13:18:47 +0000 (15:18 +0200)]
Ensure assertions are evaluated in tests

A lot of assertions are used in Ganeti's code. Some unittests even check
whether AssertionError is raised in some cases. Explicitely ensuring
assertions are evaluated makes sure those tests don't fail and
assertions are checked.

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

13 years agoRAPI client: The os argument for instance reinstalls is optional
David Knowles [Tue, 20 Jul 2010 21:46:13 +0000 (17:46 -0400)]
RAPI client: The os argument for instance reinstalls is optional

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

13 years agoQA: Test instance migration via CLI and RAPI
Michael Hanselmann [Fri, 16 Jul 2010 17:44:06 +0000 (19:44 +0200)]
QA: Test instance migration via CLI and RAPI

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

13 years agoRAPI client: Support migrating instances
Michael Hanselmann [Fri, 16 Jul 2010 17:43:50 +0000 (19:43 +0200)]
RAPI client: Support migrating instances

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

13 years agoRAPI: Support migrating instances
Michael Hanselmann [Fri, 16 Jul 2010 17:43:28 +0000 (19:43 +0200)]
RAPI: Support migrating instances

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

13 years agoworkerpool: Change signature of AddTask function to not use *args
Michael Hanselmann [Sat, 17 Jul 2010 21:04:32 +0000 (23:04 +0200)]
workerpool: Change signature of AddTask function to not use *args

By changing it to a normal parameter, which must be a sequence, we can
start using keyword parameters.

Before this patch all arguments to “AddTask(self, *args)” were passed as
arguments to the worker's “RunTask” method. Priorities, which should be
optional and will be implemented in a future patch, must be passed as a keyword
parameter. This means “*args” can no longer be used as one can't combine *args
and keyword parameters in a clean way:

>>> def f(name=None, *args):
...   print "%r, %r" % (args, name)
...
>>> f("p1", "p2", "p3", name="thename")
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 TypeError: f() got multiple values for keyword argument 'name'

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

13 years agoworkerpool: Add two additional assertions
Michael Hanselmann [Sat, 17 Jul 2010 21:00:56 +0000 (23:00 +0200)]
workerpool: Add two additional assertions

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

13 years agoworkerpool: Additional check in BaseWorker.ShouldTerminate
Michael Hanselmann [Sat, 17 Jul 2010 20:58:09 +0000 (22:58 +0200)]
workerpool: Additional check in BaseWorker.ShouldTerminate

Document that it should only be called from within RunTask and
add an assertion for this. This means we can no longer use a
method on the pool and hence remove WorkerPool.ShouldWorkerTerminate.

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

13 years agoworkerpool: Remove unused worker method
Michael Hanselmann [Sat, 17 Jul 2010 20:56:18 +0000 (22:56 +0200)]
workerpool: Remove unused worker method

HasRunningTask is never used except for an assertion, where we
don't really need the lock.

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

13 years agoworkerpool: Move waiting for new tasks for a worker to the pool
Michael Hanselmann [Sat, 17 Jul 2010 20:32:43 +0000 (22:32 +0200)]
workerpool: Move waiting for new tasks for a worker to the pool

This way fewer private variables of the pool are accesssed by the worker.

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

13 years agoworkerpool: Use common function to add tasks
Michael Hanselmann [Sat, 17 Jul 2010 20:25:27 +0000 (22:25 +0200)]
workerpool: Use common function to add tasks

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

13 years agoFix install document regarding DRBD usage
Iustin Pop [Wed, 28 Jul 2010 23:39:53 +0000 (19:39 -0400)]
Fix install document regarding DRBD usage

This is related to issue 105.

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

13 years agoUpdate RAPI documentation for the OS changes
Iustin Pop [Wed, 28 Jul 2010 21:17:10 +0000 (17:17 -0400)]
Update RAPI documentation for the OS changes

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

13 years agoRename masterfailover to master-failover
Iustin Pop [Tue, 27 Jul 2010 21:07:20 +0000 (17:07 -0400)]
Rename masterfailover to master-failover

Most (all?) of our commands use dash-separator: replace-disks,
verify-disks, add-tags, etc. “gnt-cluster masterfailover” is an old
exception to this rule.

The patch replaces it with master-failover, add a compatiblity alias,
and updates the documentation for this change.

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

13 years agoRAPI: Add os params to instance creation v1
Iustin Pop [Wed, 28 Jul 2010 18:26:04 +0000 (14:26 -0400)]
RAPI: Add os params to instance creation v1

Since the RAPI QA suite doesn't seem to offer easy testing of failed
creations, I didn't add this to the QA. Pointers on how to do it are
welcome.

The patch also changes the 'os' argument to be required, since that is
how the LU expects it, and without it we just fail later instead of
directly at submission time.

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

13 years agomakefile: fix TAGS building
Iustin Pop [Wed, 28 Jul 2010 18:24:23 +0000 (14:24 -0400)]
makefile: fix TAGS building

“find .” requires that “-path” arguments start with a dot, otherwise
they are not matches. Additionally, we also include the QA files in the
tags, for easier search while modifying the QA suite.

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

13 years agoImprove handling of lost jobs
Iustin Pop [Wed, 28 Jul 2010 20:08:29 +0000 (16:08 -0400)]
Improve handling of lost jobs

Currently, if the cli.JobExecutor class is being used, and one of the
jobs is being archived before it can check its result, it will raise a
stracktrace as _ChooseJob is not prepared to handle this case.

This case makes JobExecutor work better with lost jobs (it still reports
them as 'failed', but it doesn't break and returns a proper error
message), and modifies the generic FormatError to report the JobLost
exception properly, instead of as "Unhandled Ganeti Exception".

Since JobExecutor is hard to test properly, I only tested this manually,
via a fake invocation.

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

13 years agoluxi: convert permission errors into exception
Iustin Pop [Wed, 28 Jul 2010 15:50:38 +0000 (11:50 -0400)]
luxi: convert permission errors into exception

This patch adds handling of permission errors so that we don't show
tracebacks when a non-root user runs a gnt-* command. Since in the
future we'll have different permissions, we need to handle this in RAPI
too.

It also fixes a typo in RAPI error message and the docstrings of LUXI
errors.

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

13 years agocmdlib: Return new name from rename operations
Michael Hanselmann [Mon, 19 Jul 2010 14:40:38 +0000 (16:40 +0200)]
cmdlib: Return new name from rename operations

The new name is then displayed by the clients.

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

13 years agognt-instance rename: Fix bug and rename params
Manuel Franceschini [Wed, 28 Jul 2010 14:58:19 +0000 (16:58 +0200)]
gnt-instance rename: Fix bug and rename params

This patch fixes a bug when gnt-instance rename was invoked with
--no-name-check. It renames the internal variables to be consistent with
the ones in equivalent instance add code. Furthermore it checks whether
and instance rename is invoked with --no-name-check but without
--no-ip-check and throws an exception if so.

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

13 years agoQA: add tests for the reserved lvs feature
Iustin Pop [Sat, 24 Jul 2010 00:11:00 +0000 (20:11 -0400)]
QA: add tests for the reserved lvs feature

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

13 years agoAdd modification of the reserved logical volumes
Iustin Pop [Fri, 23 Jul 2010 23:28:29 +0000 (19:28 -0400)]
Add modification of the reserved logical volumes

This doesn't allow addition/removal of individual volumes, only
wholesale replace of the entire list. It can be improved later, if we
ever get generic container parameters.

The man page changes replaces some tabs with spaces (hence the
whitespace changes).

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

13 years agoAdd printing of reserved_lvs in cluster info
Iustin Pop [Thu, 15 Apr 2010 15:08:40 +0000 (17:08 +0200)]
Add printing of reserved_lvs in cluster info

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

13 years agoIntrouce a new cluster parameter - reserved_lvs
Iustin Pop [Thu, 15 Apr 2010 15:07:03 +0000 (17:07 +0200)]
Introuce a new cluster parameter - reserved_lvs

This parameter, which is a list of regular expression patterns, will
make cluster verify ignore any such LVs. It will not prevent creation or
removal of such volumes by the backend code.

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

13 years agoChange the meaning of call_node_start_master
Iustin Pop [Fri, 23 Jul 2010 19:29:31 +0000 (15:29 -0400)]
Change the meaning of call_node_start_master

Currently, backend.StartMaster (the function behind this RPC call) will
activate the master IP and then, if the start_daemons parameter is true,
it will also activate the master role.

While this works, it has two issues:

- first, it will activate the master IP unconditionally, even if this
  node will not start the master daemon due to missing votes
- second, the activation of the IP is done twice if start_daemons is
  true, because the master daemon does its own activation too

This behaviour seems to be unmodified since Summer 2008, so probably any
rationale on why this is done in two places is forgotten.

The patch changes so that this function does *either* IP activation or
master role activation but not both. So the IP will be activated only
once (from the master daemon or from LURenameCluster), and it will only
be done if the masterd got enough votes for startup.

I can see only one downside to this change: if masterd won't actually
start (due to missing votes), RAPI will still start, and without the
master IP activated. But this is no worse than before, when both RAPI
was running and the IP was activated.

Note that the behaviour of StopMaster remains the same, as noone else
does the IP removal.

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