Hi,
So there a design problem we need to address before I can continue
reviewing your patch series. This patch series adds several methods
to the configuration, such as,
def _UnlockedGetInstanceNodes(self, instance, disks=None):
def GetInstanceNodes(self, instance, disks=None):
def _UnlockedGetInstanceSecondaryNodes(self, instance):
def GetInstanceSecondaryNodes(self, instance):
def _UnlockedGetInstanceLVsByNode(self, instance, lvmap=None):
def _MapLVsByNode(lvmap, devs, node_uuid):
def GetInstanceLVsByNode(self, instance, lvmap=None):
def GetInstanceSecondaryNodes(self, _):
def CheckAssignmentForSplitInstances(self, changes, node_data, instance_data):
def GetInstanceNodes(self, instance):
def MapInstanceLvsToNodes(cfg, instances):
def _UnlockedGetInstanceDisks(self, instance):
def GetInstanceDisks(self, instance):
def _UpdateIvNames(base_index, disks):
def _UnlockedAddDisk(self, disk):
def _UnlockedAttachInstDisk(self, instance, disk, idx=None):
def AddInstDisk(self, instance, disk, idx=None):
def _UnlockedDetachInstDisk(self, instance, disk):
def _UnlockedRemoveDisk(self, disk_uuid):
def ExpandCheckDisks(instance_disks, disks):
This list (which might be incomplete) contains new config methods.
These are currently receiving the 'instance' and 'disk' objects. This
is not the intended design, which instead uses UUIDs. That means,
these methods should receive instances' uuids and the disks' uuids.
You can follow the example of the remaining methods. That means also
that from the UUID you ask the configuration for the latest config
object. This change is very important for the refactorings Ganeti is
currently undergoing.
This also makes lines like the following unnecessary
# Update instance object
self._ConfigData().instances[instance.uuid] = instance
Given that you will be looking into this again, I also ask you to make
other changes, namely, put the main method documentation in the
unlocked version of the method and in the locked version of the method
use the comment "This is just a wrapper over L{...}", which you can
find throughout the config. Also, replace things like 'Inst' with
'Instance'. We are not using abbreviations in the rest of the config.
Please make these changes and resubmit the affected patches once again.
Thanks,
Jose
On Apr 14 14:29, Ilias Tsitsimpis wrote:
> 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(-)
>
--
Jose Antonio Lopes
Ganeti Engineering
Google Germany GmbH
Dienerstr. 12, 80331, München
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores
Steuernummer: 48/725/00206
Umsatzsteueridentifikationsnummer: DE813741370