Apollon Oikonomopoulos [Tue, 10 May 2011 11:10:13 +0000 (14:10 +0300)]
Fix lock release in TLMigrateInstance
Commit
52f33103 introduced lock release factorization, replacing manual
lock release using utility functions. However, it broke
TLMigrateInstance due to a typo (passing the Tasklet to ReleaseLocks
instead of the parent LU). We fix this by passing the LU to
ReleaseLocks.
Thanks to Dan Eriksson for reporting this.
Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Tue, 10 May 2011 09:55:42 +0000 (11:55 +0200)]
Re-indent test/mocks.py using two spaces
No idea where those four spaces came from, but they must've been there
for a while.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Tue, 10 May 2011 09:41:14 +0000 (11:41 +0200)]
cmdlib: Remove acquired_locks attribute from LUs
The “acquired_locks” attribute in LUs is used to keep a list of acquired
locks at each lock level. This information is already known in the lock
manager, which also happens to be the authoritative source. Removing the
attribute and directly talking to the lock manager saves us from having
to maintain the duplicate information when releasing locks.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Mon, 9 May 2011 16:09:07 +0000 (18:09 +0200)]
cmdlib: Use local alias for lock manager
Saves some typing and we'll use it more often in the future.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Mon, 9 May 2011 14:46:29 +0000 (16:46 +0200)]
opcodes: Add function for compact summary
Depending on the opcode and its parameters, the existing “Summary”
function can give a rater long summary. For displaying the summary in
logs and in the lock monitor, it should be shorter. Hence this new
function is added to just use the opcode ID with common prefixes
replaced (e.g. “INSTANCE_” becomes “I_”). Opcode values are not used.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 6 May 2011 15:37:08 +0000 (17:37 +0200)]
Show locksets in lock monitor
When all locks contained in a set are acquired, the lockset's internal
lock is acquired with the same mode. With this patch the internal lock
will show up on the lock monitor, named e.g. “instances/[lockset]”.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Michael Hanselmann [Fri, 6 May 2011 12:46:29 +0000 (14:46 +0200)]
locking: Make parameter to condition's wait() positional
It is always used in the locking code. Unittests are updated.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Michael Hanselmann [Fri, 6 May 2011 12:40:26 +0000 (14:40 +0200)]
SharedLock: Avoid acquires from sneaking in while notifying
In some rare cases new shared acquires could sneak in through the
condition cached in “__pending_shared” while the code was still
notifying acquires. This was only working because such a condition
would be on top of the queue.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Fri, 6 May 2011 09:07:32 +0000 (11:07 +0200)]
Fix instance failover/migration w.r.t TLMigrateInstance
Commit
1c6e5787 removed the iallocator and target_node keyword
parameters from TLMigrateInstance, but I didn't update their use in
LUInstanceFailover and (not fully) in LUInstanceMigrate.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Apollon Oikonomopoulos [Tue, 22 Mar 2011 16:17:53 +0000 (18:17 +0200)]
Fix DTS_EXT_MIRROR migration
Commit
faaabe3c fixed failover behaviour for DTS_INT_MIRROR instances, however
it broke migration for DTS_EXT_MIRROR instances, by moving iallocator and node
checks from LUInstanceMigrate to TLMigrateInstance. This has the side-effect
that the LU called the TL with None for both, node and iallocator when the
default iallocator was being used.
This patch maintains the iallocator checks in TLMigrateInstance and fixes the
LU-TL integration.
Signed-off-by: Iustin Pop <iustin@google.com>
[iustin@google.com: rebased patch on current HEAD]
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Mon, 2 May 2011 14:33:40 +0000 (16:33 +0200)]
Use node group locking for replacing disks
This is one of the first opcodes to make use of node group locking. To
get an instance's node groups, the instance's nodes need to be looked
at. Due to a previous design decision nodes are locked after the group,
hence there's no clean locking order. This patch works around that by
first getting the instance's groups without locks, and then verifying
them after actually getting all locks. Rough overview:
- Lock instance
- Get groups of instance's nodes
- Lock groups
- Lock all nodes in groups
- Verify node groups
- Run iallocator
- Release group and unused nodes
- Replace disks, etc.
There are probably too many assertions in the code, but it's locking and
we've been bitten in the past.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Mon, 2 May 2011 14:22:57 +0000 (16:22 +0200)]
config: Add function to determine instance's groups
This will be used for locking only the necessary node group(s)
for per-instance operations.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Apollon Oikonomopoulos [Thu, 5 May 2011 08:26:27 +0000 (11:26 +0300)]
TLMigrateInstance: Fix live migration breakage
Commit 77fcff4 unintentionally incorporated code from
TLMigrateInstance.CheckPrereq into TLMigrateInstance._RunAllocator, presumably
during a rebase from earlier versions of the patch to the 2.5 codebase. As a
result all migrations running without an iallocator were performed non-live :-(
This patch moves the affected code back to CheckPrereq.
Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Wed, 4 May 2011 14:15:53 +0000 (16:15 +0200)]
cmdlib: Update error messages, remove some punctuation
- Clarify some error messages
- Remove unnecessary punctuation
- Merge two if conditions in one place
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Marco Casavecchia [Mon, 2 May 2011 08:39:50 +0000 (01:39 -0700)]
Use floppy disk and a second CDROM on KVM
Hi all,
this patch will add 3 new KVM parameters and a new option.
New Parameters:
- floppy_image_path = "" -> Specify the floppy image to load as
floppy disk.
- cdrom2_image_path = "" -> Specify a second cdrom image to load on
the system (note: this in not intended to be used as a boot device. To
boot the system from cdrom you must use the "cdrom_image_path"
parameter as always).
- cdrom_disk_type = "" -> it can be one of the kvm supported types as
"ide,scsi,paravirtual,ecc". I introduced this optional parameter to
make possible to specify a different virtual device for cdroms. It is
useful if you want to install a windows system
New option for "boot_device" parameter:
- "floppy": with this value you should be able to boot a KVM
instance from floppy image.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 28 Apr 2011 14:24:20 +0000 (16:24 +0200)]
cmdlib: Factorize lock releasing
There will be more lock releasing with upcoming changes, so this will
centralize the logic behind it (what locks to keep, which variables to
update, etc.).
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 29 Apr 2011 12:56:50 +0000 (14:56 +0200)]
Merge branch 'devel-2.4'
* devel-2.4:
TLReplaceDisks: Use implicit loop for dictionary
Release unneeded locks while replacing disks
locking: Export “list_owned” from lock manager
gnt-instance: Fix typo in error message
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 29 Apr 2011 12:54:26 +0000 (14:54 +0200)]
TLReplaceDisks: Use implicit loop for dictionary
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 29 Apr 2011 12:43:02 +0000 (14:43 +0200)]
Release unneeded locks while replacing disks
If an iallocator is used, “gnt-instance replace-disks” would acquire the
locks of all nodes (only the allocator will decide which node to use).
Unfortunately the unneeded locks were not released during the operation,
causing unnecessary delays for other jobs.
This patch changes the LU to release unneeded locks and adds assertions.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 29 Apr 2011 10:45:47 +0000 (12:45 +0200)]
locking: Export “list_owned” from lock manager
This is analog to “is_owned” and will be used for assertions.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 29 Apr 2011 10:45:13 +0000 (12:45 +0200)]
gnt-instance: Fix typo in error message
The iallocator parameter is “-I”, not “-i”.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 29 Apr 2011 12:14:15 +0000 (14:14 +0200)]
Merge branch 'devel-2.4'
* devel-2.4: (24 commits)
mlock: fail gracefully if libc.so.6 cannot be loaded
Allow creating the DRBD metadev in a different VG
Make _GenerateDRBD8Branch accept different VG names
Fix WriteFile with unicode data
Replace disks: keep the meta device in the same VG
Fix for multiple VGs - PlainToDrbd and replace-disks
Fix potential data-loss in utils.WriteFile
Improve error messages in cluster verify/OS
Prevent readding of the master node
Fix punctuation in an error message
cli: Fix wrong argument kind for groups
Quote filename in gnt-instance.8
Fix typo in LUGroupAssignNodes
gnt-instance info: automatically request locking
Document the dependency on OOB for gnt-node power
Fix master IP activation in failover with no-voting
disk wiping: fix bug in chunk size computation
Fix bug in watcher
Release locks before wiping disks during instance creation
utils.WriteFile: Close file before renaming
...
Conflicts:
lib/cmdlib.py: Disk parameter constants
man/gnt-instance.rst: Trivial
man/gnt-node.rst: Trivial
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Fri, 29 Apr 2011 10:24:32 +0000 (12:24 +0200)]
mlock: fail gracefully if libc.so.6 cannot be loaded
This allows noded to continue instead of blowing up if the libc major
number changes.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Wed, 27 Apr 2011 16:14:36 +0000 (18:14 +0200)]
cmdlib: Drop SSH runner from LU base class
It is no longer used.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Adeodato Simo [Thu, 28 Apr 2011 16:02:52 +0000 (17:02 +0100)]
cmdlib.py: fix indentation in _VerifyNode
Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Wed, 27 Apr 2011 15:15:47 +0000 (17:15 +0200)]
TLMigrateInstance: Fix confusing text
Commit
d5cafd31 changed this error message, swapping the
text parts in the process.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Wed, 27 Apr 2011 14:59:47 +0000 (16:59 +0200)]
LUInstanceRename: Amend comment about lock
Also add an assertion.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Wed, 27 Apr 2011 14:42:56 +0000 (16:42 +0200)]
iallocator: Relocation nodes must be in same group
Quoting from iallocator.rst: “[…] ``relocate`` request is used when an
existing instance needs to be moved within its node group […]”.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Thu, 28 Apr 2011 11:01:13 +0000 (13:01 +0200)]
Fix 'unused import' lint error
Sorry!
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Thu, 28 Apr 2011 08:26:53 +0000 (10:26 +0200)]
SetEtcHostsEntry: maintain existing ordering
Currently RemoveEtcHostsEntry keeps the ordering, but SetEtcHostsEntry
not, as it will always write the new entry at the end of file. I
personally dislike this as it "uglifies" my custom host files, so this
patch makes it update the record instead in-place so to say instead of
moving it.
The patch also simplifies the construction of the new line (we were
doing duplicate work for no gain).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 27 Apr 2011 15:33:48 +0000 (17:33 +0200)]
Convert utils.nodesetup to utils.WriteFile(data=…)
It makes no sense to iteratively write the new etc/hosts file, as we
can pre-compute the desired contents (neither the old nor the new
versions are safe against concurrent changes anyway).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Thu, 28 Apr 2011 08:52:37 +0000 (10:52 +0200)]
Allow creating the DRBD metadev in a different VG
This is a simple change to allow specifying a different VG for the
meta device during the creation of instances and addition of disks via
gnt-instance modify.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Thu, 28 Apr 2011 08:40:32 +0000 (10:40 +0200)]
Make _GenerateDRBD8Branch accept different VG names
This is a small change to make this function take a list of VG names,
instead of a single one.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Thu, 28 Apr 2011 09:21:19 +0000 (11:21 +0200)]
Fix WriteFile with unicode data
Unicode is fun, indeed:
>>> len(buffer("abc"))
3
>>> len(buffer(u"abc"))
12
So we can't pass unicode data to buffer(), as the result will be to
write the in-memory (usually UTF-32) representation to disk.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 27 Apr 2011 12:23:12 +0000 (14:23 +0200)]
Replace disks: keep the meta device in the same VG
This patch enhances the multi-VG support in replace disks, by keeping
the meta device in the same VG, as opposed to moving it to the data
device VG (note that we don't have a way to create the meta in a
different VG in the first place, but at least we correctly handle a
custom config).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Doug Dumitru [Wed, 27 Apr 2011 09:15:54 +0000 (11:15 +0200)]
Fix for multiple VGs - PlainToDrbd and replace-disks
Converting an instance from 'plain' to 'drbd'. The old code would
create the drbd volumes in the default VG and then the renames would
fail. This fix pulls the plain VG names from the existing volumes and
places it into the new disk template.
Running 'replace-disks' has a similar issue with the new disks going
into the wrong VG and then the rename failing.
Their might be a similar issue with 'recreate-disks', but I actually
have no idea what recreate-disks does, so did not look into it.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 27 Apr 2011 11:45:57 +0000 (13:45 +0200)]
Fix potential data-loss in utils.WriteFile
os.write can do incomplete writes, as long as at least some bytes have
been written (like write(2)):
>>> os.write(fd, " " * 1300)
1300
>>> os.write(fd, " " * 1300)
1300
>>> os.write(fd, " " * 1300)
1300
>>> os.write(fd, " " * 1300)
980
>>> os.write(fd, " " * 1300)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OSError: [Errno 28] No space left on device
Note that incomplete write that only wrote 980 bytes, before the
exception.
To workaround this, we simply iterate until all data is
written. Unittests could be written by using a parameter instead of
hardcoding os.write and checking for incomplete writes.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 27 Apr 2011 10:19:19 +0000 (12:19 +0200)]
Improve error messages in cluster verify/OS
A few issues in the clarity of the error messages are fixed:
- "ERROR: node node3: OS API version lenny-image": no preposition
between the parameter type and the OS name, changed to "for
lenny-image"
- "API version lenny-image differs from reference node node1: 10, 5
vs. 10, 20, 5, 15": parameters not sorted in display
- "OS variants list lenny-image differs from reference node node1:
vs. default, i386": empty sets are not clearly delimited, changed to
add [] around the sets: "node node1: [] vs. [default, i386]"
- "OS parameters lenny-image differs from reference node node1:
vs. (u'dhcp', u'Whether to enable (yes) or disable (dhcp)')": ugly
formatting in the OS parameters list, as we used to just "%s" the
tuple; now it is "reference node node1: [] vs. [dhcp: Whether to
enable (yes) or disable (dhcp)]"
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 27 Apr 2011 09:42:36 +0000 (11:42 +0200)]
Prevent readding of the master node
This breaks Ganeti in multiple ways. If we don't make the check in
gnt-node itself, then bootstrap.SetupNodeDaemon will restart the
master daemon, making the operation fail:
node1# gnt-node add --readd node1
Cannot communicate with the master daemon.
Is it running and listening for connections?
The check in cmdlib is more of a safety check, as we shouldn't reach
it. If we do (via a bad client), then it will prevent breakage in the
job queue/config handling.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 27 Apr 2011 09:23:33 +0000 (11:23 +0200)]
Fix punctuation in an error message
IIRC we don't use punctuation at the end of error messages.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Thu, 21 Apr 2011 10:58:53 +0000 (12:58 +0200)]
QA: Add tests for node group tags
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 21 Apr 2011 09:29:31 +0000 (11:29 +0200)]
RAPI: Add support for tagging node groups
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 21 Apr 2011 09:25:56 +0000 (11:25 +0200)]
gnt-group: Add commands for tagging groups
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 21 Apr 2011 09:24:53 +0000 (11:24 +0200)]
masterd: Add support for tagging node groups
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 21 Apr 2011 11:59:46 +0000 (13:59 +0200)]
cli: Fix wrong argument kind for groups
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 21 Apr 2011 12:00:36 +0000 (14:00 +0200)]
Quote filename in gnt-instance.8
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
René Nussbaumer [Thu, 21 Apr 2011 09:46:32 +0000 (11:46 +0200)]
QA: Adding a config option to disable cluster epo
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Apollon Oikonomopoulos [Tue, 19 Apr 2011 16:23:14 +0000 (19:23 +0300)]
TLMigrateInstance: remove 10s sleeps
TLMigrateInstance._ExecMigration contains two 10-second sleeps between
individual migration steps.
Apart from prolonging the migration duration by 20s, the second sleep
causes FinalizeMigration to be called 10 seconds after the real
migration completion; since FinalizeMigration is used for configuring
KVM network interfaces of “incoming” instances, this incurs a
10-to-12-second-long network downtime for migrated instances.
This patch removes both calls.
Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Wed, 20 Apr 2011 12:33:02 +0000 (14:33 +0200)]
Fix typo in LUGroupAssignNodes
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Wed, 20 Apr 2011 11:15:23 +0000 (13:15 +0200)]
gnt-instance info: automatically request locking
Commit
dae661a4 added support for controlling the locking, but it
didn't modify the gnt-instance info code, which leads to this command
always showing:
Wed Apr 20 04:10:48 2011 - WARNING: Non-static data requested, locks
need to be acquired
We simply change gnt-instance to request locks whenever we don't use
the static mode.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Wed, 20 Apr 2011 09:29:09 +0000 (11:29 +0200)]
Document the dependency on OOB for gnt-node power
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Tue, 19 Apr 2011 16:35:13 +0000 (18:35 +0200)]
Fix master IP activation in failover with no-voting
Thanks to net.for.hub@gmail.com for reporting this. The logic in
masterd.CheckMasterd did an early return in case of no_voting, hence
skipping the master IP activation. We just change the ifs to not
return but simply continue through the function.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Tue, 19 Apr 2011 15:31:09 +0000 (17:31 +0200)]
disk wiping: fix bug in chunk size computation
The current wipe_chunk_size computation is doing min(int_value,
float_value). For small disks (below 10GiB), the actual formula will
result into the float value being chosen. This results into very
interesting behaviour:
Wiping disk 0, offset 102.4, chunk 102.4
Wiping disk 0, offset 204.8, chunk 102.4
…
Wiping disk 0, offset 921.6, chunk 102.4
Wiping disk 0, offset 1024.0, chunk 1.
13686837722e-13
Since these are passed to dd via %d, this will result into the call to
dd specifying offset 1024 and count 0, which will fail.
We just need to enforce conversion to int, in order to not get bitten
by floating point rounding errors.
The patch also reorders some logging messages in order to log the
chunk size.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Tue, 19 Apr 2011 13:08:10 +0000 (15:08 +0200)]
Update manpages and other documents with editor settings
No rewrapping is done in this patch, just updates to the settings.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Michael Hanselmann [Fri, 8 Apr 2011 11:27:13 +0000 (13:27 +0200)]
gnt-group list: Query filter support
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Tue, 19 Apr 2011 12:56:04 +0000 (14:56 +0200)]
gnt-node list: Query filter support
Update manpage, quote field names.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 8 Apr 2011 11:07:13 +0000 (13:07 +0200)]
gnt-instance list: Query filter support
Update manpage, quote field names.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Tue, 19 Apr 2011 11:38:58 +0000 (13:38 +0200)]
Fix bug in watcher
If “utils.RunParts” were to raise an exception, a log message was
written and the code continued to run. Due to the exception the
“results” variable would not be defined.
Also change the code to log a backtrace (getting an exception is rather
unlikely and having a backtrace is useful) and update one comment.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Michael Hanselmann [Thu, 7 Apr 2011 15:36:05 +0000 (17:36 +0200)]
cli: Add support for parsing query filters
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 7 Apr 2011 15:35:44 +0000 (17:35 +0200)]
cli: Add option to force names to be treated as filter
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 7 Apr 2011 15:33:42 +0000 (17:33 +0200)]
opcodes: Change parameter type definition for query filter
The old definition wouldn't accept integers.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 7 Apr 2011 15:33:08 +0000 (17:33 +0200)]
cli: Error reporting for query filter parsing
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 7 Apr 2011 15:31:34 +0000 (17:31 +0200)]
qlang: Add function to distinguish filters from names
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 1 Apr 2011 12:24:15 +0000 (14:24 +0200)]
Update ganeti.7 manpage for query filter language
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 15 Apr 2011 10:18:08 +0000 (12:18 +0200)]
qlang: Add parser for query filter language
With this parser, command line utilities will be able to provide filters
through query2 in a simplistic language. Example filters:
name == "node3.example.com"
master or (name == "node4.example.com")
be/memory == 128 and name =~ /^web/i
"inst1.example.com" in sinst_list
status != "up"
not master
Parts of the syntax came from Python, others from Perl. Documentation
will be added in follow-up patches.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Mon, 18 Apr 2011 09:55:24 +0000 (11:55 +0200)]
htools: make some error messages more explicit
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Fri, 15 Apr 2011 16:31:27 +0000 (18:31 +0200)]
Add instance query field for OS parameters
These were not available as a query field before. Update unittests
and description text for the other “..params” fields.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Thu, 14 Apr 2011 14:15:09 +0000 (16:15 +0200)]
QA: also run gnt-cluster repair-disk-sizes
So that we don't happen again to break this forever without realising
it.
The patch also replaces one ' with ".
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Wed, 13 Apr 2011 11:53:55 +0000 (13:53 +0200)]
Release locks before wiping disks during instance creation
Ganeti 2.3 introduced an optional feature to overwrite an instance's
disks on creation. Unfortunately the code kept all locks while doing the
wipe, slowing down the creation of multiple instances in parallel.
This patch changes the code to wipe the disks only after releasing the
locks.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Tue, 12 Apr 2011 14:38:11 +0000 (16:38 +0200)]
Fix shared_file_storage_dir on upgrades
If the cluster was upgraded from 2.4 or earlier, this key won't exist
(it's only set to a correct value on cluster init), so we need to
properly set it to a null string (disabled).
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Tue, 12 Apr 2011 14:09:55 +0000 (16:09 +0200)]
QA: run the redist-conf command
This was (AFAICS) completely missing from the QA suite.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Tue, 12 Apr 2011 14:04:43 +0000 (16:04 +0200)]
Prevent ssconf values from having non-string values
For whatever reason, my test cluster managed to acquire
shared_file_storage_dir with a None value, instead of empty
string. This is not flagged in masterd itself, but the node daemon
will fail in writing the value to disk, as it calls len() on the
received value.
Since this is a bad case, we should detect it as soon as possible (we
basically shouldn't be able to set it), but in the meantime we at
least prevent ssconf writes with such values.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Iustin Pop [Fri, 8 Apr 2011 10:29:08 +0000 (12:29 +0200)]
Add some tests for the auto_balance attribute
It tests node add/remove secondary, rather than cluster-level N+1
checks, but it's better than nothing.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>
Iustin Pop [Fri, 8 Apr 2011 08:40:16 +0000 (10:40 +0200)]
Node operations: take into account auto_balance
This patch changes the add to secondary/remove from secondary code to
not deduct/add the instance's memory if the instance is not
auto_balanced.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>
Iustin Pop [Thu, 7 Apr 2011 15:14:16 +0000 (17:14 +0200)]
Read/write auto_balance via Text
This also means _another_ change in the text format; we really should
move to json…
The unittests are also update for the new 9-column layout and
additionally a bit of improvement is done.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>
Iustin Pop [Thu, 7 Apr 2011 15:00:49 +0000 (17:00 +0200)]
Read auto_balance via Rapi
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>
Iustin Pop [Thu, 7 Apr 2011 14:49:38 +0000 (16:49 +0200)]
Read auto_balance via Luxi
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>
Iustin Pop [Thu, 7 Apr 2011 15:00:32 +0000 (17:00 +0200)]
Show the auto_balance flag in the instance listing
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>
Michael Hanselmann [Mon, 11 Apr 2011 14:36:49 +0000 (16:36 +0200)]
cli: Replace hardcoded strings with constants
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Mon, 11 Apr 2011 13:44:43 +0000 (15:44 +0200)]
utils.WriteFile: Close file before renaming
Issue 154 (http://code.google.com/p/ganeti/issues/detail?id=154)
reported an “Operation not supported” error when writing instance
exports to a mounted CIFS filesystem. Experimentation showed the error
to only occur when using rename(2) on an opened file. Various references
on the web confirmed this observation. Whether or not the problem occurs
can also depend on the CIFS server implementation. In issue 154 it was
Windows 2008 R2.
While not solving all cases, closing the file before renaming helps
alleviating the issue a bit. Unittests are updated.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 8 Apr 2011 11:58:48 +0000 (13:58 +0200)]
Fix distcheck
README is not copied to the build tree.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 8 Apr 2011 11:29:57 +0000 (13:29 +0200)]
Nicer formatting for group query error
Before this patc the message would look like “Some groups do not exist:
[u'foo', u'bar']”, now it's “Some groups do not exist: foo, bar”.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Fri, 8 Apr 2011 11:22:37 +0000 (13:22 +0200)]
gnt-instance.8: Fix wrongly formatted title
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Thu, 7 Apr 2011 14:23:44 +0000 (16:23 +0200)]
Add a new attribute to Instance.Instance
This will mirror Ganeti's be/auto_balance one, which we need to use to
properly match N+1 computations.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Iustin Pop [Fri, 8 Apr 2011 09:14:51 +0000 (11:14 +0200)]
Some more changes to Makefile.am for htools
I duplicate the BINARY= rule in the ghc invocation in order to be able
to silence the if, which was confusing.
Additionally, a new target for running just the htools unit-tests is
provided.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Fri, 8 Apr 2011 10:21:41 +0000 (12:21 +0200)]
Update version in README
Also add a check to Makefile's check-local target.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
René Nussbaumer [Thu, 7 Apr 2011 10:42:09 +0000 (12:42 +0200)]
htools: Make opcode naming consistent with Ganeti codebase
This patch just cleans up the htools codebase to make it more consistent
with the naming of the Ganeti codebase.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 7 Apr 2011 10:03:51 +0000 (12:03 +0200)]
Merge branch 'devel-2.4'
* devel-2.4:
LUInstanceQueryData: Don't acquire locks unless requested
Increase the lock timeouts before we block-acquire
daemon.py: move startup log message before prep_fn
Display the actual memory values in N+1 failures
ssh.VerifyNodeHostname: remove the quiet flag
Add error checking and merging for cluster params
RAPI: Document need for Content-type header in requests
Fix output for “gnt-job info”
watcher: Fix misleading usage output
Clarify --force-join parameter message
locking: Fix race condition in lock monitor
utils: Export NiceSortKey function
Revert "Only merge nodes that are known to not be offline"
cluster-merge: only operate on online nodes
Only merge nodes that are known to not be offline
Treat empty oob_program param as default
Fix bug in instance listing with orphan instances
Fix bug related to log opening failures
Bump version for 2.4.1 release
cfgupgrade: Fix critical bug overwriting RAPI users file
Conflicts:
NEWS: Trivial
lib/opcodes.py: Added parameter descriptions, used variable for
"use_locking"
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Michael Hanselmann [Thu, 7 Apr 2011 09:44:52 +0000 (11:44 +0200)]
Merge branch 'stable-2.4' into devel-2.4
* stable-2.4:
Add error checking and merging for cluster params
Clarify --force-join parameter message
Treat empty oob_program param as default
Fix bug in instance listing with orphan instances
Fix bug related to log opening failures
Bump version for 2.4.1 release
cfgupgrade: Fix critical bug overwriting RAPI users file
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Thu, 7 Apr 2011 08:19:35 +0000 (10:19 +0200)]
OpCodes.hs: make allow_failover optional
And default to False, like in the Python codebase.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Wed, 6 Apr 2011 17:00:27 +0000 (19:00 +0200)]
htools: add an utility function for JSON parsing
This allows extracting values from a JSON object that might miss, but
have a well-defined default value.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
Iustin Pop [Thu, 7 Apr 2011 07:45:43 +0000 (09:45 +0200)]
Two small Makefile fixes related to htools
First, fix hs-coverage on non-pristine tree, where the index.html file
already existed, and second, disallow compilation of htools binaries
if configure, for some reason, didn't enable them.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
René Nussbaumer [Wed, 6 Apr 2011 16:29:28 +0000 (18:29 +0200)]
htools: Use OpMigrateInstance with allow_failover option
Before hbal decided on the fly if an instance is migratable or not. As
we implemented failover fallback in commit
d5cafd31456 we can start to
use that.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Wed, 6 Apr 2011 16:32:31 +0000 (18:32 +0200)]
LUInstanceQueryData: Don't acquire locks unless requested
Until now LUInstanceQueryData always acquired locks for the instance(s)
and nodes involved. In combination with long-running operations this
prevented the use of “gnt-instance info”, even with the “--static”
option. With this patch, locks are only acquired when explicitely
requested in the opcode (like all query operations).
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
René Nussbaumer [Tue, 29 Mar 2011 09:12:25 +0000 (11:12 +0200)]
gnt-instance migrate: Adding --allow-failover option
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
René Nussbaumer [Mon, 28 Mar 2011 12:54:33 +0000 (14:54 +0200)]
TLMigrateInstance: Merge failover code, allow fallback
As the code for failover for checking is almost identical it's an easy
task to switch it over to the TLMigrateInstance. This allows us to
fallback to failover if migrate fails prereq check for some reason.
Please note that everything from LUInstanceFailover.Exec is taken over
unchanged to TLMigrateInstance._ExecFailover, only with adaption to
opcode fields and variable referencing, but not in logic. There still
needs to go some effort into merging the logic with the migration (for
example DRBD handling). But this should happen in a separate iteration.
Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Iustin Pop [Mon, 4 Apr 2011 13:59:39 +0000 (15:59 +0200)]
Increase the lock timeouts before we block-acquire
This has been observed to cause problems on real clusters via the
following mechanism:
- a long job (e.g. a replace-disks) is keeping an exclusive lock on an
instance
- the watcher starts and submits its query instances opcode which
wants shared locks for all instances
- after about an hour, the watcher job falls back to blocking acquire,
after having acquired all other locks
- any instance opcode that wants an exclusive lock for an instance
cannot start until the watcher has finished, even though there's no
actual operation on that instance
In order to alleviate this problem, we simply increase the max timeout
until lock acquires are sent back to either blocking acquire or
priority increase. The timeout is computed such that we wait ~10 hours
(instead of one) for this to happen, which should be within the
maximum lifetime of a reasonable opcode on a healthy cluster. The
timeout also means that priority increases will happen every half hour.
We also increase the max wait interval to 15 seconds, otherwise we'd
have too many retries with the increased interval.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Michael Hanselmann [Wed, 30 Mar 2011 15:54:21 +0000 (17:54 +0200)]
utils: Add function generating regex for DNS name globbing
The intent of this function is to be able to provide a globbing operator
or query filters. One should be able to say, for example, something to
the effect of “gnt-instance shutdown '*.site'”.
Also rename a variable in MatchNameComponent.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 31 Mar 2011 16:43:25 +0000 (18:43 +0200)]
Verify file consistency using centrally computed list
Until now “gnt-cluster verify” (LUClusterVerify) would compute its own
list of files to check for consistency. This list was not complete and
certain inconsistencies were missed.
With this patch the code is changed to use the list of files used by
LUClusterRedistConf. The new check needs to be on a whole-cluster level,
and no longer per node.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Michael Hanselmann [Thu, 31 Mar 2011 16:39:52 +0000 (18:39 +0200)]
cmdlib: Factorize computation of ancillary files
… and change the logic in _RedistributeAncillaryFiles. The virtually
same list of files will be used to verify the files' consistency.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>