ganeti-local
13 years agoRename OpCreateInstance and LUCreateInstance
Iustin Pop [Sat, 15 Jan 2011 11:56:18 +0000 (12:56 +0100)]
Rename OpCreateInstance and LUCreateInstance

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

13 years agoRename OpConnectConsole and LUConnectConsole
Iustin Pop [Sat, 15 Jan 2011 11:56:18 +0000 (12:56 +0100)]
Rename OpConnectConsole and LUConnectConsole

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

13 years agoRename OpActivateInstanceDisks and LUActivateInstanceDisks
Iustin Pop [Sat, 15 Jan 2011 11:56:10 +0000 (12:56 +0100)]
Rename OpActivateInstanceDisks and LUActivateInstanceDisks

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

13 years agoRename OpSetGroupParams and LUSetGroupParams
Iustin Pop [Sat, 15 Jan 2011 11:56:10 +0000 (12:56 +0100)]
Rename OpSetGroupParams and LUSetGroupParams

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

13 years agoRename OpRenameGroup and LURenameGroup
Iustin Pop [Sat, 15 Jan 2011 11:56:10 +0000 (12:56 +0100)]
Rename OpRenameGroup and LURenameGroup

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

13 years agoRename OpRemoveGroup and LURemoveGroup
Iustin Pop [Sat, 15 Jan 2011 11:56:09 +0000 (12:56 +0100)]
Rename OpRemoveGroup and LURemoveGroup

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

13 years agoRename OpQueryGroups and LUQueryGroups
Iustin Pop [Sat, 15 Jan 2011 11:56:09 +0000 (12:56 +0100)]
Rename OpQueryGroups and LUQueryGroups

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

13 years agoRename OpAssignGroupNodes and LUAssignGroupNodes
Iustin Pop [Sat, 15 Jan 2011 11:56:06 +0000 (12:56 +0100)]
Rename OpAssignGroupNodes and LUAssignGroupNodes

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

13 years agoRename OpAddGroup and LUAddGroup
Iustin Pop [Sat, 15 Jan 2011 11:56:05 +0000 (12:56 +0100)]
Rename OpAddGroup and LUAddGroup

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

13 years agoRename OpVerifyDisks and LUVerifyDisks
Iustin Pop [Sat, 15 Jan 2011 11:56:05 +0000 (12:56 +0100)]
Rename OpVerifyDisks and LUVerifyDisks

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

13 years agoRename OpVerifyCluster and LUVerifyCluster
Iustin Pop [Sat, 15 Jan 2011 11:56:01 +0000 (12:56 +0100)]
Rename OpVerifyCluster and LUVerifyCluster

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

13 years agoRename OpSetClusterParams and LUSetClusterParams
Iustin Pop [Sat, 15 Jan 2011 11:56:01 +0000 (12:56 +0100)]
Rename OpSetClusterParams and LUSetClusterParams

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

13 years agoRename OpRepairDiskSizes and LURepairDiskSizes
Iustin Pop [Sat, 15 Jan 2011 11:56:00 +0000 (12:56 +0100)]
Rename OpRepairDiskSizes and LURepairDiskSizes

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

13 years agoRename OpRenameCluster and LURenameCluster
Iustin Pop [Sat, 15 Jan 2011 11:55:56 +0000 (12:55 +0100)]
Rename OpRenameCluster and LURenameCluster

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

13 years agoRename OpRedistributeConfig and LURedistributeConfig
Iustin Pop [Sat, 15 Jan 2011 11:55:56 +0000 (12:55 +0100)]
Rename OpRedistributeConfig and LURedistributeConfig

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

13 years agoRename OpQueryClusterInfo and LUQueryClusterInfo
Iustin Pop [Sat, 15 Jan 2011 11:55:52 +0000 (12:55 +0100)]
Rename OpQueryClusterInfo and LUQueryClusterInfo

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

13 years agoRename OpPostInitCluster and LUPostInitCluster
Iustin Pop [Sat, 15 Jan 2011 11:55:42 +0000 (12:55 +0100)]
Rename OpPostInitCluster and LUPostInitCluster

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

13 years agoRename OpDestroyCluster and LUDestroyCluster
Iustin Pop [Sat, 15 Jan 2011 11:55:42 +0000 (12:55 +0100)]
Rename OpDestroyCluster and LUDestroyCluster

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

13 years agoRename OpQueryConfigValues and LUQueryConfigValues
Iustin Pop [Sat, 15 Jan 2011 11:55:42 +0000 (12:55 +0100)]
Rename OpQueryConfigValues and LUQueryConfigValues

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

13 years agoRename OpRemoveExport and LURemoveExport
Iustin Pop [Sat, 15 Jan 2011 11:55:37 +0000 (12:55 +0100)]
Rename OpRemoveExport and LURemoveExport

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

13 years agoRename OpQueryExports and LUQueryExports
Iustin Pop [Sat, 15 Jan 2011 11:55:37 +0000 (12:55 +0100)]
Rename OpQueryExports and LUQueryExports

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

13 years agoRename OpPrepareExport and LUPrepareExport
Iustin Pop [Sat, 15 Jan 2011 11:55:30 +0000 (12:55 +0100)]
Rename OpPrepareExport and LUPrepareExport

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

13 years agoRename OpExportInstance and LUExportInstance
Iustin Pop [Sat, 15 Jan 2011 11:55:30 +0000 (12:55 +0100)]
Rename OpExportInstance and LUExportInstance

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

13 years agoFix the OP_ID of OpAssignGroupNodes
Iustin Pop [Sat, 15 Jan 2011 10:34:32 +0000 (11:34 +0100)]
Fix the OP_ID of OpAssignGroupNodes

Commit 96276ae added the above opcode, but forgot to update the OP_ID
per our previous mailing list discussions. This patch makes the OP_ID
be consistent with the other IDs (OP_$object_$action).

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

13 years agoFix bug introduced by f5677ab
Iustin Pop [Sat, 15 Jan 2011 13:11:56 +0000 (14:11 +0100)]
Fix bug introduced by f5677ab

Commit f5677ab added the _VerifyOob functionality, but there are two
issues with this function:

- a real bug, as objects.Node doesn't have a 'master' attribute
- a design bug, as we need to verify the OOB programs not only on
  current masters, but on all nodes that can become masters via the
  auto-promote functionality; otherwise, an automated cluster operation
  could cause the cluster to become inconsistent (error in verify)

The Node.master bug didn't appear in QA because it is triggered only
with non-master-candidate nodes, and our QA doesn't test this
combination (and neither other node flags combination).

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

13 years agoMerge branch 'devel-2.3' into devel-2.4
Guido Trotter [Fri, 14 Jan 2011 16:15:32 +0000 (16:15 +0000)]
Merge branch 'devel-2.3' into devel-2.4

* devel-2.3:
  Allow burnin with hidden OSes

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

13 years agoAllow burnin with hidden OSes
Guido Trotter [Fri, 14 Jan 2011 13:56:41 +0000 (13:56 +0000)]
Allow burnin with hidden OSes

burnin is a cluster/testing feature, so it makes sense that a hidden OS
can be used for it.

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

13 years agoBump version for Ganeti 2.4.0~beta1 v2.4.0beta1
Michael Hanselmann [Fri, 14 Jan 2011 11:11:45 +0000 (12:11 +0100)]
Bump version for Ganeti 2.4.0~beta1

Update the version in all necessary places. Update NEWS with release
date.

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

13 years agoUpdate NEWS for Ganeti 2.4
Michael Hanselmann [Fri, 14 Jan 2011 09:58:04 +0000 (10:58 +0100)]
Update NEWS for Ganeti 2.4

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

13 years agoUpdate RPC protocol version for Ganeti 2.4
Michael Hanselmann [Fri, 14 Jan 2011 10:51:04 +0000 (11:51 +0100)]
Update RPC protocol version for Ganeti 2.4

As it's quite easy to forget updating the protocol version (and was
actually forgotten for Ganeti 2.3), it is now derived from the
configuration version (which is equivalent with the Ganeti version). The
protocol version for Ganeti 2.4 will be 2040000.

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

13 years agoSet +x on tools/ganeti-listrunner
Michael Hanselmann [Fri, 14 Jan 2011 09:30:24 +0000 (10:30 +0100)]
Set +x on tools/ganeti-listrunner

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

13 years agoMerge branch 'devel-2.3'
René Nussbaumer [Fri, 14 Jan 2011 09:32:37 +0000 (10:32 +0100)]
Merge branch 'devel-2.3'

Conflicts:
doc/design-2.3.rst
  This was a minor conflict with some rewording of a phrase

lib/client/gnt_instance.py
  Removed _FormatParameterDict function as it was moved to cli.py in
  master branch

Reviewed-by: Michael Hanselmann <hansmi@google.com>

13 years agoquery: Update docstrings
Michael Hanselmann [Wed, 12 Jan 2011 11:54:12 +0000 (12:54 +0100)]
query: Update docstrings

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

13 years agoFix growing of DRBD disks
Iustin Pop [Thu, 13 Jan 2011 15:51:57 +0000 (16:51 +0100)]
Fix growing of DRBD disks

Patch 03941a26 made disk growth VG-aware, but the code has a bug: it
only works for LD_LV disks, and not LD_DRBD. To fix it, we add a
generic function to compute the per-VG growth requirements, and switch
to using that instead of manual build.

Furthermore, since the function _CheckNodesFreeDiskPerVG always takes
its input from this new function or _ComputeDiskSizePerVG, we change
the latter to always return a dict (possibly empty), instead of either
a dict or None. This makes the types more consistent.

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

13 years agoList node parameters in gnt-group list
René Nussbaumer [Wed, 12 Jan 2011 09:50:17 +0000 (10:50 +0100)]
List node parameters in gnt-group list

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

13 years agoList node parameters (if any) in gnt-node info
René Nussbaumer [Wed, 12 Jan 2011 09:28:13 +0000 (10:28 +0100)]
List node parameters (if any) in gnt-node info

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

13 years agoList node parameters in gnt-cluster info output
René Nussbaumer [Wed, 12 Jan 2011 09:16:02 +0000 (10:16 +0100)]
List node parameters in gnt-cluster info output

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

13 years agoFix typos in RAPI docstrings, add unittest
Michael Hanselmann [Wed, 12 Jan 2011 12:54:02 +0000 (13:54 +0100)]
Fix typos in RAPI docstrings, add unittest

This patch fixes a number of typos and standardizes RAPI resource
docstrings. A unittest is added.

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

13 years agoMove FormatParameterDict from gnt_instance.py to cli.py
René Nussbaumer [Wed, 12 Jan 2011 12:57:58 +0000 (13:57 +0100)]
Move FormatParameterDict from gnt_instance.py to cli.py

This function is useful for other cli-tools who need to display
a dict based parameter field.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>

13 years agognt-group modify: ndparams not correctly updated
René Nussbaumer [Wed, 12 Jan 2011 14:49:27 +0000 (15:49 +0100)]
gnt-group modify: ndparams not correctly updated

ndparams should delete keys which are reset to default

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

13 years agoAdd Ganeti 2.4 design document
Michael Hanselmann [Wed, 12 Jan 2011 11:08:59 +0000 (12:08 +0100)]
Add Ganeti 2.4 design document

It contains links to the two implemented designs. The detailed documents
are removed from the visible table of contents to not show up on their
own.

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

13 years agolast_resort groups prioritized by iallocator plugin
Stephen Shirley [Wed, 12 Jan 2011 10:46:09 +0000 (11:46 +0100)]
last_resort groups prioritized by iallocator plugin

Also change language slightly for preferred groups to look better now
that it's repeated.

Signed-off-by: Stephen Shirley <diamond@google.com>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoRemove --master-netdev default value
Guido Trotter [Wed, 12 Jan 2011 11:33:39 +0000 (11:33 +0000)]
Remove --master-netdev default value

Since the --master-netdev option is now used both at cluster init and at
cluster modify time, it cannot have a default value of DEFAULT_BRIDGE
(xen-br0) anymore. As such at cluster init we make the initialization
explicit if another value hasn't been passed. This fixes gnt-cluster
modify changing the master_netdev to xen-br0 if called without that
argument.

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

13 years agoRun pylint over QA code too
Iustin Pop [Wed, 12 Jan 2011 08:59:29 +0000 (09:59 +0100)]
Run pylint over QA code too

Right now, the QA code is not covered by pylint, and this shows at
least one low-impact bug.

This patch does the necessary changes to make QA pylint-clean, and the
changes the makefile to run pylint for it.

Notable changes:

- qa_utils.GenericQueryTest: randfields was not used at all, and my
  belief is that it was indented to be used in order not to modify the
  input list; so I replaced randfields with fields, so we only shuffle
  the our local copy
- qa_node.TestOutOfBand was using it's own copy of AcquireNode(), so I
  replaced it with the existing version
- qa_os: was using 'dir' in a couple of places, replaced with dirname

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

13 years agoQA: use a persistent SSH connection to the master
Iustin Pop [Tue, 11 Jan 2011 14:56:17 +0000 (15:56 +0100)]
QA: use a persistent SSH connection to the master

The recent additions to QA (many more tests) make QA slow if the
machine on which the QA runs is not very close to the tested nodes —
or in general, when the SSH handhaske is costly.

We discussed before about using a persistent connection, and here is
the patch that implements it. On a very small QA (very very small), it
cuts down a lot of time (almost half), so it should be useful even for
a full QA.

I've also thought about changing from external ssh to paramiko, but I
estimated that it would be more work to correctly interleave the IO
from the remote process than just running a background SSH.

Also note that yes, the global dict is ugly, but I don't know of
another simple way to implement this.

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

13 years agoQA: Fix duplicated OOB tests
Iustin Pop [Tue, 11 Jan 2011 17:50:15 +0000 (18:50 +0100)]
QA: Fix duplicated OOB tests

Patch f55312bd added the OOB tests to TestClusterVerify, which is not
actually a test for cluster verify, but a runner for cluster verify
that is called multiple times, for each instance type, etc. This led
to running the OOB commands multiple times, which is painful
especially as this is a slow test.

The patch moves this to a separate test, that is run only once.

Furthermore, the way that data files are copied around is very
inefficient: touch + mv + chmod + mv + rm for each node (5 times
number of nodes), whereas it could be simply: touch on master, chmod
on master, cluster copyfile, chmod on master, cluster copyfile,
cluster command rm, i.e. only 5 fixed ssh calls to the master. The
code is changed as such, for increased speed.

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

13 years agoAdd ability to retain specified fds open in RunCmd
Apollon Oikonomopoulos [Mon, 10 Jan 2011 16:05:26 +0000 (18:05 +0200)]
Add ability to retain specified fds open in RunCmd

Passing tap devices to KVM as file descriptors requires that the respective
file decriptors remain open during utils.RunCmd execution. To this direction,
we add a “noclose_fds” keyword argument to utils.RunCmd, accepting a list of
file descriptors to keep open. The actual fd handling is implemented in
_RunCmdPipe and _RunCmdFile using subprocess.Popen's “preexec_fn”[1],
since subprocess.Popen provides no other way to selectively handle fds.

A small modification is also made to test/ganeti.utils_unittest.py to comply
with _RunCmdPipe's new API and a new unit test is added to test the selective
fd retention functionality.

[1] “If preexec_fn is set to a callable object, this object will be called in
     the child process just before the child is executed. (Unix only)”
    Subprocess documentation

Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

13 years agoAdd tests for objects.Instance
Michael Hanselmann [Tue, 11 Jan 2011 15:30:21 +0000 (16:30 +0100)]
Add tests for objects.Instance

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

13 years agoobjects: Fix off-by-one in error message
Michael Hanselmann [Tue, 11 Jan 2011 15:29:51 +0000 (16:29 +0100)]
objects: Fix off-by-one in error message

For an instance with a single disk the message should be “… disks 0 to
0”, not “… 0 to 1”.

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

13 years agoutils: Cleanup and sort wildcard imports
Michael Hanselmann [Tue, 11 Jan 2011 14:49:26 +0000 (15:49 +0100)]
utils: Cleanup and sort wildcard imports

Also convert the per-line pylint instructions to one per-module
instruction.

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

13 years agoutils: Drop RemovePidFile
Michael Hanselmann [Tue, 11 Jan 2011 11:34:19 +0000 (12:34 +0100)]
utils: Drop RemovePidFile

It's equivalent to a simple RemoveFile now.

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

13 years agoutils: Move NewUUID to utils.io
Michael Hanselmann [Tue, 11 Jan 2011 11:39:28 +0000 (12:39 +0100)]
utils: Move NewUUID to utils.io

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

13 years agoutils: Move more text-related code
Michael Hanselmann [Tue, 11 Jan 2011 11:39:01 +0000 (12:39 +0100)]
utils: Move more text-related code

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

13 years agoutils: Move process-related code into separate file
Michael Hanselmann [Tue, 11 Jan 2011 12:10:54 +0000 (13:10 +0100)]
utils: Move process-related code into separate file

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

13 years agoutils: Move ResetTempfileModule to wrappers module
Michael Hanselmann [Tue, 11 Jan 2011 11:12:46 +0000 (12:12 +0100)]
utils: Move ResetTempfileModule to wrappers module

It's not exactly a wrapper, but this seemed like the best place.

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

13 years agoutils: Move RunningTimeout to utils.algo
Michael Hanselmann [Tue, 11 Jan 2011 11:07:24 +0000 (12:07 +0100)]
utils: Move RunningTimeout to utils.algo

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

13 years agoutils: Move code manipulating /etc/hosts to separate file
Michael Hanselmann [Tue, 11 Jan 2011 15:01:48 +0000 (16:01 +0100)]
utils: Move code manipulating /etc/hosts to separate file

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

13 years agoFix utils.io unittest
Michael Hanselmann [Tue, 11 Jan 2011 14:45:18 +0000 (15:45 +0100)]
Fix utils.io unittest

“import signal” was missing, but of course it didn't show during my
testing.

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

13 years agoutils: Move X509-related code into separate file
Michael Hanselmann [Mon, 10 Jan 2011 17:36:04 +0000 (18:36 +0100)]
utils: Move X509-related code into separate file

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

13 years agoutils: Move I/O-related code into separate file
Michael Hanselmann [Mon, 10 Jan 2011 19:44:41 +0000 (20:44 +0100)]
utils: Move I/O-related code into separate file

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

13 years agoutils: Move code related to file locking into separate file
Michael Hanselmann [Mon, 10 Jan 2011 16:58:52 +0000 (17:58 +0100)]
utils: Move code related to file locking into separate file

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

13 years agoutils: Move wrappers into separate file
Michael Hanselmann [Mon, 10 Jan 2011 16:51:46 +0000 (17:51 +0100)]
utils: Move wrappers into separate file

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

13 years agoutils: Use function to disable fork
Michael Hanselmann [Mon, 10 Jan 2011 18:59:45 +0000 (19:59 +0100)]
utils: Use function to disable fork

Use a function instead of a variable written by another module.

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

13 years agoutils: Change RemovePidFile to take path, not name
Michael Hanselmann [Mon, 10 Jan 2011 19:40:43 +0000 (20:40 +0100)]
utils: Change RemovePidFile to take path, not name

This avoids having to monkey-patch the utils module for unittests.
Monkey patching is evil and caused a bug while moving code around.

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

13 years agoFix a typo in backend.py
René Nussbaumer [Tue, 11 Jan 2011 13:03:28 +0000 (14:03 +0100)]
Fix a typo in backend.py

Sorry I thought I did run commit-check but must not have paid attention
to its output. There was a typo in the docstring. This patch fixes this.

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

13 years agoPause/Resume sync accordingly before wiping disk
René Nussbaumer [Fri, 7 Jan 2011 13:24:04 +0000 (14:24 +0100)]
Pause/Resume sync accordingly before wiping disk

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

13 years agoAdd RPC calls for pause/resume sync of devices
René Nussbaumer [Fri, 7 Jan 2011 13:18:12 +0000 (14:18 +0100)]
Add RPC calls for pause/resume sync of devices

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

13 years agoAdd backend method for pause/resume sync of devices
René Nussbaumer [Fri, 7 Jan 2011 13:11:37 +0000 (14:11 +0100)]
Add backend method for pause/resume sync of devices

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

13 years agoMake it possible to pause/resume sync of mirrored dev
René Nussbaumer [Fri, 7 Jan 2011 13:10:48 +0000 (14:10 +0100)]
Make it possible to pause/resume sync of mirrored dev

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

13 years agoFix some doc issues introduced in recent commits
Iustin Pop [Tue, 11 Jan 2011 10:16:24 +0000 (11:16 +0100)]
Fix some doc issues introduced in recent commits

The hooks is due to me not checking the recent patch from David, and
the cli.py change is due to the utils.py split.

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

13 years agoMore fixes to hooks documentation
David Knowles [Mon, 10 Jan 2011 16:17:15 +0000 (11:17 -0500)]
More fixes to hooks documentation

Signed-off-by: David Knowles <dknowles@google.com>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

13 years agoFix docstring for "cmd" in qa_utils.GetSSHCommand
Adeodato Simo [Mon, 10 Jan 2011 15:05:30 +0000 (15:05 +0000)]
Fix docstring for "cmd" in qa_utils.GetSSHCommand

Docstring indicated "cmd" should be a list, when it's expected that
it'll be a string.

Also, converted docstring to current epydoc-style list of function
arguments.

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

13 years agoAdd QA tests for OpAssignGroupNodes
Adeodato Simo [Fri, 7 Jan 2011 21:56:39 +0000 (21:56 +0000)]
Add QA tests for OpAssignGroupNodes

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

13 years agoExpose OpAssignGroupNodes over RAPI and RAPI client
Adeodato Simo [Fri, 7 Jan 2011 21:10:25 +0000 (21:10 +0000)]
Expose OpAssignGroupNodes over RAPI and RAPI client

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

13 years agoCluster verify warns if there are split instances
Adeodato Simo [Thu, 16 Dec 2010 16:20:43 +0000 (16:20 +0000)]
Cluster verify warns if there are split instances

Emit a warning for each instance with a mirrored disk template that has
its primary and secondary nodes living in different node groups.

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

13 years agoAdd `gnt-group assign-nodes` in the CLI
Adeodato Simo [Fri, 7 Jan 2011 13:26:33 +0000 (13:26 +0000)]
Add `gnt-group assign-nodes` in the CLI

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

13 years agoAdd unit tests for CheckAssignmentForSplitInstances
Adeodato Simo [Fri, 7 Jan 2011 13:25:55 +0000 (13:25 +0000)]
Add unit tests for CheckAssignmentForSplitInstances

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

13 years agoAdd OpAssignGroupNodes and LUAssignGroupNodes
Adeodato Simo [Fri, 7 Jan 2011 13:24:27 +0000 (13:24 +0000)]
Add OpAssignGroupNodes and LUAssignGroupNodes

This operation allows to assign nodes to a group, verifying whether
the change would leave any mirrored instance split between different
node groups.

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

13 years agoValidate RAPI resource paths
Michael Hanselmann [Mon, 10 Jan 2011 16:11:00 +0000 (17:11 +0100)]
Validate RAPI resource paths

To stay consistent, RAPI resources should only use a restricted set of
characters. No uppercase, no “_”, etc. This is enforced by this patch.

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

13 years agoutils: Remove unused variables
Michael Hanselmann [Mon, 10 Jan 2011 15:14:48 +0000 (16:14 +0100)]
utils: Remove unused variables

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

13 years agoutils: Move hashing-related code into separate file
Michael Hanselmann [Mon, 10 Jan 2011 15:13:53 +0000 (16:13 +0100)]
utils: Move hashing-related code into separate file

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

13 years agoutils: Rename _CloseFDNoErr to CloseFdNoError
Michael Hanselmann [Mon, 10 Jan 2011 15:05:37 +0000 (16:05 +0100)]
utils: Rename _CloseFDNoErr to CloseFdNoError

This makes it a public function, which is necessary for
moving code into separate files.

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

13 years agoutils: Move logging-related code into separate file
Michael Hanselmann [Mon, 10 Jan 2011 15:02:05 +0000 (16:02 +0100)]
utils: Move logging-related code into separate file

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

13 years agoutils: Move Mlockall into separate file
Michael Hanselmann [Mon, 10 Jan 2011 14:56:34 +0000 (15:56 +0100)]
utils: Move Mlockall into separate file

The unittest file is renamed to match the other utils.* tests.

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

13 years agoutils: Move text-related functions into separate file
Michael Hanselmann [Mon, 10 Jan 2011 14:48:00 +0000 (15:48 +0100)]
utils: Move text-related functions into separate file

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

13 years agoutils: Split Retry & co. into separate file
Michael Hanselmann [Fri, 7 Jan 2011 17:08:03 +0000 (18:08 +0100)]
utils: Split Retry & co. into separate file

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

13 years agoutils: Split algorithms into separate file
Michael Hanselmann [Fri, 7 Jan 2011 17:06:32 +0000 (18:06 +0100)]
utils: Split algorithms into separate file

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

13 years agoutils: Move to separate module
Michael Hanselmann [Fri, 7 Jan 2011 16:15:42 +0000 (17:15 +0100)]
utils: Move to separate module

This is preparing for splitting the whole units module.

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

13 years agoAdd unit test for ganeti.rapi.client's ModifyGroup
Adeodato Simo [Fri, 7 Jan 2011 20:49:36 +0000 (20:49 +0000)]
Add unit test for ganeti.rapi.client's ModifyGroup

This was forgotten in f18fab7.

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

13 years agomcpu: Automatically build the DISPATCH_TABLE
Iustin Pop [Mon, 10 Jan 2011 11:11:09 +0000 (12:11 +0100)]
mcpu: Automatically build the DISPATCH_TABLE

While reviewing dato's interdiff for the OpAssignGroupNodes, I
realised that we can do better. This patch replaces the hand-built
DISPATCH_TABLE with one built from the opcode.OP_MAPPING dict.

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

13 years agoGeneralize the OpCode-should-be-in-mcpu test
Iustin Pop [Mon, 10 Jan 2011 10:51:35 +0000 (11:51 +0100)]
Generalize the OpCode-should-be-in-mcpu test

Currently, the unittest TestDispatchTable in mcpu unittest does a
hard-coded approach to test whether an opcode should be included or
not in the mcpu.Processor dispatch table. This is not flexible, so we
replace it with two changes:

- first, we do not return the base OpCode in opcodes.OP_MAPPING;
  rationale being that we shouldn't need to serialise or deserialise
  this opcode during normal operation
- second, we add a new attribute WITH_LU (other name suggestions
  welcome) to the base opcode set to True, and we explicitly set it to
  False in OpTestDummy, thus automatic skipping of such LUs in the
  unittest (and in other places)

To correct for the new behaviour, the tests in the opcode unittests
are updated to include OpCode explicitly.

Note: we also replace assert_ with assertTrue in the affected unittest
(as assert_ is deprecated in 2.7).

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

13 years agoDocument the intended use of (vm|master)_capable
Iustin Pop [Fri, 7 Jan 2011 14:27:55 +0000 (15:27 +0100)]
Document the intended use of (vm|master)_capable

This patch adds the intended usage scenarios of these two flags.

Additionally it corrects the tag valid charset.

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

13 years agoIAllocator: fix breakage for non-vm_capable nodes
Iustin Pop [Fri, 7 Jan 2011 11:24:48 +0000 (12:24 +0100)]
IAllocator: fix breakage for non-vm_capable nodes

Currently, the IAllocator doesn't know that non-vm_capable nodes
should not be queried for hypervisor/instance information.

This patch updates the node data computation to generate basic info,
but not the runtime data for such nodes. Furthermore, the
documentation is updated to note that such nodes will node have
runtime data.

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

13 years agoFix syntax error with Python 2.4
Michael Hanselmann [Fri, 7 Jan 2011 16:00:40 +0000 (17:00 +0100)]
Fix syntax error with Python 2.4

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

13 years agognt-instance info: Show disk template
Michael Hanselmann [Fri, 7 Jan 2011 15:39:34 +0000 (16:39 +0100)]
gnt-instance info: Show disk template

The data was already there, but not shown.

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

13 years agoUse new console information in hypervisor abstraction
Michael Hanselmann [Fri, 7 Jan 2011 15:34:19 +0000 (16:34 +0100)]
Use new console information in hypervisor abstraction

This makes use of the new way of returning console information from the
master daemon. Unittests are included.

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

13 years agoIntroduce verbose opcode result for console
Michael Hanselmann [Fri, 7 Jan 2011 11:31:02 +0000 (12:31 +0100)]
Introduce verbose opcode result for console

With this patch OpConnectConsole will no longer just return a command
with arguments, but rather a detailed description about how to connect
to an instance's console. Unittests for some parts are included. Another
patch will follow to adjust the hypervisor abstractions for the new
model.

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

13 years agoluxi.Client: Add function to close connection
Michael Hanselmann [Thu, 6 Jan 2011 18:16:21 +0000 (19:16 +0100)]
luxi.Client: Add function to close connection

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

13 years agoMerge branch 'devel-2.3'
Michael Hanselmann [Fri, 7 Jan 2011 10:12:05 +0000 (11:12 +0100)]
Merge branch 'devel-2.3'

* devel-2.3:
  Remove unused import from client.gnt_instance
  gnt-instance console: Improve error reporting
  Increase timeout for connection on remote import
  import-export: Improve timeout error reporting

Conflicts:
lib/cmdlib.py: Trivial
lib/opcodes.py: Trivial

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

13 years agoRemove unused import from client.gnt_instance
Michael Hanselmann [Thu, 6 Jan 2011 19:34:26 +0000 (20:34 +0100)]
Remove unused import from client.gnt_instance

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