Hello team, This patch series turns disks into top-level config objects, as described in the corresponding design doc. The 'disks' slot of an Instance object now contains a list of UUIDs, attached to the Instance and not the actual disk objects as happend until now. The Disk object can now be retrieved from the config using the function 'GetDiskInfo' and the Disk objects of an Instance can be retrieved using the helper function 'GetInstanceDisks' (a wrapper over 'GetDiskInfo'). Furthermore, disks are added/removed to/from the config file using the functions 'AddDisk' and 'RemoveDisk' respectively, and are attached/detached to/from an instance using the functions 'AttachInstDisk'/'DetachInstDisk'. Since Ganeti currently doesn't allow for a Disk object to stand detached, we have added some helper functions to add a disk to the config file and attach it to the instance at the same time, and extended 'VerifyConfig' to check that there are no dangling disks.
The Haskell codebase has been updated accordingly to treat Disks as separate config objects. The last patch updates the 'cfgupgrade' script to allow upgrading/downgrading between version. Ilias Tsitsimpis (21): Add disks entry to config.data Add 'all_nodes' property to disk objects Add timestamp/serial_no slot to disk objects Add 'GetInstanceNodes' to config Add 'GetInstanceLVsByNode' to config Fix '_create_instance' in config_unittest Change TestInstance in objects unittest Override disks in BuildInstanceHookEnvByObject Get instance secondary nodes from config Get instance's nodes from config Get MapLVsByNode from config Add methods to config to get disks Add a disk to an instance in config Remove a disk from an instance in config Fix a 'map' application in ImageDisks Add 'disks_info' Instance slot Implement getDisks in Confd Use 'getInstDisks' function to retrieve the Lift the Disk objects from the Instances Fix the broken unittests Upgrade config to support top-level citizen Makefile.am | 2 +- lib/backend.py | 14 +- lib/bootstrap.py | 1 + lib/cmdlib/backup.py | 12 +- lib/cmdlib/base.py | 2 +- lib/cmdlib/cluster.py | 48 ++++--- lib/cmdlib/common.py | 22 +-- lib/cmdlib/group.py | 17 ++- lib/cmdlib/instance.py | 168 ++++++++++++++-------- lib/cmdlib/instance_migration.py | 37 +++-- lib/cmdlib/instance_operation.py | 18 ++- lib/cmdlib/instance_query.py | 10 +- lib/cmdlib/instance_storage.py | 133 ++++++++++------- lib/cmdlib/instance_utils.py | 29 +++- lib/cmdlib/node.py | 15 +- lib/cmdlib/test.py | 3 +- lib/config.py | 412 ++++++++++++++++++++++++++++++++++++++++++++--------- lib/masterd/iallocator.py | 12 +- lib/masterd/instance.py | 9 +- lib/objects.py | 150 ++++++------------- lib/rpc/node.py | 4 +- src/Ganeti/Confd/ClientFunctions.hs | 45 ++++-- src/Ganeti/Confd/Server.hs | 13 +- src/Ganeti/Confd/Types.hs | 1 + src/Ganeti/Config.hs | 53 +++++-- src/Ganeti/Constants.hs | 3 + src/Ganeti/DataCollectors/InstStatus.hs | 2 +- src/Ganeti/DataCollectors/Lv.hs | 45 +++--- src/Ganeti/Objects.hs | 24 ++-- src/Ganeti/Query/Common.hs | 11 ++ src/Ganeti/Query/Instance.hs | 92 +++++++++--- test/data/instance-disks.txt | 88 ++++++++++++ test/data/instance-prim-sec.txt | 79 ---------- test/hs/Test/Ganeti/Objects.hs | 26 ++-- test/hs/shelltests/htools-mon-collector.test | 2 +- test/py/cfgupgrade_unittest.py | 1 + test/py/cmdlib/cluster_unittest.py | 16 ++- test/py/cmdlib/cmdlib_unittest.py | 14 +- test/py/cmdlib/instance_unittest.py | 72 ++++++---- test/py/cmdlib/testsupport/config_mock.py | 7 +- test/py/ganeti.config_unittest.py | 104 +++++++++++++- test/py/ganeti.objects_unittest.py | 50 +------ test/py/ganeti.query_unittest.py | 9 ++ test/py/ganeti.rpc_unittest.py | 37 +++-- tools/cfgupgrade | 80 +++++++++-- 45 files changed, 1331 insertions(+), 661 deletions(-)
