Statistics
| Branch: | Tag: | Revision:

root / lib / config.py @ 9a5fba23

History | View | Annotate | Download (40.1 kB)

# Date Author Comment
9a5fba23 07/16/2009 04:40 pm Guido Trotter

Add a few more checks to verify config

- Check that the enabled hypervisors list is valid
- Check that the master node is a valid node

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

e52019f7 07/14/2009 07:17 pm Guido Trotter

Remove ConfigWriter.InitConfig

It's been replaced by a simpler bootstrap.InitConfig function, which
does the same job, and is currently unused.

Signed-off-by: Guido Trotter <>
Reviewed-by: Iustin Pop <>

7c4d6c7b 07/07/2009 03:54 pm Michael Hanselmann

Fix pylint warnings

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

5bbd3f7f 07/07/2009 03:51 pm Michael Hanselmann

Fix some typos

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

23f06b2b 06/30/2009 07:31 pm Iustin Pop

Allow GetMasterCandidateStats to ignore some nodes

This patch modifies ConfigWriter.GetMasterCandidateStats to allow it to
ignore some nodes in the calculation, so that we can use it to predict
cluster state without some nodes (which we know we will modify, and thus...

5d60b3bd 04/06/2009 11:20 am Iustin Pop

Add a new ssconf file with the cluster tags

Since the cluster tags are/should be more-or-less static, add them as an
ssconf key, so that querying them is possible without creating a
job/requiring the masterd to be running.

Reviewed-by: imsnah

5fcc718f 02/27/2009 03:06 pm Iustin Pop

Fix some epydoc style issues

99% of the epydoc return tags are "@return:", but each of the modified files
had one "@returns:" line. We fix this for consistency.

Reviewed-by: imsnah

e4640214 02/12/2009 07:35 pm Guido Trotter

ConfigWriter.AddInstance check instance mac

There is a race condition in CreateInstance, since the mac address is
generated early and only added to the config (and thus really assured to
be unique) only at this point. Since it's possible that another instance...

25ae22e4 02/12/2009 07:04 pm Iustin Pop

Do not check 'None' disk IDs for duplicates

In case of 'None' logical or physical IDs, we don't need to check them
for duplicates. This case can happen for DRBD devices in case of newly
added disks, for example.

Reviewed-by: imsnah

e7d81ba0 02/12/2009 07:04 pm Iustin Pop

Prevent race condition on MAC addresses

This patch adds a temporary set for MACs that have been requested but
are not yet in the configuration (as part of an instance NIC). The MACs
of an instance are automatically removed from this set when the instance...

4b98ac29 02/12/2009 09:31 am Iustin Pop

ConfigWriter: add checks for duplicate disk IDs

This patch adds a safety check for duplicate disk logical/physical IDs,
in order to prevent possible software bugs.

Reviewed-by: imsnah

5bf07049 02/10/2009 04:46 pm Iustin Pop

ConfigWriter: handle the drained node flag

This patch changes the master candidate pool computations in
ConfigWriter to properly handle drained nodes. They are now excluded
from counting towards the reachable number of candidates.

The patch also adds verification of consistency for the node status....

81a49123 02/04/2009 12:31 pm Iustin Pop

ssconf: add some more keys and some fixes

This patch adds the online node list and instance list to the ssconf
keys. In order to do distribute correctly the instance list, we need to
update the cluster serial number on instance additions and removals.

The patch also changes the permissions on the ssconf files to be 0444:...

332d0e37 01/27/2009 05:41 pm Iustin Pop

Implement disk verify checks in config verify

This patch adds a simple check that the 'mode' attribute of top-level disks is
correct. It does not recurse over children.

The framework could be extended with other checks in the future.

Reviewed-by: imsnah

79b26a7a 01/23/2009 02:36 pm Iustin Pop

Relax the restrictions on temporary DRBD minors

Currently the restrictions are too harsh: there is a time interval
between an instance gets a new disk and before it is added to the
configuration in which the restriction is not met. We solve this by
allowing temporary DRBD minors to match existing minors (for the same...

4a89c54a 01/23/2009 02:36 pm Iustin Pop

Introduce more configuration consistency checks

This patch enhances the duplicate DRBD minors checks (currently just a
few) and adds automatic checks of configuration consistency at
configuration file writing time.

In order to do so and show meaningful error messages, the...

61cf6b5e 01/21/2009 04:15 pm Iustin Pop

Automatically release DRBD minors on success

This patch converts the DRBD minors reservation protocol from explicit
release to automatic release on the success paths. On the errors paths,
it's still needed to manual release.

The patch doesn't bring much by itself, but is needed for a future patch...

0d68c45d 01/21/2009 12:30 pm Iustin Pop

Change the instance status attribute to boolean

Due to historic reasons, the “should run or not” attribute of an
instance was denoted by its “status” attribute having a string value of
either ‘up’ or ‘down’. Checking this is in code was done via hardcoding...

32388e6d 01/20/2009 04:20 pm Iustin Pop

Fix adding of disks to an instance

The ConfigWriter.AllocateDRBDMinor requires the instance name, not the
instance object. The LUSetInstanceParms is passing wrongly the instance
object, which can cause breakage.

The patch also adds asserts to check for this mismatch in ConfigWriter....

6d2e83d5 01/20/2009 04:20 pm Iustin Pop

Make cluster-verify check the drbd minors space

This patch adds support for verification of drbd minors space in cluster
verify: minors which belong to running instances and should be online
but are not, and minors which do not belong to any instace but are in...

8a113c7a 01/09/2009 06:24 pm Iustin Pop

Add a new ssconf file with the ganeti version

The patch adds a new ssconf file containing the ganeti version.

Reviewed-by: imsnah

94a02bb5 01/09/2009 04:26 pm Iustin Pop

Fix gnt-os for offline nodes

We shouldn't query offline nodes in gnt-os. This patch adds an utility
function to ConfigWriter that returns the names of online nodes and uses
it in LUDiagnoseOS to query only the good nodes.

Reviewed-by: imsnah

3c7f6c44 12/14/2008 02:05 pm Iustin Pop

cleanup: ConfigWriter, initialize all attributes

We should initialized the _last_cluster_serial in the constructor too (just to
be consistent).

Reviewed-by: amishchenko

c41eea6e 12/11/2008 07:13 pm Iustin Pop

Fix epydoc format warnings

This patch should fix all outstanding epydoc parsing errors; as such, we
switch epydoc into verbose mode so that any new errors will be visible.

Reviewed-by: imsnah

ee513a66 12/08/2008 07:45 pm Iustin Pop

Fix _AdjustCandidatePool

Currently the ConfigWriter.MaintainCandidatePool returns node names, and
_AdjustCandidatePool uses them as such, but then it passes these to
context.ReaddNode which in turn passes them to jqueue.JobQueue.AddNode which
uses them as objects.Node instances....

ec0292f1 12/05/2008 01:14 pm Iustin Pop

Add function to compute the master candidates

Since some nodes can be offline, we can't just take the length of the
node list as the maximum possible number of master candidates.

The patch adds an utility function to correctly compute this value and
replaces hardcoded computations with the use of this function. It then...

a3316e4a 12/05/2008 12:12 pm Iustin Pop

Add the offline node list to ssconf

The patch also changes the various node list generation to be more
consistent.

Reviewed-by: imsnah

3a26773f 12/03/2008 11:57 am Iustin Pop

A few fixes related to master candidates

This patch:
- fixes cluster verify when all nodes are master candidates, but the
candidate_pool_size is higher
- warn when the master node is not marked as candidate
- disable setting master node to regular node...

a8efbb40 12/02/2008 07:06 am Iustin Pop

Add candidate pool size checks in verify

Reviewed-by: imsnah

f56618e0 12/02/2008 07:05 am Iustin Pop

Add the list of master candidates to ssconf

Reviewed-by: imsnah

6a5b8b4b 12/02/2008 07:05 am Iustin Pop

Restrict config replication to master candidates

This patch restricts the config data replication to master candidates
only.

Reviewed-by: imsnah

054596f0 12/02/2008 07:04 am Iustin Pop

Replicate the node list in ssconf

This patch adds node_list in the list of replicated values from
ConfigWriter.

Reviewed-by: imsnah

f34901f8 11/27/2008 12:21 pm Iustin Pop

Fix logic bug in rev 2072

In revision 2072 "ConfigWriter: change cluster serial meaning" I misread
the serial_no update logic: it was about updating the serial number on
the object itself, not on the cluster.

So we don't actually have at all cluster serial number increase when a...

cff4c037 11/27/2008 05:13 am Iustin Pop

ConfigWriter: change cluster serial meaning

Currently, we increase the cluster serial number for instance additions,
removals and renames. This is conforming with the REST paradigm, however
it means that for each of these operations, we need to push ssconf...

03d1dba2 11/25/2008 02:37 pm Michael Hanselmann

Pass ssconf values from master to node

Instead of parsing the configuration on the node, we pass the ssconf
values from the master.

Reviewed-by: iustinp

d9a855f1 11/24/2008 05:39 pm Michael Hanselmann

Fix unittests broken by rev 2015

Ssconf files shouldn't be updated when running unittests.

Reviewed-by: ultrotter

0779e3aa 11/23/2008 05:35 pm Iustin Pop

Only update ssconf on cluster serial change

There is no need to update ssconf if the cluster serial number has not
changed.

Reviewed-by: ultrotter

54d1a06e 11/21/2008 12:42 pm Michael Hanselmann

Write ssconf files when updating configuration

Reviewed-by: ultrotter

64272529 10/23/2008 05:18 pm Iustin Pop

Fix leftover of hypervisor attribute rename

Reviewed-by: imsnah

6b294c53 10/20/2008 05:47 pm Iustin Pop

Convert rpc.call_upload_file to use addresses

This patch allows rpc.call_upload_file to use addresses (if passed), and
also converts the ConfigWriter._DistributeConfig to pass them, since
this is an often-done operation.

Reviewed-by: imsnah

72737a7f 10/10/2008 12:55 pm Iustin Pop

Convert rpc module to RpcRunner

This big patch changes the call model used in internode-rpc from
standalong function calls in the rpc module to via a RpcRunner class,
that holds all the methods. This can be used in the future to enable
smarter processing in the RPC layer itself (some quick examples are not...

3d3a04bc 10/06/2008 06:56 pm Iustin Pop

Disable re-reading of config file

Since the objects read from the config file are passed to the various
threads, it's unsafe to re-read the config file (and throw away
ConfigWriter._config_data). As such, we disable the re-reading of the
file (since now the master is the owner the file, it makes not sense to...

5b263ed7 10/01/2008 08:34 pm Michael Hanselmann

Convert config.py

The configuration version is now again in the configuration file.

Reviewed-by: iustinp

ae5849b5 10/01/2008 08:33 pm Michael Hanselmann

Add new query to get cluster config values

This can be used to retrieve certain cluster config values from
within clients.

OpDumpClusterConfig was not used anywhere, hence I'm just reusing
it. The way ConfigWriter.DumpConfig returned the configuration
was not thread-safe, anyway (no deepcopy)....

4a8b186a 10/01/2008 08:33 pm Michael Hanselmann

Move functions from ssconf.py elsewhere

These functions will be used to access config values instead of using
ssconf.

Reviewed-by: iustinp

f6bd6e98 10/01/2008 12:03 pm Michael Hanselmann

Add cluster options from ssconf to configuration

ssconf will become write-only from ganeti-masterd's point of view,
therefore all settings in there need to go into the main configuration
file.

Reviewed-by: iustinp

b9eeeb02 10/01/2008 12:03 pm Michael Hanselmann

Move instantiation of config into bootstrap.py

Future patches will add even more variables to the cluster config.
Adding more parameters wouldn't make the function easier to use and
it doesn't make sense to pass them to another function, as it's
only done once in bootstrap.py on cluster initialization....

f9518d38 09/29/2008 04:15 pm Iustin Pop

Extend DRBD disks with shared secret attribute

This patch, which is similar to r1679 (Extend DRBD disks with minors
attribute), extends the logical and physical id of the DRBD disks with a
shared secret attribute. This is generated at disk creation time and...

d48663e4 09/28/2008 05:43 pm Iustin Pop

Fix a bug related to static minors

When the node does not yet have any minors allocated, the first minor
(0) will not be entered in the ConfigWriter._temporary_drbds structure.
This does not happen for our current usage, since we always ask for two
minors (so the next call will not match this case), but it will be...

48ce9fd9 09/27/2008 11:45 pm Iustin Pop

Add checks for tcp/udp port collisions

In case the config file is manually modified, or in case of bugs, the
tcp/udp ports could be reused, which will create various problems
(instances not able to start, or drbd disks not able to communicate).

This patch extends the ConfigWriter.VerifyConfig() method (which is used...

b9f72b4e 09/27/2008 06:58 pm Iustin Pop

Update the cluster serial_no on certain operations

This patch adds update of the cluster serial number for:
- add/remove node (as the cluster's node list is changed)
- add/remove/rename instance (as the cluster's instance list is changed)
- change the volume group name...

b989e85d 09/27/2008 06:58 pm Iustin Pop

Initialize and update the serial_no on objects

This patch add initialization of the serial_no on instance and nodes,
and update of the field whenever an object is updated in the generic
case, via ConfigWriter.Update(obj) and in the specific case of
instances' state being modified manually....

9d38c6e1 09/27/2008 06:58 pm Iustin Pop

Switch the global serial_no to the top object

Currently the serial_no that is incremented every time the configuration
file is written is located on the 'cluster' object in the configuration
structure. However, this is wrong as the cluster serial_no should be...

74a48621 09/24/2008 04:43 pm Iustin Pop

Switch config.py to logging

A couple of more modules are using the obsolete logger functions, config
being one of them.

Reviewed-by: imsnah

a81c53c9 09/23/2008 03:10 pm Iustin Pop

Implement config support for drbd static minors

This patch adds support for allocating static minors.

Like for the LVM uuids, we add a new cache for the temporarily allocated
requests, and the users of the new methods must manually clear the
cache. If this doesn't happen, at worst we lose some minors....

ffa1c0dc 09/22/2008 02:32 pm Iustin Pop

Extend DRBD disks with minors attribute

This patch converts the DRBD disks to contain also a minor (per each
node) attribute. This minor is not yet used and is always initialized
with None, so the patch does not have any real-world impact - except for
automatically upgrading config files (it adds the minors as None, None)....

64d3bd52 09/11/2008 08:45 pm Guido Trotter

GetAllInstancesInfo, change internal iterator name

GetAllInstancesInfo used "node" as an iterator name. Change it to
instance to make it less confusing.

Reviewed-by: iustinp

0b2de758 09/10/2008 08:07 pm Iustin Pop

Add an atomic ConfigWrite.GetAllInstanceInfo()

In order to be able to query instance without locking them, we need the
same atomic query of multiple instances as for nodes.

Reviewed-by: ultrotter

94bbfece 09/10/2008 08:06 pm Iustin Pop

Add ConfigWriter._UnlockedGetInstanceList/Info()

This patch splits the GetInstanceInfo and GetInstanceList methods into
two parts, one locked one _Unlocked similar to the way nodes are
queried.

Reviewed-by: ultrotter

d65e5776 09/10/2008 02:02 pm Iustin Pop

Add a way to export all node information at once

The patch adds a new function to export all node information at once
(i.e. atomically with respect to the configuration lock).

Reviewed-by: ultrotter

d8470559 08/06/2008 05:56 pm Michael Hanselmann

Implement {Add,Readd,Remove}Node in GanetiContext

By doing this we've a central place which coordinates what needs to be
done when adding or removing nodes. Another patch will add calls into
the job queue.

Two log messages move to config.py.

When removing a node, node_leave_cluster is now called after it has...

38206f3c 07/30/2008 05:04 pm Iustin Pop

Fix pylint-detected issues

This is mostly:
- whitespace fix (space at EOL in some files, not all, broken
indentation, etc)
- variable names overriding others (one is a real bug in there)
- too-long-lines
- cleanup of most unused imports (not all)...

f78ede4e 07/08/2008 11:40 am Guido Trotter

ConfigWriter: synchronize access

Since we share the ConfigWriter we need somehow to make sure that
accessing it is properly synchronized. We'll do it using the
locking.ssynchronized decorator and a module-private shared lock.

This patch also renames a few functions, which were called inside the...

5b4cd1b0 07/08/2008 11:40 am Guido Trotter

ConfigWriter: remove _ReleaseLock

Remove empty function _ReleaseLock and all its calls. Since we only
have one configwriter per cluster the locking needs to cover all the
data in the object, and not just the file contents. Locking in
ConfigWriter will be handled using the ganeti locking library....

243cdbcc 05/07/2008 02:12 pm Michael Hanselmann

Use new ssconf function to check configuration version

Upgrades will be handled in future patches.

Reviewed-by: iustinp

9ff994da 05/05/2008 11:49 am Guido Trotter

Wrap exception in _DistributeConfig code

nodelist.remove(X) could potentially raise a ValueError (even if the chance
that the current node is not in the list are pretty scarce, and its absence
should raise a red flag anyway). If this happens let things go on, as that's...

41362e70 05/05/2008 11:15 am Guido Trotter

Simplify target generation in DistributeConfig

Currently we get the list of nodes, and for each one extract all its info, and
just to exclude it if the name matches ours. Since the list of nodes is a list
of names just use .remove() to exclude ourself from it, and use that list...

455a3445 04/21/2008 04:22 pm Iustin Pop

Only change instance status if not already so

This patch makes the _SetInstanceStatus only change the status of the
instance (in the config file) if it's not already in the desired state.
This skips the increase of the config serial no without actual data...

6a408fb2 04/21/2008 04:22 pm Iustin Pop

Reuse common code between MarkInstance{Up,Down}

This patch creates a new method ConfigWriter._SetInstanceStatus that
consists of the common code between MarkInstanceUp and MarkInstanceDown.
These two methods become wrappers over the _SetInstanceStatus.

Reviewed-by: ultrotter

8d14b30d 04/21/2008 04:04 pm Iustin Pop

Abstract the json functions into a separate module

This simple patch adds a new module that holds the simplejson functions
for serialization/deserialization. This reduces the amount of redundant
code.

The patch also adds some normalizations to the json output:...

b23c4333 04/08/2008 07:00 pm Manuel Franceschini

Modify LURenameInstance to support file backend

This patch does two things:
- Modify LURenameInstance.Exec to rename directory
when a file-based instance is renamed
- Modify config.RenameInstance() to replace the directory name in
config.data for file devices...

2d4011cd 04/04/2008 07:53 pm Manuel Franceschini

Fix SetVGName() to access object not dict

Reviewed-by: imsnah

89ff8e15 03/31/2008 01:58 pm Manuel Franceschini

Add method SetVGName() to config.py

Reviewed-by: iustinp

1862d460 12/27/2007 05:31 pm Alexander Schreiber

Allow instance MAC address to be set.

Allow the MAC address of an instance to be specified optionally during
instance creation and later to be changed via instance modify.

Reviewed-by: iustinp

8522ceeb 11/27/2007 04:15 pm Iustin Pop

Fix logging of some checks in LUClusterVerify

Currently, the results of ConfigWriter.VerifyConfig() are lost. Make
sure we log them too in cluster verify.

Reviewed-by: ultrotter

24818e8f 11/05/2007 02:14 pm Michael Hanselmann

Rename utils.GetUUID to utils.NewUUID.

Reviewed-by: schreiberal

a1f445d3 10/24/2007 05:43 pm Iustin Pop

Initial implementation of drbd8 template type

This is a partially working drbd8 template type. It does:
- add/remove
- startup/failover/shutdown

Not working is replace disks, which needs custom code for this template.

Reviewed-by: imsnah

fe96220b 10/19/2007 02:48 pm Iustin Pop

Abstract more strings values into constants

Currently, the disk types are defined using constants in the code.
Convert those into constants so that we can easily find them and check
their usage.

Note that we don't rename the values of the constants as they are used...

14e15659 10/11/2007 05:55 pm Iustin Pop

Enable the ConfigWriter to keep track of updates

This allows external callers to determine if the configuration has been
changed.

Reviewed-by: imsnah

59072e7e 10/11/2007 03:04 pm Michael Hanselmann

Use the kernel's ability to generate UUIDs.

This removes the dependency on either the uuid module or e2fsprogs' uuidgen.

Reviewed-by: iustinp

2f31098c 10/10/2007 01:00 pm Iustin Pop

Remove the shebang from modules

Since modules are not directly executables, remove the shebang from
them. This helps with lintian warnings.

Also make the autogenerated _autoconf.py contain two comment lines at
the beginning, like the other modules.

Reviewed-by: ultrotter

fe4cc679 10/09/2007 10:42 am Iustin Pop

Revert a debugging 'raise' from rev 195

As far as I understand, this was just a debugging aid. Remove it so that
configuration errors are nicely handled.

Reviewed-by: imsnah

319856a9 10/04/2007 02:33 pm Michael Hanselmann

Change configuration storage format from Pickle to JSON.

- Add NEWS file with major changes between versions.
- Bump RPC version number
- No longer serialize in RPC, but just convert to dict

Old Pickle based configuration files can be converted using the cfgupgrade...

89e1fc26 09/21/2007 04:37 pm Iustin Pop

Remove requirement that host names are FQDN

We currently require that hostnames are FQDN not short names
(node1.example.com instead of node1). We can allow short names as long
as:
- we always resolve the names as returned by socket.gethostname()
- we rely on having a working resolver...

fc95f88f 09/17/2007 12:10 pm Iustin Pop

Add rename instance support to ConfigWriter

This patch adds support for renaming instances to the ConfigWriter
class. It's needed in here in order to guarantee that we don't lose the
instance during the rename (the instance will be there, either with the...

3ecf6786 08/14/2007 06:17 pm Iustin Pop

Style changes for pep-8 and python-3000 compliance.

This changes the raising of exceptions from:
raise Exception, value
to
raise Exception(value)

as the first form will be removed in python-3000 and the second form is
preferred now.

The changes also involve a few cases of changing from raising standard...

e00fb268 08/03/2007 06:04 pm Iustin Pop

Prepare for the tags implementation:
- add an Update method on the ConfigWriter class;
- make the AddInstance method not log disks for diskless types (helps with testing)
- implement limited testing for the ConfigWriter with focus on the new Update method

fee9556c 08/03/2007 03:51 pm Iustin Pop

Re-stat the config file when we write it so that the next _OpenConfig()
won't reread it if not modified by someone else.

62779dd0 08/03/2007 02:03 pm Iustin Pop

Implement a standard way of getting the cluster object from the
configuration.

Reviewed-by: imsnah

923b1523 08/03/2007 12:57 pm Iustin Pop

Change logival volume names to not be based on the instance's name, but
instead use an UUID prefix and a suffix denoting the disk iv_name
(sda/sdb) and possibly it's type (data/meta).

Reviewed-by: imsnah

5fcdc80d 07/27/2007 10:41 am Iustin Pop

Move the cluster name from ConfigWriter to SimpleStore.

Reason: if left ConfigWriter, nodes don't know to which cluster they belong.
This will bite us later when we'll revisit node join operation.

Cons: we lose the cluster name from the config file, which means a...

330cda58 07/26/2007 06:26 pm Michael Hanselmann

Don't pass master_node

Reviewed-by: iustinp

098c0958 07/26/2007 02:40 pm Michael Hanselmann

Comment formatting updates.

Reviewed-by: iustinp

b2fddf63 07/26/2007 11:48 am Iustin Pop

The master_node is no longer stored in the config file (but in sstore)
and all users have been converted, let's remove it from the slots of the
cluster object.

Also let's move the tcpudp_port_pool to the cluster object.

Reviewed-by: imsnah

264bb3c5 07/25/2007 07:16 pm Michael Hanselmann

Get ports from configuration if there are some.

Reviewed-by: iustinp

880478f8 07/23/2007 05:38 pm Iustin Pop

Big change/cleanup in relation to the master startup:
- move the master node name from the ConfigWriter to SimpleStore (all
nodes need this, and it was the only thing pulled in from the
ConfigWriter on nodes)
- fix mcpu.py and the testing w.r.t. this change; for testing, rename...

a8083063 07/16/2007 04:39 pm Iustin Pop

Initial commit.