ganeti-local
13 years agoAdd unittests for ht module
Michael Hanselmann [Tue, 4 Jan 2011 14:32:16 +0000 (15:32 +0100)]
Add unittests for ht module

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

13 years agoht.TInt: Exclude boolean values
Michael Hanselmann [Tue, 4 Jan 2011 14:40:40 +0000 (15:40 +0100)]
ht.TInt: Exclude boolean values

See inline comment.

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

13 years agoCleanup bootstrap.SetupNodeDaemon
Michael Hanselmann [Tue, 4 Jan 2011 12:45:04 +0000 (13:45 +0100)]
Cleanup bootstrap.SetupNodeDaemon

- Code formatting
- Use ShellQuote for one argument
- Remove variables no longer used after commit 9294514d

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

13 years agoMerge branch 'devel-2.3'
Michael Hanselmann [Fri, 31 Dec 2010 12:39:10 +0000 (13:39 +0100)]
Merge branch 'devel-2.3'

* devel-2.3:
  Fix typo in gnt-instance manpage
  jqueue: Fix cancelling while in waitlock in queue
  cli: Extend message for LUXI timeouts
  Fix timeout handling in LUXI client

Conflicts:
man/gnt-instance.sgml: Trivial merge in gnt-instance.rst

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

13 years agoFix build errors with ganeti-listrunner
Michael Hanselmann [Fri, 31 Dec 2010 12:08:16 +0000 (13:08 +0100)]
Fix build errors with ganeti-listrunner

- Remove non-ASCII character from manpage
- Reformat docstring for epydoc in script

These caused build breakage on some but not all distributions.

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

13 years agoFix typo in gnt-instance manpage
Michael Hanselmann [Fri, 31 Dec 2010 12:11:05 +0000 (13:11 +0100)]
Fix typo in gnt-instance manpage

s/os-name/os-type/. This was reported in issue 133.

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

13 years agocli: Change “<…>” in query output to “(…)”
Michael Hanselmann [Wed, 29 Dec 2010 16:42:28 +0000 (17:42 +0100)]
cli: Change “<…>” in query output to “(…)”

This should reduce the amount of damage in case of accidential copy &
paste.

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

13 years agoInitial import of listrunner
Michael Hanselmann [Wed, 29 Dec 2010 16:35:52 +0000 (17:35 +0100)]
Initial import of listrunner

This tool was used and worked on internally for quite a long time. We
decided to include it in Ganeti.

Known issues:
- Code doesn't match rest of Ganeti (e.g. using “print” all over the
  place, hardcoded calls to sys.exit deep in functions)
- Code duplication from Ganeti library (e.g. PingByTcp/netutils.TcpPing,
  GetHosts/utils.ReadFile)
- Using ssh-agent doesn't work with more than one worker (Paramiko keeps
  the socket open and the file descriptor is used from different
  workers)
  - No clear separation between parent and child process in code
- Uses getopt instead of optparse

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

13 years agojqueue: Fix cancelling while in waitlock in queue
Michael Hanselmann [Tue, 21 Dec 2010 18:10:32 +0000 (19:10 +0100)]
jqueue: Fix cancelling while in waitlock in queue

Since the recent change to leave jobs in the “waitlock” status (commit
5fd6b6947), cancelling a job while it's back in the queue would break.
This patch handles these cases and adds a unittest.

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

13 years agoLUInstanceRename: log result of name resolving
Iustin Pop [Fri, 24 Dec 2010 08:27:15 +0000 (09:27 +0100)]
LUInstanceRename: log result of name resolving

While the LU does return the final name, it's useful to log the actual
DNS resolving process (input and output) in order to help with the
diagnose of failures.

The patch also fixes the docstring of the Exec() function.

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

13 years agoFix QA for “list-fields” commands
Michael Hanselmann [Tue, 21 Dec 2010 16:39:42 +0000 (17:39 +0100)]
Fix QA for “list-fields” commands

The list of fields is not only sorted, but sorted in a nice way.

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

13 years agoRemove utils.FormatTimestampWithTZ
Michael Hanselmann [Tue, 21 Dec 2010 16:37:25 +0000 (17:37 +0100)]
Remove utils.FormatTimestampWithTZ

Long story short: time.strftime("%Z", time.localtime()) doesn't work,
even though it's documented to be equivalent to time.strftime("%Z").

$ TZ=America/Sao_Paulo python -c 'import time; print
time.strftime("%Z"), time.strftime("%Z", time.localtime())'
BRST LMT

References:
http://bugs.python.org/issue762963
https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/564607
http://stackoverflow.com/questions/4367896/issue-with-timezone-with-time-strftime

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

13 years agoEnsure temp files from RunCmd tests are removed
Michael Hanselmann [Tue, 21 Dec 2010 16:34:43 +0000 (17:34 +0100)]
Ensure temp files from RunCmd tests are removed

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

13 years agoAllow customisation of the disk index separator
Iustin Pop [Tue, 21 Dec 2010 13:18:39 +0000 (14:18 +0100)]
Allow customisation of the disk index separator

As per issue 124, some Xen versions (or packaging) don't deal nicely
with the colon being part of a disk name. Therefore we add a
configure-time option for customising this.

Note: setting the separator to interesting values like / is not
handled by the code. This being a configure-time option (e.g. to be
set by distribution packagers), we assume the person building the code
knows what they are doing.

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

13 years agoutils: Timezone fixes and tests
Michael Hanselmann [Fri, 17 Dec 2010 17:38:40 +0000 (18:38 +0100)]
utils: Timezone fixes and tests

- Update docstrings to explicitely mention Epoch
- Fix timezone bug in FormatTimestampWithTZ, where it would
  use GMT/UTC when it should use the local timezone
- Add unittests for time formatting functions

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

13 years agoquery: Add wrapper for creating response object
Michael Hanselmann [Thu, 16 Dec 2010 17:48:10 +0000 (18:48 +0100)]
query: Add wrapper for creating response object

It'll be used for querying locks.

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

13 years agoMove QueryFields to query module
Michael Hanselmann [Thu, 16 Dec 2010 16:38:19 +0000 (17:38 +0100)]
Move QueryFields to query module

Also replace “sorted” with “utils.NiceSort” now that it supports a key
function.

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

13 years agocli: Extend message for LUXI timeouts
Michael Hanselmann [Mon, 20 Dec 2010 21:23:13 +0000 (22:23 +0100)]
cli: Extend message for LUXI timeouts

Point out that jobs already submitted continue to run.

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

13 years agoFix timeout handling in LUXI client
Michael Hanselmann [Mon, 20 Dec 2010 19:20:18 +0000 (20:20 +0100)]
Fix timeout handling in LUXI client

If the socket can't be read in time, it raises “socket.timeout”, for
which there is special handling code. Unfortunately the exception block
was in the wrong order and “socket.error” caught it before.

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

13 years agoMerge branch 'devel-2.3'
Michael Hanselmann [Mon, 20 Dec 2010 14:34:11 +0000 (15:34 +0100)]
Merge branch 'devel-2.3'

* devel-2.3:
  Prepare 2.3.1 release
  Fix disk status verification in LUClusterVerify

Conflicts:
NEWS: Trivial

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

13 years agoMerge branch 'stable-2.3' into devel-2.3
Michael Hanselmann [Mon, 20 Dec 2010 14:18:36 +0000 (15:18 +0100)]
Merge branch 'stable-2.3' into devel-2.3

* stable-2.3:
  Prepare 2.3.1 release
  Fix disk status verification in LUClusterVerify

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

13 years agoAdd QA scripts to checked Python code
Michael Hanselmann [Mon, 20 Dec 2010 13:43:16 +0000 (14:43 +0100)]
Add QA scripts to checked Python code

pylint is not yet included as the code needs some work for that.

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

13 years agoganeti-qa: Wrap lines longer than 80 chars
Michael Hanselmann [Mon, 20 Dec 2010 13:38:53 +0000 (14:38 +0100)]
ganeti-qa: Wrap lines longer than 80 chars

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

13 years agoPrepare 2.3.1 release v2.3.1
Michael Hanselmann [Mon, 20 Dec 2010 13:15:19 +0000 (14:15 +0100)]
Prepare 2.3.1 release

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

13 years agoAdapt QA for change in behaviour
René Nussbaumer [Thu, 16 Dec 2010 14:09:15 +0000 (15:09 +0100)]
Adapt QA for change in behaviour

As we can't test this on master anymore (if we flag the node offline we
would change master role on master) we use the first non master node we
find in the configuration

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

13 years agognt-node modify: Adding --node-powered=yes|no
René Nussbaumer [Thu, 16 Dec 2010 14:19:06 +0000 (15:19 +0100)]
gnt-node modify: Adding --node-powered=yes|no

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

13 years agoLUSetNodeParams: Add support for powered state
René Nussbaumer [Thu, 16 Dec 2010 14:16:30 +0000 (15:16 +0100)]
LUSetNodeParams: Add support for powered state

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

13 years agoLUSetNodeParams/LUOobCommand respect offline/powered
René Nussbaumer [Thu, 16 Dec 2010 13:55:59 +0000 (14:55 +0100)]
LUSetNodeParams/LUOobCommand respect offline/powered

This patch makes sure we cross verify the state the node is
in with our view:

power off -> Node has to be set offline
modify -O no -> Node has to be powered

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

13 years agognt-node power: Mark also offline when powering off
René Nussbaumer [Thu, 16 Dec 2010 13:55:11 +0000 (14:55 +0100)]
gnt-node power: Mark also offline when powering off

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

13 years agoMerge branch 'devel-2.3'
Michael Hanselmann [Fri, 17 Dec 2010 16:08:41 +0000 (17:08 +0100)]
Merge branch 'devel-2.3'

* devel-2.3:
  QA: Run cluster-verify as part of all instance tests
  QA: Fix typo and add “not”
  ensure-dirs: Speed up when using big queues
  Fix gnt-cluster verify with diskless instances

Conflicts:
lib/cmdlib.py: Trivial
qa/ganeti-qa.py: Trivial

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

13 years agoutils.NiceSort: Use sorted(), add keyfunc, unittests
Michael Hanselmann [Fri, 17 Dec 2010 14:05:57 +0000 (15:05 +0100)]
utils.NiceSort: Use sorted(), add keyfunc, unittests

This patch changes utils.NiceSort to use the built-in “sorted()” and
gets rid of the intermediate list. Instead of wrapping the items
ourselves, a key function is used. The caller can specify another key
function (useful to sort objects by their name, e.g.
“utils.NiceSort(instances, key=operator.attrgetter("name"))”.

Unittests are provided.

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

13 years agoQA: Run cluster-verify as part of all instance tests
Michael Hanselmann [Thu, 16 Dec 2010 14:19:52 +0000 (15:19 +0100)]
QA: Run cluster-verify as part of all instance tests

“gnt-cluster verify” looks at some per-instance information as well, so
it should be run for each instance type QA tests.

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

13 years agoQA: Fix typo and add “not”
Michael Hanselmann [Wed, 15 Dec 2010 19:03:18 +0000 (20:03 +0100)]
QA: Fix typo and add “not”

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

13 years agoShutdownInstanceDisks: accept offline secondaries
Iustin Pop [Fri, 17 Dec 2010 14:20:57 +0000 (15:20 +0100)]
ShutdownInstanceDisks: accept offline secondaries

For secondary node that is offline, we should not consider that the
disk shutdown has failed, as it can never succeed under this cluster
state and (by virtue of the fact that the secondary node is offline)
the disks are already "shutdown".

The patch also fixes a tiny typo.

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

13 years agoRpcResult: simplify some asserts
Iustin Pop [Fri, 17 Dec 2010 12:20:10 +0000 (13:20 +0100)]
RpcResult: simplify some asserts

data ≫ code, eom.

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

13 years agoensure-dirs: Speed up when using big queues
Michael Hanselmann [Wed, 15 Dec 2010 17:53:34 +0000 (18:53 +0100)]
ensure-dirs: Speed up when using big queues

The “ensure-dirs” script as included in Ganeti 2.3 is very slow when
working with big queues requiring a change of permissions on many or all
files.

$ find /var/lib/ganeti/queue/ | wc -l
52354

Before this change:
$ time /usr/local/lib/ganeti/ensure-dirs -f
real    16m4.739s

While not adressed in this patch, I'd like to record the overall
ineffiency of the “ensure-dirs” script, even after this change:

$ time /usr/local/lib/ganeti/ensure-dirs -f
real    5m57.362s
[…]
$ strace -e clone,execve -f -c /usr/local/lib/ganeti/ensure-dirs -f
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 50.08    5.147090          49    104774           clone
 49.92    5.131094          49    104739           execve

More changes will be needed. Just for comparision, a small Python
snippet changing permissions on all files (“ensure-dirs” changes the
owner too):

$ time python -c 'import os; from ganeti import utils;
[os.chmod(i, 0644) for i in
utils.ListVisibleFiles("/var/lib/ganeti/queue/archive/big")]'
real    0m0.605s
[…]

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

13 years agoLUAddNode: default ndparams to empty dict when not provided
René Nussbaumer [Thu, 16 Dec 2010 12:37:44 +0000 (13:37 +0100)]
LUAddNode: default ndparams to empty dict when not provided

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

13 years agoQA: Add some basic OOB tests
René Nussbaumer [Tue, 14 Dec 2010 16:15:18 +0000 (17:15 +0100)]
QA: Add some basic OOB tests

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

13 years agoQA: Allow upload of string data
René Nussbaumer [Tue, 14 Dec 2010 16:14:55 +0000 (17:14 +0100)]
QA: Allow upload of string data

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

13 years agoFix gnt-cluster verify with diskless instances
Adeodato Simo [Wed, 15 Dec 2010 17:40:30 +0000 (17:40 +0000)]
Fix gnt-cluster verify with diskless instances

`gnt-cluster verify` was failing with KeyError if there was any
diskless instance in the cluster. This was because _CollectDiskInfo()
was not including these instances in the returned dictionary, but they
were expected to be present in LUVerifyCluster.Exec().

With this commit, we ensure that the dictionary returned by _CollectDiskInfo
includes entries for diskless instances as well.

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoFix N+1 error message
Miguel Di Ciurcio Filho [Tue, 14 Dec 2010 13:18:29 +0000 (11:18 -0200)]
Fix N+1 error message

The error contained a typo and is slightly cumbersome. It changes from:

- ERROR: node a: not enough memory on to accommodate failovers should peer node
  b fail

to:

- ERROR: node a: not enough memory to accomodate instance failovers should node
  b fail

Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoRename (Op|LU)OutOfBand to (Op|LU)OobCommand
René Nussbaumer [Wed, 15 Dec 2010 15:18:44 +0000 (16:18 +0100)]
Rename (Op|LU)OutOfBand to (Op|LU)OobCommand

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

13 years agoMerge branch 'devel-2.3'
Michael Hanselmann [Wed, 15 Dec 2010 13:45:31 +0000 (14:45 +0100)]
Merge branch 'devel-2.3'

* devel-2.3:
  jqueue: Keep jobs in “waitlock” while returning to queue
  Improve jqueue unittests
  Update manpages to display version 2.3

Conflicts:
man/ganeti-cleaner.sgml: Removed
man/ganeti-confd.sgml: Removed
man/ganeti-masterd.sgml: Removed
man/ganeti-noded.sgml: Removed
man/ganeti-os-interface.sgml: Removed
man/ganeti-rapi.sgml: Removed
man/ganeti-watcher.sgml: Removed
man/ganeti.sgml: Removed
man/gnt-backup.sgml: Removed
man/gnt-cluster.sgml: Removed
man/gnt-debug.sgml: Removed
man/gnt-instance.sgml: Removed
man/gnt-job.sgml: Removed
man/gnt-node.sgml: Removed
man/gnt-os.sgml: Removed

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

13 years agojqueue: Keep jobs in “waitlock” while returning to queue
Michael Hanselmann [Tue, 14 Dec 2010 16:56:39 +0000 (17:56 +0100)]
jqueue: Keep jobs in “waitlock” while returning to queue

Iustin Pop reported that a job's file is updated many times while it
waits for locks held by other thread(s). After an investigation it was
concluded that the reason was a design decision for job priorities to
return jobs to the “queued” status if they couldn't acquire all locks.
Changing a jobs' status or priority requires an update to permanent
storage.

In a high-level view this is what happens:
1. Mark as waitlock
2. Write to disk as permanent storage (jobs left in this state by a
   crashing master daemon are resumed on restart)
3. Wait for lock (assume lock is held by another thread)
4. Mark as queued
5. Write to disk again
6. Return to workerpool

Another option originally discussed was to leave the job in the
“waitlock” status. Ignoring priority changes, this is what would happen:
1. If not in waitlock
1.1. Assert state == queued
1.2. Mark as waitlock
1.3. Set start_timestamp
1.4. Write to disk as permanent storage
3. Wait for locks (assume lock is held by another thread)
4. Leave in waitlock
5. Return to workerpool

Now let's assume the lock is released by the other thread:
[…]
3. Wait for locks and get them
4. Assert state == waitlock
5. Set state to running
6. Set exec_timestamp
7. Write to disk

As this change reduces the number of writes from two per lock acquire
attempt to two per opcode and one per priority increase (as happens
after 24 acquire attempts (see mcpu._CalculateLockAttemptTimeouts) until
the highest priority is reached), here's the patch to implement it.
Unittests are updated.

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

13 years agoImprove jqueue unittests
Michael Hanselmann [Mon, 13 Dec 2010 17:32:27 +0000 (18:32 +0100)]
Improve jqueue unittests

- Verify job file updates
- Ensure queue lock is released while executing opcode

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

13 years agoAdding gnt-node power * commands
René Nussbaumer [Wed, 15 Dec 2010 10:15:03 +0000 (11:15 +0100)]
Adding gnt-node power * commands

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

13 years agoDo the expanding of the node name in ExpandNames
René Nussbaumer [Wed, 15 Dec 2010 10:13:40 +0000 (11:13 +0100)]
Do the expanding of the node name in ExpandNames

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

13 years agoclient.gnt_node: Remove unnecessary lambda
Michael Hanselmann [Tue, 14 Dec 2010 15:07:28 +0000 (16:07 +0100)]
client.gnt_node: Remove unnecessary lambda

Pylint complained that the “lambda may not be necessary”. Turns out it
was right.

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

13 years agoQA: Extend unittests for query operations, add tests for list-fields
Michael Hanselmann [Fri, 10 Dec 2010 15:45:20 +0000 (16:45 +0100)]
QA: Extend unittests for query operations, add tests for list-fields

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

13 years agoUpdate NEWS for new query infrastructure
Michael Hanselmann [Wed, 8 Dec 2010 18:55:08 +0000 (19:55 +0100)]
Update NEWS for new query infrastructure

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

13 years agoConvert “gnt-instance list” to query2
Michael Hanselmann [Wed, 8 Dec 2010 19:41:43 +0000 (20:41 +0100)]
Convert “gnt-instance list” to query2

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

13 years agoConvert “gnt-node list” to query2
Michael Hanselmann [Wed, 8 Dec 2010 17:54:50 +0000 (18:54 +0100)]
Convert “gnt-node list” to query2

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

13 years agocli: Add infrastructure for query2
Michael Hanselmann [Wed, 8 Dec 2010 17:55:50 +0000 (18:55 +0100)]
cli: Add infrastructure for query2

A new function for formatting the query results is added,
``FormatTable``. This was determined to be easier and safer than
modifying the existing ``GenerateTable`` function while keeping
backwards compatibility for code not yet converted. The new code makes
use of the enhanced information provided by query2.

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

13 years agoUpdate manpages to display version 2.3
Miguel Di Ciurcio Filho [Mon, 13 Dec 2010 19:07:34 +0000 (17:07 -0200)]
Update manpages to display version 2.3

Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoiallocator: Export node group allocation policy
Balazs Lecz [Mon, 13 Dec 2010 19:30:03 +0000 (19:30 +0000)]
iallocator: Export node group allocation policy

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

13 years agoAdding --node-powered command line flag
René Nussbaumer [Mon, 13 Dec 2010 14:13:53 +0000 (15:13 +0100)]
Adding --node-powered command line flag

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

13 years agoSet powered to True for added nodes
René Nussbaumer [Mon, 13 Dec 2010 14:55:11 +0000 (15:55 +0100)]
Set powered to True for added nodes

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

13 years agoSet recorded powered state for OOB calls
René Nussbaumer [Mon, 13 Dec 2010 14:07:39 +0000 (15:07 +0100)]
Set recorded powered state for OOB calls

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

13 years agoAdd new Node attribute powered
René Nussbaumer [Mon, 13 Dec 2010 13:52:46 +0000 (14:52 +0100)]
Add new Node attribute powered

This is just a state of record field and does not necessary
reflect the reality.

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

13 years agoAdd ganeti-kvm-poweroff.initd to .gitignore
Adeodato Simo [Mon, 13 Dec 2010 19:16:20 +0000 (19:16 +0000)]
Add ganeti-kvm-poweroff.initd to .gitignore

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoMore QA tests for group operations
Adeodato Simo [Thu, 9 Dec 2010 16:15:58 +0000 (16:15 +0000)]
More QA tests for group operations

This adds QA tests for the SetGroupParams operation, both for CLI and
RAPI. Additionally, it adds tests for add/rename/remove groups via RAPI,
which had not been included in a previous patch series. Finally, it also
tests setting "alloc_policy" (and, for the CLI, "ndparams") at group
creation time.

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoAdd some unit tests for ConfigWriter.AddNodeGroup()
Adeodato Simo [Thu, 9 Dec 2010 16:45:55 +0000 (16:45 +0000)]
Add some unit tests for ConfigWriter.AddNodeGroup()

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoExpose OpSetGroupParams in RAPI and RAPI client
Adeodato Simo [Thu, 9 Dec 2010 15:43:54 +0000 (15:43 +0000)]
Expose OpSetGroupParams in RAPI and RAPI client

This creates the /2/groups/<name>/modify resource; at the moment, only the
"alloc_policy" attribute can be modified.

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoAdd the "alloc_policy" attribute to node groups
Adeodato Simo [Thu, 9 Dec 2010 15:16:23 +0000 (15:16 +0000)]
Add the "alloc_policy" attribute to node groups

This can be set at group creation time and via OpSetGroupParams. The default
is "preferred", and existing node groups from previous Ganeti version will
get the attribute set to this value.

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoAdd modification of node groups (OpCode/LU/CLI)
Adeodato Simo [Thu, 9 Dec 2010 12:55:17 +0000 (12:55 +0000)]
Add modification of node groups (OpCode/LU/CLI)

With this commit, only modification of the "ndparams" attribute is
supported.

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoIntroduce OpAddGroup.ndparams and expose in CLI
Adeodato Simo [Wed, 8 Dec 2010 19:49:24 +0000 (19:49 +0000)]
Introduce OpAddGroup.ndparams and expose in CLI

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoFix sorting bug in LUQueryGroups
Adeodato Simo [Thu, 9 Dec 2010 14:25:51 +0000 (14:25 +0000)]
Fix sorting bug in LUQueryGroups

In LUQueryGroups.Exec(), NiceSort was being applied to group UUIDs, and
not to group names. We use a temporary name to UUID map to sort the list
of UUIDs by group name instead.

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agocmdlib: Sort list of fields for QueryFields
Michael Hanselmann [Wed, 8 Dec 2010 19:20:41 +0000 (20:20 +0100)]
cmdlib: Sort list of fields for QueryFields

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

13 years agoobjects: Add custom de-/serializing code for query responses
Michael Hanselmann [Wed, 8 Dec 2010 17:54:14 +0000 (18:54 +0100)]
objects: Add custom de-/serializing code for query responses

… and use them in cmdlib.

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

13 years agoLUXI: Add Query and QueryFields functions
Michael Hanselmann [Mon, 6 Dec 2010 21:21:14 +0000 (22:21 +0100)]
LUXI: Add Query and QueryFields functions

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

13 years agoobjects: Add definitions for query requests and responses
Michael Hanselmann [Mon, 6 Dec 2010 21:17:49 +0000 (22:17 +0100)]
objects: Add definitions for query requests and responses

Also update description of QueryFieldDefinition.name.

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

13 years agoqlang: Add function to build simple filter
Michael Hanselmann [Wed, 8 Dec 2010 17:53:07 +0000 (18:53 +0100)]
qlang: Add function to build simple filter

This will be used in clients to build the filters for query2.

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

13 years agoquery: Handle items missing timestamps
Michael Hanselmann [Fri, 10 Dec 2010 17:25:04 +0000 (18:25 +0100)]
query: Handle items missing timestamps

In upgraded configurations, some items might miss the “ctime” and/or
“mtime” values and need to be handled specially.

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

13 years agoAdd gnt-cluster modify --master-netdev
Guido Trotter [Wed, 8 Dec 2010 15:24:46 +0000 (16:24 +0100)]
Add gnt-cluster modify --master-netdev

Although this might be a dangerous operation, it's still better to allow
it rather than requiring a hand-edit of the config file, should it be
necessary.

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

13 years agoRename “kind” to “what” for calls in query2 design
Michael Hanselmann [Mon, 6 Dec 2010 21:17:06 +0000 (22:17 +0100)]
Rename “kind” to “what” for calls in query2 design

“kind” is already used in the field definition. “what” seems to
be a better fit for the calls (“what should be queried?”).

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

13 years agoQA: Improve tests for instance/node list
Michael Hanselmann [Mon, 6 Dec 2010 18:54:16 +0000 (19:54 +0100)]
QA: Improve tests for instance/node list

- Query all known fields
- Random combinations (using a PRNG with a fixed seed) of fields
- Order of result names

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

13 years agocmdlib: Convert instance query to new infrastructure
Michael Hanselmann [Thu, 2 Dec 2010 21:49:28 +0000 (22:49 +0100)]
cmdlib: Convert instance query to new infrastructure

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

13 years agoquery: Add definition for instance queries
Michael Hanselmann [Tue, 30 Nov 2010 13:56:32 +0000 (14:56 +0100)]
query: Add definition for instance queries

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

13 years agoScript to gracefully power off KVM instances
Miguel Di Ciurcio Filho [Thu, 9 Dec 2010 16:00:20 +0000 (14:00 -0200)]
Script to gracefully power off KVM instances

When a node is running KVM instances and that node is rebooted or
shutdown, the gnt-noded daemon is finished and leaves the KVM instances
running. Latter on in the shutdown process, all remaining processes
receive SIGTERM as usual, meaning that the KVM instances are all
terminated, without running a proper shutdown procedure inside the
guests.

When using Xen, the xendomains script will take care of gracefully
powering down the instances, but for KVM there is nothing like that.

This patch adds an script that sends the "system_powerdown" command to
all running instances, and it could be useful for people using KVM.

This patch is a response for issue #126

Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoFix disk status verification in LUClusterVerify
Iustin Pop [Thu, 9 Dec 2010 13:03:18 +0000 (14:03 +0100)]
Fix disk status verification in LUClusterVerify

Commit b8d26c6 added disk status verification, but it has two
(different) bugs for not healthy nodes.

For offline nodes, we don't add at all the disk status to the
instance/node dict, with the result that the instance is not present in
the instdisk dict if all of its nodes are offline. This creates a
KeyError later when we call VerifyInstance with instdisk[instance].

For online nodes, but which don't return a valid disk status, we simply
set the status to None for each disk, but the code in _VerifyInstance
presumes and requires that each status is a valid tuple of length two.

For both these bugs, we redo the instdisk computations to always include
valid data, and we enhance the asserts to check for consistency.

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

13 years agoMerge branch 'devel-2.3'
Guido Trotter [Thu, 9 Dec 2010 15:14:31 +0000 (16:14 +0100)]
Merge branch 'devel-2.3'

* devel-2.3:
  Fix rename for file-backed instances

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

13 years agoMerge branch 'devel-2.2' into devel-2.3
Guido Trotter [Thu, 9 Dec 2010 15:13:00 +0000 (16:13 +0100)]
Merge branch 'devel-2.2' into devel-2.3

* devel-2.2:
  Fix rename for file-backed instances

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

13 years agoMerge branch 'stable-2.2' into devel-2.2
Guido Trotter [Thu, 9 Dec 2010 15:12:18 +0000 (16:12 +0100)]
Merge branch 'stable-2.2' into devel-2.2

* stable-2.2:
  Fix rename for file-backed instances

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

13 years agoMerge branch 'stable-2.2' into stable-2.3
Guido Trotter [Thu, 9 Dec 2010 15:10:54 +0000 (16:10 +0100)]
Merge branch 'stable-2.2' into stable-2.3

* stable-2.2:
  Fix rename for file-backed instances

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

13 years agoFix rename for file-backed instances
Guido Trotter [Wed, 8 Dec 2010 14:53:48 +0000 (15:53 +0100)]
Fix rename for file-backed instances

Currently the code wrongly changes the disk logical/physical id
component representing the path from "$storage_dir/$iname/disk$seq" to
"$storage_dir/$iname/disk/$seq" (note the additional slash) breaking the
rename.

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

13 years agoCheck payload of OOB execution
René Nussbaumer [Tue, 7 Dec 2010 15:22:29 +0000 (16:22 +0100)]
Check payload of OOB execution

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

13 years agoReplace GetOobProgram by GetNdParams
René Nussbaumer [Thu, 9 Dec 2010 13:07:37 +0000 (14:07 +0100)]
Replace GetOobProgram by GetNdParams

This was due to a older review which used GetOobProgram but then
changed to GetNdParams. Forgot to adjust this in the LU before.

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

13 years agoEnsure we just serialize JSON if there is data
René Nussbaumer [Tue, 7 Dec 2010 15:03:40 +0000 (16:03 +0100)]
Ensure we just serialize JSON if there is data

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

13 years agoAdding missing timeout parameter to rpc interface
René Nussbaumer [Thu, 9 Dec 2010 13:05:20 +0000 (14:05 +0100)]
Adding missing timeout parameter to rpc interface

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

13 years agoqa: test same-name instance rename
Guido Trotter [Thu, 9 Dec 2010 10:45:22 +0000 (11:45 +0100)]
qa: test same-name instance rename

Use the simplified command and rapi version to perform an instance
rename to the same name. This is performed anytime the rename test is
enabled, while the "other-name" rename is performed when also an
alternative name is provided.

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

13 years agoSimplify instance rename qa test
Guido Trotter [Thu, 9 Dec 2010 10:38:50 +0000 (11:38 +0100)]
Simplify instance rename qa test

The current instance rename qa testing function can only perform
back-and-forth renames, both for command line and rapi. In order to be
able to perform same-name rename tests we change it to be able to
perform simple renames, and then we change qa to call it to perform both
sides of the renaming.

The same change is applied both to the local and the rapi test.

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

13 years agoAllow rename of instance to same name
Guido Trotter [Wed, 8 Dec 2010 15:01:02 +0000 (16:01 +0100)]
Allow rename of instance to same name

This basically is a no-op in ganeti, but forces the execution of the
os-specific rename scripts.

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

13 years agoIntroduce constant for the name of the initial node group
Adeodato Simo [Wed, 8 Dec 2010 16:06:21 +0000 (16:06 +0000)]
Introduce constant for the name of the initial node group

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agodesign-2.3.rst: fix whitespace
Adeodato Simo [Wed, 8 Dec 2010 16:14:07 +0000 (16:14 +0000)]
design-2.3.rst: fix whitespace

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoconstants.py: fix tiny grammar issue in comment
Adeodato Simo [Wed, 8 Dec 2010 16:05:53 +0000 (16:05 +0000)]
constants.py: fix tiny grammar issue in comment

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoobjects.py: fix minor error in NodeGroup.SimpleFillND docstring
Adeodato Simo [Wed, 8 Dec 2010 19:27:06 +0000 (19:27 +0000)]
objects.py: fix minor error in NodeGroup.SimpleFillND docstring

The defaults are filled in from the node group defaults, not cluster
defaults (presumably copy & paste error).

Signed-off-by: Adeodato Simo <dato@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoNode query: maintain order as requested
Michael Hanselmann [Wed, 8 Dec 2010 18:22:24 +0000 (19:22 +0100)]
Node query: maintain order as requested

If the client requests certain names, their order should be maintained.
This is already done for instance queries. Moving this part into a
separate function allows sharing code.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>

13 years agoquery: Improve error checking
Michael Hanselmann [Wed, 1 Dec 2010 19:41:05 +0000 (20:41 +0100)]
query: Improve error checking

- Show only field definition, not callback when a result row is
  inconsistent
- Show list of duplicate titles if there are any (module load time)

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>

13 years agoconstants: Clarify comment for QRFS_NODATA
Michael Hanselmann [Tue, 30 Nov 2010 13:56:51 +0000 (14:56 +0100)]
constants: Clarify comment for QRFS_NODATA

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>

13 years agocmdlib: Fix prototype for _QueryBase.DeclareLocks
Michael Hanselmann [Thu, 2 Dec 2010 21:48:48 +0000 (22:48 +0100)]
cmdlib: Fix prototype for _QueryBase.DeclareLocks

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>