- The :doc:`Remote API <rapi>` daemon now supports a command line flag
to always require authentication, ``--require-authentication``. It can
be specified in ``$sysconfdir/default/ganeti``.
+- A new cluster attribute 'enabled_storage_types' is introduced. It will
+ be used to manage the storage types to be used by instances in the cluster.
+ Initially, it will be set to a list that includes lvm, file and sharedfile
+ if those are enabled. Additionally, it will include all storage types that
+ are currently used by instances. The order of storage types will be based
+ on Ganeti's history of supporting them. In the future, the first entry of
+ the list will be used as a default storage type on instance creation.
Version 2.7.0 beta1
HKR_SUCCESS = 2
# Storage types
+ST_BLOCK = "blockdev"
+ST_DISKLESS = "diskless"
+ST_EXT = "ext"
ST_FILE = "file"
ST_LVM_PV = "lvm-pv"
ST_LVM_VG = "lvm-vg"
-ST_DISKLESS = "diskless"
-ST_SHARED_FILE = "sharedfile"
-ST_BLOCK = "blockdev"
ST_RADOS = "rados"
-ST_EXT = "ext"
+ST_SHARED_FILE = "sharedfile"
VALID_STORAGE_TYPES = compat.UniqueFrozenset([
+ ST_BLOCK,
+ ST_DISKLESS,
+ ST_EXT,
ST_FILE,
ST_LVM_PV,
ST_LVM_VG,
- ST_DISKLESS,
- ST_SHARED_FILE,
- ST_BLOCK,
ST_RADOS,
- ST_EXT,
+ ST_SHARED_FILE,
])
# Per default, only lvm is enabled.
ST_LVM_VG,
])
+# This is used to order determine the default storage type when the list
+# of enabled storage types is inferred from the current state of the cluster.
+# This only happens on an upgrade from a version of Ganeti that did not
+# support the 'enabled_storage_methods' so far.
+STORAGE_TYPES_PREFERENCE = [
+ ST_LVM_VG,
+ ST_FILE,
+ ST_SHARED_FILE,
+ ST_RADOS,
+ ST_BLOCK,
+ ]
+
# Storage fields
# first two are valid in LU context only, not passed to backend
SF_NODE = "node"
LDS_FAULTY) = range(1, 4)
# disk template types
+DT_BLOCK = "blockdev"
DT_DISKLESS = "diskless"
-DT_PLAIN = "plain"
DT_DRBD8 = "drbd"
+DT_EXT = "ext"
DT_FILE = "file"
-DT_SHARED_FILE = "sharedfile"
-DT_BLOCK = "blockdev"
+DT_PLAIN = "plain"
DT_RBD = "rbd"
-DT_EXT = "ext"
+DT_SHARED_FILE = "sharedfile"
+
+# mapping of disk templates to storage types
+DISK_TEMPLATES_STORAGE_TYPE = {
+ DT_BLOCK: ST_BLOCK,
+ DT_DISKLESS: ST_DISKLESS,
+ DT_DRBD8: ST_LVM_VG,
+ DT_EXT: ST_EXT,
+ DT_FILE: ST_FILE,
+ DT_PLAIN: ST_LVM_VG,
+ DT_RBD: ST_RADOS,
+ DT_SHARED_FILE: ST_SHARED_FILE,
+ }
# the set of network-mirrored disk templates
DTS_INT_MIRROR = compat.UniqueFrozenset([DT_DRBD8])
self.networks = {}
for network in self.networks.values():
network.UpgradeConfig()
+ self._UpgradeStorageTypes()
+
+ def _UpgradeStorageTypes(self):
+ """Upgrade the cluster's enabled storage types by inspecting the currently
+ enabled and/or used storage types.
+
+ """
+ # enabled_storage_types in the cluster config were introduced in 2.8. Remove
+ # this code once upgrading from earlier versions is deprecated.
+ if not self.cluster.enabled_storage_types:
+ storage_type_set = \
+ set([constants.DISK_TEMPLATES_STORAGE_TYPE[inst.disk_template]
+ for inst in self.instances.values()])
+ # Add lvm, file and shared file storage, if they are enabled, even though
+ # they might currently not be used.
+ if self.cluster.volume_group_name:
+ storage_type_set.add(constants.ST_LVM_VG)
+ # FIXME: Adapt this when dis/enabling at configure time is removed.
+ if constants.ENABLE_FILE_STORAGE:
+ storage_type_set.add(constants.ST_FILE)
+ if constants.ENABLE_SHARED_FILE_STORAGE:
+ storage_type_set.add(constants.ST_SHARED_FILE)
+ # Set enabled_storage_types to the inferred storage types. Order them
+ # according to a preference list that is based on Ganeti's history of
+ # supported storage types.
+ self.cluster.enabled_storage_types = []
+ for preferred_type in constants.STORAGE_TYPES_PREFERENCE:
+ if preferred_type in storage_type_set:
+ self.cluster.enabled_storage_types.append(preferred_type)
+ storage_type_set.remove(preferred_type)
+ self.cluster.enabled_storage_types.extend(list(storage_type_set))
class NIC(ConfigObject):