Commit 8a147bba authored by René Nussbaumer's avatar René Nussbaumer
Browse files

config: Adding convenience method for disk parameters

Signed-off-by: default avatarRené Nussbaumer <>
Reviewed-by: default avatarIustin Pop <>
parent 57987785
......@@ -231,6 +231,19 @@ class ConfigWriter:
nodegroup = self._UnlockedGetNodeGroup(
return self._config_data.cluster.FillND(node, nodegroup)
@locking.ssynchronized(_config_lock, shared=1)
def GetInstanceDiskParams(self, instance):
"""Get the disk params populated with inherit chain.
@type instance: L{objects.Instance}
@param instance: The instance we want to know the params for
@return: A dict with the filled in disk params
node = self._UnlockedGetNodeInfo(instance.primary_node)
nodegroup = self._UnlockedGetNodeGroup(
return self._config_data.cluster.SimpleFillDP(nodegroup.diskparams)
@locking.ssynchronized(_config_lock, shared=1)
def GenerateMAC(self, ec_id):
"""Generate a MAC for an instance.
......@@ -1610,6 +1610,15 @@ class Cluster(TaggableObject):
obj.tcpudp_port_pool = set(obj.tcpudp_port_pool)
return obj
def SimpleFillDP(self, diskparams):
"""Fill a given diskparams dict with cluster defaults.
@param diskparams: The diskparams
@return: The defaults dict
return FillDiskParams(self.diskparams, diskparams)
def GetHVDefaults(self, hypervisor, os_name=None, skip_keys=None):
"""Get the default hypervisor parameters for the cluster.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment