ganeti-local
11 years agoPreserve device names during instance move
Christos Stavrakakis [Fri, 12 Apr 2013 09:40:25 +0000 (12:40 +0300)]
Preserve device names during instance move

Fix 'move-instance' tool to preserve the instance disk and NIC names
when moving instances from one cluster to another. Also, fix value error
since an instance NIC is an 8-tuple, containing also name and UUID.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoUpdate manpages wrt new device refering
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:17 +0000 (11:51 +0300)]
Update manpages wrt new device refering

This patch updates gnt-instance man page to include refering to devices
by their name and UUID.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoUpdate QA tests to check disk and NIC names
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:16 +0000 (11:51 +0300)]
Update QA tests to check disk and NIC names

Modify existing tests to use the name option for instance disks. The
configuration options 'disk' and 'disk-growth' are merged into a single
'disks' option, which is a list of dictionaries with 'size', 'growth' and
'name' items.

Also, add 'instance-device-names' QA test, which tests addition, renaming
and removal of named devices.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd name to INicParams and IDiskParams
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:15 +0000 (11:51 +0300)]
Add name to INicParams and IDiskParams

This commits adds name to NIC and Disk modification definition.

Signed-off-by: Chris Stavrakakis <cstavr@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd nic/disk name and UUID fields in Haskell code
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:14 +0000 (11:51 +0300)]
Add nic/disk name and UUID fields in Haskell code

Add name and uuid fields to Disk and nic Haskell objects. Also,
since they now have an UUID, make them instances of UuidObject.

Signed-off-by: Christor Stavrakakis <cstavr@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd Disks and NICs to _AllUUIDObjects
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:13 +0000 (11:51 +0300)]
Add Disks and NICs to _AllUUIDObjects

Since disks and NICs have UUIDs, they must be considered
to _AllUUIDObjects.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoDisplay UUIDs and names in gnt-instance info
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:12 +0000 (11:51 +0300)]
Display UUIDs and names in gnt-instance info

Modify gnt-instance client to display the UUID and name
fields of instances disks and NICs.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoSupport quering for devices names and UUIDs
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:11 +0000 (11:51 +0300)]
Support quering for devices names and UUIDs

Extend instance queries to list 'uuid' and 'name' fields of instance's
Disks and NICs.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoCheck that device names are unique and valid
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:10 +0000 (11:51 +0300)]
Check that device names are unique and valid

Extend the CheckArguments phase of LUInstanceCreate and CheckPrereq
phase of LUInstanceSetParams to also check if the name parameters of
disks and NICs are unique and valid.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoImplement renaming Disks and NICs
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:09 +0000 (11:51 +0300)]
Implement renaming Disks and NICs

Implement renaming Disks and NICs in LUInstanceSetParams. Remove code
that checked that changing disk mode was the only disk modification
supported. Also, handle case of 'None' value for 'name' parameter.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoSupport UUIDs and names when refering to a device
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:08 +0000 (11:51 +0300)]
Support UUIDs and names when refering to a device

Modify _ApplyContainerMods function to lookup NICs/Disks not only by their
index inside the container, but also by their UUID or name. Abstract the
lookup code in new GetItemFromContainer function.

Make type of identifier in "opcode._TestInstSetParamsModList" to be
TInt or TString.

Modify gnt-instance client to not check if identifier is an integer.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoSupport UUIDs and names when handling NICs/Disks
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:07 +0000 (11:51 +0300)]
Support UUIDs and names when handling NICs/Disks

Handle UUID and name fields when creating/managing NICs and Disks. Also,
export NICs and Disks names to instance hooks environment.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd IDISK_NAME and INIC_NAME constants
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:06 +0000 (11:51 +0300)]
Add IDISK_NAME and INIC_NAME constants

Declare IDISK_NAME and INIC_NAME constants and add them to the
IDISK_PARAMS_TYPE and INIC_PARAMS_TYPE.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd uuid and name slots to Disk/NIC ConfigObjects
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:05 +0000 (11:51 +0300)]
Add uuid and name slots to Disk/NIC ConfigObjects

This patch adds "uuid" and "name" slots to Disk and NIC ConfigObjects.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd design doc for device UUIDs and names
Christos Stavrakakis [Thu, 4 Apr 2013 08:51:04 +0000 (11:51 +0300)]
Add design doc for device UUIDs and names

This commit adds the design document for adding UUID and name slots to NIC and
Disk objects and the ability to refer to them by these slots.

Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoQA: Test enabled disk templates with known configuration
Bernardo Dal Seno [Sun, 14 Apr 2013 14:31:35 +0000 (16:31 +0200)]
QA: Test enabled disk templates with known configuration

The test failed because it was executed also in a configuration that wasn't
expected, i.e., with exclusive storage enabled.

Also the docstring is shortened, as it was being truncated in the QA output.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoQA: Decision about disk templates to use is more modular
Bernardo Dal Seno [Sun, 14 Apr 2013 14:25:45 +0000 (16:25 +0200)]
QA: Decision about disk templates to use is more modular

qa_config.IsTemplateSupported() is already used to decide which disk
templates are supported by QA. Enabled templates now are part of that
decision.

Unit tests are updated.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoFix typo in documentation string
Klaus Aehlig [Tue, 9 Apr 2013 14:58:31 +0000 (16:58 +0200)]
Fix typo in documentation string

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdapt test data to changed ipolicy format
Klaus Aehlig [Fri, 12 Apr 2013 07:57:49 +0000 (09:57 +0200)]
Adapt test data to changed ipolicy format

The test data for hail allocating a multi-disk instance was
originally added in the 2.7 branch. On master the format
of the ipolicy had changed; "min" and "max" are no longer
top-level of the ipolicy, but instead below the "minmax"
key. Hence change the test data accordingly after the merge
to master.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoRemove mistaken merge conflict line from NEWS
Guido Trotter [Thu, 11 Apr 2013 21:32:31 +0000 (17:32 -0400)]
Remove mistaken merge conflict line from NEWS

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoMerge branch 'devel-2.7'
Guido Trotter [Thu, 11 Apr 2013 21:03:32 +0000 (17:03 -0400)]
Merge branch 'devel-2.7'

* devel-2.7: (26 commits)
  Fix burnin install path
  Fix format of the NEWS file
  NEWS: Add news entry for the hail disk policy fix
  Add shelltests verifying hail applies disk ipolicy per disk
  Make the disks parameter available to the constructor
  Verify individual disks in Instance
  Compatibility fix for GHC 7
  Properly update iv_name of disks while changing templates
  Limit the size of networks to /16
  Check minimum size of networks on creation
  Fix job queue directory permission problems
  The disk size of a diskless instance is 0, not None
  Postpone non-urgent TODO from 2.7 to 2.9
  Add tool for creating users and groups
  Backwards compatibility fix for Lucid
  Properly export errors while reading job list
  Fix typo and improve comment
  Fix a bug in the Runtime tests
  Restrict instance move to templates based on local files
  Introduce a constant for the copyable disk templates
  ...

Conflicts:
NEWS: trivial
lib/network.py: trivial

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoUpdate man page 'gnt-cluster' regarding disk templates
Helga Velroyen [Thu, 28 Mar 2013 12:45:32 +0000 (13:45 +0100)]
Update man page 'gnt-cluster' regarding disk templates

This documents the new 'gnt-cluster init/modify' option
'--enabled-disk-templates' in the man page.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agoRemoves the 'sharedfile' storage type
Helga Velroyen [Thu, 28 Mar 2013 10:34:42 +0000 (11:34 +0100)]
Removes the 'sharedfile' storage type

Since storage type are supposed to represent the underlying technology
of disk templates, the storage type 'sharedfile' is superfluous, because
technically both disk templates 'file' and 'sharedfile' use the file system.
This will be of use when implementing the storage space reporting for
all disk templates.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agoUpdate NEWS file regarding disk types
Helga Velroyen [Tue, 26 Mar 2013 16:34:41 +0000 (17:34 +0100)]
Update NEWS file regarding disk types

This patch extends the NEWS file describing the essential user-facing
changes in this patch series.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agoConsistency checks for config wrt disk templates
Helga Velroyen [Wed, 27 Mar 2013 15:02:47 +0000 (16:02 +0100)]
Consistency checks for config wrt disk templates

This patch adds consistency checks for the configuration regarding
disk templates. In particular, it checks that the list of enabled
disk templates is not empty, does not contain any bogus templates,
and that all instances use actually enabled disk templates.
Additionally, it fixes a small formatting issue regarding the list
of enabled hypervisors.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agoQA: creating instances of dis/enabled disk templates
Helga Velroyen [Wed, 27 Mar 2013 12:59:06 +0000 (13:59 +0100)]
QA: creating instances of dis/enabled disk templates

This patch makes sure that instance creation is only possible
for instances that use enabled disk templates.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoQA: dis/enabling of used disk templates
Helga Velroyen [Wed, 27 Mar 2013 09:27:14 +0000 (10:27 +0100)]
QA: dis/enabling of used disk templates

This extends the QA for 'gnt-cluster modify'. It ensures
that disabling of a disk template is only possible if the
cluster does not have any instances using the template.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agognt-instance: no instance creation with disabled templates
Helga Velroyen [Tue, 26 Mar 2013 17:10:18 +0000 (18:10 +0100)]
gnt-instance: no instance creation with disabled templates

This patch makes sure that no instances can be created which use
disk templates which are not enabled on the cluster.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agoqa_instance: refactoring wrt disk templates
Helga Velroyen [Thu, 21 Mar 2013 16:11:24 +0000 (17:11 +0100)]
qa_instance: refactoring wrt disk templates

This patch is a preparation for later patches in QA in this series
it refactors the instance QA to make it more flexible regarding
creation of instances with different disk templates. Right now we
only support creation of instances with disk templates 'drbd', 'plain',
and 'diskless'. With our current plans to improve storage handling,
we should make QA more flexible to also create instances of other
templates. This patch restructures the code in a way that instances
can be created more easily to be used in other QA scripts.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agoRemoves obsolete 'enabled storage types'
Helga Velroyen [Tue, 26 Mar 2013 12:35:40 +0000 (13:35 +0100)]
Removes obsolete 'enabled storage types'

Since managing of different storage units is now done using
disk templates and not storage types, we remove the obsolete
enabled storage types.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agoQA: Test cluster init/modify wrt enabled disk templates
Helga Velroyen [Tue, 26 Mar 2013 12:32:58 +0000 (13:32 +0100)]
QA: Test cluster init/modify wrt enabled disk templates

Fixes the QA of 'gnt-cluster init' and 'gnt-cluster modify' with respect
to enabling disk templates.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agognt-cluster init: enabling of disk templates
Helga Velroyen [Tue, 26 Mar 2013 12:23:39 +0000 (13:23 +0100)]
gnt-cluster init: enabling of disk templates

This patch enhances 'gnt-cluster init' to accept a list of disk templates
to be enabled. It removes the list of enabled storage types.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agognt-cluster modify: verify instance's disk template usage
Helga Velroyen [Tue, 26 Mar 2013 12:11:07 +0000 (13:11 +0100)]
gnt-cluster modify: verify instance's disk template usage

Adds a verification step to 'gnt-cluster modify' to make sure that no
disk template is disabled that is currently in use by at least one instance.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agognt-cluster modify: modify enabled disk templates
Helga Velroyen [Tue, 26 Mar 2013 10:01:58 +0000 (11:01 +0100)]
gnt-cluster modify: modify enabled disk templates

Adds setting of the list of enabled disk templates to 'gnt-cluster modify'.
Note that this does not yet include any verification regarding disk templates
currently used by instances.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agognt-cluster info: report enabled disk templates
Helga Velroyen [Mon, 25 Mar 2013 16:48:34 +0000 (17:48 +0100)]
gnt-cluster info: report enabled disk templates

Add reporting of the currently enabled disk templates to
'gnt-cluster info'.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agoAdd enabled disk templates to cluster cfg
Helga Velroyen [Mon, 25 Mar 2013 15:56:48 +0000 (16:56 +0100)]
Add enabled disk templates to cluster cfg

This patch adds constants for enabling disk templates to the constants,
and the cluster configuration in haskell and python. It removes the
obsolete preference list for enabled storage types.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>

11 years agoFix burnin install path
Guido Trotter [Thu, 11 Apr 2013 20:23:36 +0000 (16:23 -0400)]
Fix burnin install path

Due to a bug in 8e55e20f burnin's installation path got changed.
Moving tools/burnin to the right makefile target reverts this (while
preserving the value of the original commit).

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoFix format of the NEWS file
Klaus Aehlig [Thu, 11 Apr 2013 16:29:55 +0000 (18:29 +0200)]
Fix format of the NEWS file

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoAdd "less" to the chroot
Michele Tartara [Thu, 11 Apr 2013 16:11:09 +0000 (16:11 +0000)]
Add "less" to the chroot

Less is not part of the base debian system, so it has to be added
explicitly.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoNEWS: Add news entry for the hail disk policy fix
Klaus Aehlig [Thu, 11 Apr 2013 11:37:48 +0000 (13:37 +0200)]
NEWS: Add news entry for the hail disk policy fix

hail now correctly applies the instance disk policies, which
leads to differnt allocations.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd shelltests verifying hail applies disk ipolicy per disk
Klaus Aehlig [Tue, 9 Apr 2013 09:24:09 +0000 (11:24 +0200)]
Add shelltests verifying hail applies disk ipolicy per disk

We test on two minimal examples, a positive and a negative one, where
the possibility to allocate a node depends on whether the disk policy
is checked on a per-disk level or on the total amount of disk space
requested.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoMake the disks parameter available to the constructor
Klaus Aehlig [Tue, 9 Apr 2013 13:52:09 +0000 (15:52 +0200)]
Make the disks parameter available to the constructor

In that way, tools building on Instance will benefit from the corrected
verification semantics of the instance policy on disk space.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoVerify individual disks in Instance
Klaus Aehlig [Tue, 9 Apr 2013 12:29:59 +0000 (14:29 +0200)]
Verify individual disks in Instance

Instance policy on disks is specified on a per-disk basis. So extend
the instance description by the sizes of the individual disks and modify
the instance policy verification to correctly check individual disks.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoCompatibility fix for GHC 7
Michele Tartara [Thu, 11 Apr 2013 11:33:52 +0000 (13:33 +0200)]
Compatibility fix for GHC 7

Importing an instance, like JSON, automatically allows the names of all
its functions to be used.

If one of this functions (namely showJSON) is imported separately, GHC 6
is fine with that, but GHC 7 emits a warning (therefore, the compilation of
Ganeti fails because it requires no warnings).

This patch fixes the build for GHC 7 and has no impact on GHC 6.

Note that the same does not apply to the import of readJSON, because that
function is actually used in the same file, so it must be imported separately.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoProperly update iv_name of disks while changing templates
Michele Tartara [Wed, 10 Apr 2013 14:36:44 +0000 (14:36 +0000)]
Properly update iv_name of disks while changing templates

Trasforming the disk of an instance from DRBD to plain did not properly
update the iv_name of disks, leaving it to None.

This commit modifies _ConvertDrbdToPlain to properly set the iv_name
variables.

An analogous fix is not required in the opposite function,
_ConvertPlainToDrbd, because it uses _GenerateDiskTemplate, that already
takes care of doing that.

Fixes Issue 403.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoqa: fix TestInstanceModifyPrimaryAndBack flakiness
Guido Trotter [Wed, 10 Apr 2013 18:23:17 +0000 (14:23 -0400)]
qa: fix TestInstanceModifyPrimaryAndBack flakiness

The test tries to scp the instance disks from the primary node to the
new destination, but connects to the master node instead. Thus it works
only when the primary node is the master node. Fixing by correcting to
the right node.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoLimit the size of networks to /16
Helga Velroyen [Wed, 10 Apr 2013 12:06:19 +0000 (14:06 +0200)]
Limit the size of networks to /16

This patch introduces an upper limit to the size of the networks that can
be created.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoCheck minimum size of networks on creation
Helga Velroyen [Mon, 21 Jan 2013 15:20:34 +0000 (16:20 +0100)]
Check minimum size of networks on creation

When creating a network, so far no size constraints were checked.
We now limit the size of a network to a /30 or bigger, although
tecnically, the ipaddr library supports even /32 networks.

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

11 years agoFix job queue directory permission problems
Michele Tartara [Mon, 8 Apr 2013 12:33:37 +0000 (12:33 +0000)]
Fix job queue directory permission problems

If split users are used, the queue directory could only be accessed
by masterd, but also confd needs to be able to read it, e.g. when it
is queried as part of "gnt-job list"

This commit fixes the permissions in such a way to allow proper access rights.

Fixes Issue 406.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoSet the default editor inside the chroot
Michele Tartara [Wed, 10 Apr 2013 08:48:41 +0000 (08:48 +0000)]
Set the default editor inside the chroot

Allows the chroot builder to set the default editor to be used in the
chroot.

Vim is used as the default choice.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoThe disk size of a diskless instance is 0, not None
Klaus Aehlig [Mon, 8 Apr 2013 14:35:09 +0000 (16:35 +0200)]
The disk size of a diskless instance is 0, not None

For diskless instances it is still reasonable to sum up the disk usage
of all the (zero) disks, resulting in the empty sum. This uniformity
also has the advantage that iallocators (like hail) do not have to do
any special considerations for diskless instances.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoPostpone non-urgent TODO from 2.7 to 2.9
Michele Tartara [Tue, 9 Apr 2013 13:56:13 +0000 (15:56 +0200)]
Postpone non-urgent TODO from 2.7 to 2.9

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd backports to the chroot builder sources
Michele Tartara [Tue, 9 Apr 2013 15:28:08 +0000 (15:28 +0000)]
Add backports to the chroot builder sources

This allows to have newer software than what is available in Debian Squeeze
(the default version of the distribution used by the script), particularly
vim and git.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd tool for creating users and groups
Michele Tartara [Tue, 9 Apr 2013 13:12:02 +0000 (13:12 +0000)]
Add tool for creating users and groups

When executed in split user mode, Ganeti requires a specific set of users
and groups to be created in the appropriate way.

This commit introduces a tool that takes care of that automatically.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoqa: Fix mistake in _DestroyInstanceDisks
Guido Trotter [Mon, 8 Apr 2013 22:23:35 +0000 (18:23 -0400)]
qa: Fix mistake in _DestroyInstanceDisks

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoqa: fix instance recreate disks for ST_FILE disks
Guido Trotter [Mon, 8 Apr 2013 07:43:54 +0000 (09:43 +0200)]
qa: fix instance recreate disks for ST_FILE disks

More lvm commands "sprinkled" in qa :/ We really have to factor them out
in the storage layer, once we have a good one.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoBackwards compatibility fix for Lucid
Michele Tartara [Mon, 8 Apr 2013 09:15:30 +0000 (09:15 +0000)]
Backwards compatibility fix for Lucid

The code introduced by the previous commit triggered a possible library
conflict in Ubuntu Lucid.

This patch introduces an equivalent but more widely acceptable version of
the same code.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoProperly export errors while reading job list
Michele Tartara [Thu, 4 Apr 2013 16:49:49 +0000 (18:49 +0200)]
Properly export errors while reading job list

In case of problems while reading the job list from disk (such as permission
errors) confd would silently fail, writing a warning on the log file but
sending an empty list and no error message to the client.

Also, tests have been updated in accordance to the new interface of the modified
functions.

This commit fixes this problem [Issue 405].

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoFix typo and improve comment
Michele Tartara [Thu, 4 Apr 2013 09:13:21 +0000 (11:13 +0200)]
Fix typo and improve comment

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoqa: disable inter-cluster-instance-move for file
Guido Trotter [Sun, 7 Apr 2013 05:53:37 +0000 (07:53 +0200)]
qa: disable inter-cluster-instance-move for file

This actually hides a real issue that was discovered by enabling
file-based qa, so bug was filed for it. On the other hand it's better
than keeping the qa broken, since this functionality was broken anyway.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoqa: fix RemoveInstanceOfflineNode for file-based
Guido Trotter [Sun, 7 Apr 2013 02:23:58 +0000 (04:23 +0200)]
qa: fix RemoveInstanceOfflineNode for file-based

- The cleanup should only happen for non externally mirrored disk
  templates
- It should behave differently for file and lvm based instances
- It should definitely *not* be explicit in the qa file :/ (but it's
  more important to fix qa, as of now)

Also fix a typo in the same function's docstring.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoqa: skip gnt-backup for file instances
Guido Trotter [Sun, 7 Apr 2013 02:22:34 +0000 (04:22 +0200)]
qa: skip gnt-backup for file instances

Note that this fixes the "current issue" but doesn't fix the underlying
problem. :/

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoqa: pass some extra options to make scp work
Guido Trotter [Sat, 6 Apr 2013 19:33:15 +0000 (21:33 +0200)]
qa: pass some extra options to make scp work

scp by itself won't work on a cluster: a few extra options are needed to
tell it where to find the "right" ssh global known hosts file managed by
Ganeti.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoqa: fix modify primary test
Guido Trotter [Sat, 6 Apr 2013 18:45:20 +0000 (20:45 +0200)]
qa: fix modify primary test

This test uses a non-existing config value "file-storage-dir" and fails.
Fixing it by using the default value, which is currently what qa does.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoqa: fix rename instance for non-lvm backed storage
Guido Trotter [Sat, 6 Apr 2013 16:35:34 +0000 (18:35 +0200)]
qa: fix rename instance for non-lvm backed storage

The rename instance test performs an lvm-specific check for tags on the
instance volume. This should be in the future abstracted *inside* the
template class, and not explicitly called from qa.

This would allow other disks to perform the checks that make sense for
them. In the meantime though, we just make the same check only when the
backend storage for the instance is lvm-based.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoCheck for python-yaml at configure time
Bernardo Dal Seno [Fri, 5 Apr 2013 16:13:15 +0000 (18:13 +0200)]
Check for python-yaml at configure time

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoFix a bug in the Runtime tests
Michele Tartara [Fri, 5 Apr 2013 13:42:31 +0000 (13:42 +0000)]
Fix a bug in the Runtime tests

A group name was erroneusly inserted in the list of user names.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd script for building chroot
Michele Tartara [Tue, 2 Apr 2013 13:03:49 +0000 (15:03 +0200)]
Add script for building chroot

Setting up a proper environment for building a Ganeti can be quite difficult.

This patch adds a script for building a compressed chroot with all the
required libraries and tools.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoExtension of storage reporting design doc
Helga Velroyen [Mon, 25 Mar 2013 14:17:17 +0000 (15:17 +0100)]
Extension of storage reporting design doc

This patch rewrites and extends the design doc about storage reporting
with respect to disk templates and storage types. In constrast to the
previous version, we now consider disk templates as the user-facing
entity, that the user can dis/enable for the cluster. Storage types
on the other hand describe the underlying technology used by the various
disk templates. Storage reporting will use a mapping from disk templates
to storage types to pick the correct method to report the storage for
the respective disk templates.

Note that the design doc in this state still contains some questions and
FIXMEs. Feel free to comment on those. I will complete them directly or
in future patches.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoRemove unused code
Bernardo Dal Seno [Wed, 3 Apr 2013 11:55:54 +0000 (13:55 +0200)]
Remove unused code

After changing the way gnt-xxx info print their output,
cli.FormatParameterDict() is not used anymore.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agognt-node info uses a revised format
Bernardo Dal Seno [Wed, 3 Apr 2013 11:50:26 +0000 (13:50 +0200)]
gnt-node info uses a revised format

The code is more modular, and the output is YAML-compliant. QA has been
updated to reflect the new format.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agognt-group info uses a revised format
Bernardo Dal Seno [Thu, 28 Mar 2013 11:45:06 +0000 (12:45 +0100)]
gnt-group info uses a revised format

The code is more modular, the output is more similar to "gnt-cluster info"
and is YAML-compliant.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoRefactor out function to format instance policy
Bernardo Dal Seno [Thu, 28 Mar 2013 11:34:31 +0000 (12:34 +0100)]
Refactor out function to format instance policy

The new function can be used for group-level instance policies. Support for
roman numeral formatting has been dropped to make the code simpler. For
other info items it's already unsupported, and it's not exactly documented
anyway.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoFix help string for gnt-group info
Bernardo Dal Seno [Tue, 2 Apr 2013 20:32:35 +0000 (22:32 +0200)]
Fix help string for gnt-group info

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoDocument procedure to downgrade a cluster
Bernardo Dal Seno [Wed, 3 Apr 2013 15:38:58 +0000 (17:38 +0200)]
Document procedure to downgrade a cluster

This is based on the --donwgrade option of cfgupgrade, first introduced in
1709435e.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoFix upgrade procedure in UPGRADE
Bernardo Dal Seno [Wed, 3 Apr 2013 15:05:35 +0000 (17:05 +0200)]
Fix upgrade procedure in UPGRADE

The watcher should be disabled while upgrading.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoRestrict instance move to templates based on local files
Klaus Aehlig [Wed, 3 Apr 2013 15:16:09 +0000 (17:16 +0200)]
Restrict instance move to templates based on local files

Moving an instance is done by copying over the disks. Restrict
this to disk templates that are copyable. This avoids accidental
use on, e.g., the sharedfile template.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoIntroduce a constant for the copyable disk templates
Klaus Aehlig [Wed, 3 Apr 2013 15:16:00 +0000 (17:16 +0200)]
Introduce a constant for the copyable disk templates

This list contains the disk templates suitable for moving
an instance by copying the files. A requirement is that
they're not accessed externally or shared between nodes;
in particular, sharedfile is not suitable.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoDo not _RemoveDisks after failed _CreateDisks
Klaus Aehlig [Wed, 3 Apr 2013 09:21:27 +0000 (11:21 +0200)]
Do not _RemoveDisks after failed _CreateDisks

Now that _CreateDisks cleans up after itself in case of failure,
do not clean up at call sites, as there we have to overapproximate
thus potentially causing data loss.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoMake _CreateDisk clean up partially created disks on failure
Klaus Aehlig [Wed, 3 Apr 2013 09:21:20 +0000 (11:21 +0200)]
Make _CreateDisk clean up partially created disks on failure

_CreateDisk used to just throw an exception if _CreateBlockDev failed
leaving the caller in the state that some disks were created, without
precise knowledge which. Usually, the clean up then overapproximated
by removing all disks of the instance. This can cause data loss in case
the disk creation failed because of a file being already in the place
where the disk is to be created.

With this patch, upon failure, _CreateDisk removes the disks that were
successfully created, leaving a well-defined state.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoFix typo in an error message
Michele Tartara [Wed, 3 Apr 2013 09:07:59 +0000 (11:07 +0200)]
Fix typo in an error message

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoFix error in the developer notes
Michele Tartara [Thu, 28 Mar 2013 09:19:38 +0000 (09:19 +0000)]
Fix error in the developer notes

The version numbers of two programs had been swapped.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoBump up version for 2.7.0~beta2 v2.7.0beta2
Guido Trotter [Tue, 2 Apr 2013 12:18:50 +0000 (14:18 +0200)]
Bump up version for 2.7.0~beta2

Also update the release date for beta2

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agocheck-news: fix behavior on invalid date line
Guido Trotter [Tue, 2 Apr 2013 12:38:18 +0000 (14:38 +0200)]
check-news: fix behavior on invalid date line

Before:
$ ./autotools/check-news < ./NEWS
Traceback (most recent call last):
  File "./autotools/check-news", line 150, in <module>
    main()
  File "./autotools/check-news", line 120, in main
    parsed_ts = time.mktime(time.strptime(m.group("date"), "%d %b %Y"))
AttributeError: 'NoneType' object has no attribute 'group'

After:
$ ./autotools/check-news < ./NEWS
Line 8: Invalid release line

This happened because the error function just updates an error log,
rather than bailing out immediately.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

11 years agoAdd dependency on PyYAML in devnotes
Bernardo Dal Seno [Tue, 2 Apr 2013 12:01:21 +0000 (14:01 +0200)]
Add dependency on PyYAML in devnotes

This is required because of 0e79564a; otherwise, the pylint-qa target will
fail.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoNews updates for 2.7.0 beta2
Guido Trotter [Tue, 12 Mar 2013 17:06:37 +0000 (18:06 +0100)]
News updates for 2.7.0 beta2

Mention most relevant updates and user visible changes and fixes.

These entries will only be maintained during the beta/rc series, but
will then be replaced with a single "2.7.0" entry when we will release
2.7.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoAdd QA for gnt-instance modify --new-primary
Klaus Aehlig [Thu, 14 Mar 2013 11:52:49 +0000 (12:52 +0100)]
Add QA for gnt-instance modify --new-primary

Add a simple walk through the intended use case of
gnt-instance modify --new-primary for the disk template
file. The tested scenario is shutting down an instance,
manually moving the disk to the new node, setting the
new primary, and starting up the instance on the new
node. It is also verified that the operation is rejected
while the instance is still running on the old node.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdditionally support disk-type file in QA
Klaus Aehlig [Thu, 14 Mar 2013 11:52:48 +0000 (12:52 +0100)]
Additionally support disk-type file in QA

Also perform QA tests for the file disk template. The main reason
is that testing gnt-instance modify --new-primary requires a
manual move of disks, which is most easily simulated for files.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd option --new-primary to gnt-instance modify
Klaus Aehlig [Thu, 14 Mar 2013 11:52:48 +0000 (12:52 +0100)]
Add option --new-primary to gnt-instance modify

Extend gnt-instance modify by a new parameter --new-primary
that sets the pnode paramter of the opcode.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoMake LUInstanceSetParams handle pnode parameter
Klaus Aehlig [Thu, 14 Mar 2013 11:52:47 +0000 (12:52 +0100)]
Make LUInstanceSetParams handle pnode parameter

If pnode is set LUInstanceSetParams now sets the primary node
accordingly. Unless force is set, it is verified that the instance
is no longer running on the old node.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoAdd parameter pnode to OpInstanceSetParams
Klaus Aehlig [Thu, 14 Mar 2013 11:52:47 +0000 (12:52 +0100)]
Add parameter pnode to OpInstanceSetParams

This parameter will be used to set the new primary node
of an instance, assuming that the disks have been moved
by other means (outside ganeti's control).

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoUpdate installation documentation
Michele Tartara [Tue, 2 Apr 2013 08:29:02 +0000 (10:29 +0200)]
Update installation documentation

Some required dependencies were missing from the installation instructions.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

11 years agoCorrect typos in comments
Michele Tartara [Fri, 15 Mar 2013 10:08:15 +0000 (10:08 +0000)]
Correct typos in comments

Correct four typos in the comments of the Drbd types file.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoAdd status information to the DRBD data collector report
Michele Tartara [Mon, 28 Jan 2013 17:13:43 +0000 (17:13 +0000)]
Add status information to the DRBD data collector report

Add status information as required by the design document.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExport the data collected by DRBD in JSON format
Michele Tartara [Thu, 14 Mar 2013 13:34:36 +0000 (13:34 +0000)]
Export the data collected by DRBD in JSON format

Write an intermediate function computing the JSON data before adding them
to the DCReport.

Directly export the data computed by that function (with default parameters)
allowing them to be used (in the future) by the monitoring agent.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoAdd DCStatus data type for the data collectors
Michele Tartara [Thu, 14 Mar 2013 13:09:27 +0000 (13:09 +0000)]
Add DCStatus data type for the data collectors

Also adds the DCStatusCode, part of DCStatus, and the addStatus
utility function for adding the "status" field to an already existing
JSValue.

The design document is updated to have the status codes sorted by increasing
seriousness.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoAdd Kind data type for data collectors
Michele Tartara [Thu, 14 Mar 2013 12:47:24 +0000 (12:47 +0000)]
Add Kind data type for data collectors

Also, add it to the DRBD data collector, and export it from there.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoAdd data type for data collector category
Michele Tartara [Thu, 14 Mar 2013 12:39:23 +0000 (12:39 +0000)]
Add data type for data collector category

Also, update the DRBD data collector to use and export it.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoExport the dcVersionInformation for the Drbd collector
Michele Tartara [Thu, 14 Mar 2013 12:02:26 +0000 (12:02 +0000)]
Export the dcVersionInformation for the Drbd collector

Also, update the JSON output (and the design document) so that it is not
in camelcase anymore. This is part of a bigger effort to remove camelcase
from the exposed JSON.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

11 years agoAdd data collector version data type
Michele Tartara [Thu, 14 Mar 2013 11:50:41 +0000 (11:50 +0000)]
Add data collector version data type

Define the new data type and update the DRBD data collector to use it.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>