Statistics
| Branch: | Tag: | Revision:

root / lib / objects.py @ cd098c41

History | View | Annotate | Download (26.5 kB)

# Date Author Comment
13f1af63 06/12/2009 10:41 am Guido Trotter

Add nicparams to the NIC object

Also populate nicparams with a sensible default for imported instances.
Unfortunately we don't know if the bridge set up in old nics is the
default one or not, and we don't have access to the config cluster
object here to verify, so we'll just copy it without questions....

c8fcde47 06/08/2009 07:58 pm Guido Trotter

Cluster: add nicparams, and update them on upgrade

This also migrates the default bridge from the cluster object to the nic
params, at load time. Since we don't support changing the default bridge
after cluster init, this is ok for now. In the future we'll make...

255e19d4 06/08/2009 07:58 pm Guido Trotter

Add NIC.CheckParameterSyntax

This function will be used to check the NIC parameters for validity.
Unittests are included.

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

6e34b628 06/08/2009 07:58 pm Guido Trotter

Abstract Param upgrade from cluster.UpgradeConfig

A new UpgradeGroupedParams is used to upgrade all the profiles for one
parameter filling in the default values, or creating the whole dict
anew, should it be missing. This is used only for beparams, currently,...

4ef7f423 06/08/2009 07:58 pm Guido Trotter

Change BEGR_DEFAULT to PP_DEFAULT

This way the same constant can represent the default profile also for
nic, disk and OS parameters.

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

abe609b2 06/08/2009 07:58 pm Guido Trotter

Move FillDict at module level

This way it can be also used by scripts and other object types.

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

c1b42c18 05/28/2009 03:18 pm Guido Trotter

Upgrade be/hv params with default values

From time to time we're adding new be or hv parameters. With this patch
missing parameters get set to the default value when loading the cluster
object. This patch version also considers the case when hv/be params...

b86a6bcd 05/28/2009 03:18 pm Guido Trotter

Add cluster-init --no-etc-hosts parameter

If --no-etc-hosts is passed in at cluster init time we set a new
parameter in the cluster's object to false, and avoid adding nodes to
the hosts file. The UpgradeConfig function is used to set the value to
True, when upgrading from an old configuration version....

560428be 05/28/2009 03:18 pm Guido Trotter

objects: add configuration upgrade system

Add a very basic configuration update mechanism to objects.
An object can define the UpgradeConfig method, which will be called at
init time, and use it to fill in missing defaults in the configuration.
In the future we may want to make it more complex, for example adding...

28ab6fed 03/02/2009 02:19 pm Iustin Pop

Don't allow spaces in tag names

This patch restricts the use of spaces in tags, as this does not allow
nice exporting of tags to environment in hooks. One can use underscores
or dashes instead of spaces.

Reviewed-by: schreiberal

fd965830 02/12/2009 07:09 pm Iustin Pop

Handle better broken disks

While running burnin:
File "/usr/lib/python2.4/site-packages/ganeti/objects.py", line 497, in str
val += ", size=%dm)>" % self.size
TypeError: int argument required

This happened while handling another error, so we lose the original...

af64c0ea 02/10/2009 04:45 pm Iustin Pop

Add a ‘drained’ attribute to node objects

This attribute will be used to prevent any allocation on the node (any
of replace-disks with new secondary this node, failover to the node,
migration to the node).

The patch adds the attribute and initializes it correctly in cluster...

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

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...

89f28b76 01/21/2009 10:33 am Iustin Pop

Update the objects.Disk formatting method

With the addition of minors, this needs to show them too.

Reviewed-by: ultrotter

55224070 01/20/2009 07:50 pm Guido Trotter

ConfigObject docstring, close an open parenthesis

Reviewed-by: iustinp

99c7b2a1 01/19/2009 04:32 pm Iustin Pop

Fix non-drbd instance creation

Commit 2294 introduced a new instance.all_nodes property, which
unfortunately is working incorrectly for non-drbd instances.

This patch fixes it by making sure the primary node is always added to
the set, even before recursing over (any potential) children....

7c5abcae 01/19/2009 01:10 pm Iustin Pop

Small simplification in MapLVsByNode

We don't need to pre-create the node entries in lvmap, since they will
be created at recursion time.

Reviewed-by: ultrotter

cfcc5c6d 01/16/2009 01:02 pm Iustin Pop

Instance: add a new all_nodes property

Since we often need the list of all nodes of an instance, we add a new
"all_nodes" property that returns all nodes of the instance, and we
switch secondary_nodes to a simpler implementation based on this new
function....

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

fc0fe88c 12/05/2008 04:53 am Iustin Pop

Add a new node parameter 'offline'

This patch adds a new node parameter called offline that will be used to
mark nodes which should be touched by commands.

We also add this flag at cluster init, node add, and export it to
iallocator scripts.

Reviewed-by: ultrotter

4b7735f9 12/02/2008 07:06 am Iustin Pop

Add cluster candidate pool size parameter

This patch adds a new cluster paramater "candidate_pool_size" which
tracks the desired size of the list of nodes with the master_candidate
flag set.

Reviewed-by: imsnah

8b8b8b81 12/02/2008 07:04 am Iustin Pop

Introduce a new 'master_candidate' node attribute

The field is not yet used.

Reviewed-by: imsnah

ad24e046 11/21/2008 05:34 pm Iustin Pop

Change GrowDisk to work with multi-disk

This patch changes the instance.FindDisk method to take index arguments
(instead of iv_names), and changes GrowDisk and list instances
accordingly.

Reviewed-by: ultrotter

08db7c5c 11/20/2008 08:22 am Iustin Pop

Initial multi-disk/multi-nic support

This patch adds support for mult-disk/multi-nic in:
- instance add
- burnin

The start/stop/failover/cluster verify work as expected. Replace disk
and grow disk are TODO.

There's also a change gnt-job to allow dictionaries to be listed in...

02691904 10/20/2008 07:38 pm Alexander Schreiber

Set default hypervisor at cluster init

During cluster init, set the default hypervisor to be used for instances.
Ensure that the default hypervisor belongs to the set enabled hypervisors
for this cluster. Also fix a small bug with setting the default enabled...

bf766476 10/14/2008 02:30 pm Iustin Pop

Remove old instance attributes

Reviewed-by: ultrotter

6785674e 10/14/2008 01:20 pm Iustin Pop

Switch instance hypervisor parameters to hvparams

This big patch changes instance create to the new hvparams structure.
Old parameters are removed, so old jobs or old instances file will break
current clusters.

Reviewed-by: ultrotter

5bf7b5cf 10/14/2008 09:36 am Iustin Pop

Add the hv/be params object attributes

This patch adds the instance and cluster be/hvparams attributes, and the
Fill* methods on the cluster object. Nothing else is changes, except
that these attributes exist now on the objects.

Reviewed-by: ultrotter

082a7f91 10/10/2008 07:04 pm Guido Trotter

OS API: support for multiple versions in an OS

Allow multiple api versions in an OS. This is according to the OS API
changes design doc, by which an OS can support multiple versions of the
Ganeti API and if one is supported by Ganeti it will work. Since up to...

e69d05fd 10/08/2008 01:36 pm Iustin Pop

Move the hypervisor attribute to the instances

This (big) patch moves the hypervisor type from the cluster to the
instance level; the cluster attribute remains as the default hypervisor,
and will be renamed accordingly in a next patch. The cluster also gains...

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

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...

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

Add serial_no attributes to objects

This patch adds the ‘serial_no’ attribute to the other top-level objects
(the configuration object itself, the nodes and the instances).

Reviewed-by: ultrotter

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)....

b894f5a8 08/29/2008 06:01 pm Alexander Schreiber

merge r1535 from branches/ganeti/ganeti-1.2

Add HVM device type flags 1/4

Reviewed-by: ultrotter

00fb8246 06/25/2008 11:07 am Michael Hanselmann

Cleanup old DRBD 0.7.x code

Apparently there were still some leftovers. While removing an instance,
I got the message "unhandled exception 'module' object has no attribute
'LD_MD_R1'".

Reviewed-by: iustinp

cf9cb46a 06/23/2008 04:00 pm Michael Hanselmann

objects: Remove config_version from cluster configuration

Reviewed-by: ultrotter

0402302c 06/17/2008 06:08 pm Iustin Pop

Allow disk object to set their own physical ID

Currently, the way to customize a DRBD disk from (node name 1, node name
2, port) to (ip1, port, ip2, port) is to use the ConfigWriter method
SetDiskID. However, since this needs a ConfigWriter object, it can be...

acec9d51 06/17/2008 09:50 am Iustin Pop

Add method to update a disk object size

This patch adds a method that implements updating of a disk
(object.Disk) size, together with its children.

While this will not track the exact disk size, it allows at least an
approximate size to be recorded in the configuration (and queried)....

abdf0113 05/30/2008 01:55 pm Iustin Pop

Complete removal of md/drbd 0.7 code

This patch removes the last of the md and drbd 0.7 code. Cluster which
have the old device types will be broken if they have this applied.

Reviewed-by: imsnah

ddd9bc04 04/25/2008 03:03 pm Iustin Pop

patch 1/4 extended HVM features for 1.2

This patch extends the config objects with the slots to handle
more HVM configuration items.

Author: schreiberal
Reviewed-by: iustinp,imsnah

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:...

3f752d97 03/25/2008 07:48 pm Manuel Franceschini

Modify Disk.GetNodes() to support LD_FILE

Reviewed-by: iustinp

7c0d6283 03/05/2008 04:39 pm Michael Hanselmann

Codestyle fixes: adding a few empty lines

Reviewed-by: ultrotter

0d9c53bc 01/09/2008 03:02 pm Alexander Schreiber

Add boot_order entry to Instance object.

First step to support custom boot device order for HVM instances, add a
location to actually store that information for the instance.

Reviewed-by: iustinp

2d8c9c2e 01/08/2008 01:02 pm Iustin Pop

Add kernel/initrd paths to the instance object

This patch adds two new attributes to the instance object:
- kernel_path
- object_path

The code ignores them and the configuration handling is not broken by
this addition.

Reviewed-by: imsnah

58acb49d 12/17/2007 04:53 pm Alexander Schreiber

Add instance port support.

Extends the instance object by adding a port item, also adds changes
to print this port via gnt-instance info.

Reviewed-by: iustinp

fc1dc9d7 11/06/2007 07:00 pm Iustin Pop

Allow DRBD8 operation without backing storage

This patch adds the following functionality:
- DRBD8 devices can assemble without local storage (done by allowing
None in the list of children, and making DRBD8 to ignore all
children if any is None)...

222f2dd5 11/06/2007 06:55 pm Iustin Pop

Add a support function to objects.Disk

This patch adds a function returning the device path if it is computable
from the disk object (and we don't need to instantiate a bdev object on
the target node in order to compute this). Only LVs support this.

Reviewed-by: imsnah

d2c807e4 11/05/2007 02:42 am Guido Trotter

Create OS from an InvalidOS error

Add a new FromInvalidOS static function to objects.OS that makes it easy to
create an object representing a broken OS starting from the relevant exception.

Reviewed-By: iustinp

37482e7b 11/05/2007 02:42 am Guido Trotter

Make the OS object able to represent broken OSes

Till now the OS object just represents a correct OS instance. Change it so it
can represent a broken one too, by adding a "status" field: if this field is
different from the OS_VALID_STATUS constant the object is considered to be an...

25a915d0 11/02/2007 03:10 am Iustin Pop

Revision 302 is broken, this fixes it

I forgot a pair of parentheses in that revision which break the common
case. This patch adds them.

Reviewed-by: ultrotter

073ca59e 11/01/2007 11:40 pm Iustin Pop

Fix printing of unconfigured DRBD devices

If the device is unconfigured (not yet did SetDiskID for it ever), it
might have a physical_id of None. This patch fixes that case.

Reviewed-by: ultrotter

65a15336 10/26/2007 01:25 pm Iustin Pop

Add a custom str() method for objects.Disk

This is done in order to easy debugging of disk-related issues.

Reviewed-by: imsnah

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...

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

b60ae2ca 10/08/2007 06:10 pm Iustin Pop

Fix super() calls for objects.Cluster

Reviewed-by: imsnah

d5835922 10/08/2007 01:48 pm Michael Hanselmann

Use indenting if supported by simplejson.

Reviewed-by: iustinp

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...

ff9c047c 09/24/2007 11:41 am Iustin Pop

Implement to/from dict conversion for ConfigObject(s)

This change allows instances of ConfigObject and its children to be
converted to and from standard python types. This will allow easier
upgrade of the configuration and use of any serialization protocol (not...

ec29fe40 09/21/2007 05:59 pm Iustin Pop

Change class hierarchy in objects.py

It makes sense to make the TaggableObject a child of the ConfigObject,
since in this case we can derive the Instance, Node and Cluster objects
only from the TaggableObject and have a cleaner hierarchy.

For consistency child classes will have to declare their slots by adding...

2057f6c7 09/21/2007 03:23 pm Iustin Pop

Add slots on TaggableObject

Unless we use slots on all parents, we don't get the benefits that
slots bring. This patch adds this attribute to the TaggableObject so
that Instances, Nodes and the Clusters behave as intended.

Reviewed-by: schreiberal,imsnah

386b57af 09/17/2007 01:52 pm Iustin Pop

Add support for rename operation in the OS API

This patch adds support for renaming at OS level. Because of this, we
need to bump up the version of the OS api from 4 to 5.

The patch also documents the new script interface in the
ganeti-os-interface(7) man page and adds a section on upgrading the OS...

644eeef9 08/20/2007 03:17 pm Iustin Pop

Add support for listing instance disk sizes.

Reviewed-by: imsnah

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...

5c947f38 08/08/2007 12:37 pm Iustin Pop

Implement tag support for cluster, nodes and instances.

This is only the backend part, from the command line the tags can't be
read/modified yet.

Reviewed-by: imsnah

47c28c5b 08/02/2007 03:51 pm Michael Hanselmann

Implement setitem for ConfigObject to add container protocol compatibility.

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...

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

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

Initial commit.