Commit 52a8a6ae authored by Helga Velroyen's avatar Helga Velroyen
Browse files

Fix propagation of storage parameters to/from backend

This patch fixes two problems with the storage reporting
that showed up in the QA for exclusive storage:

- The processing of storage space information for instance
  operations wrongly assumed that the volume group's
  storage information is always the first in the list.
- The storage parameter 'exclusive storage' was not
  correctly extracted from the list of storage parameters.
- There was a bug in the preparation of storage unit for
  the node info call in the iallocator. The exclusive
  storage flag was not set for spindles and the format
  of the storage parameters for LVM vgs was a boolean
  and not a list.
Signed-off-by: default avatarHelga Velroyen <>
Reviewed-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarMichele Tartara <>
parent 109a21b1
......@@ -573,6 +573,29 @@ def LeaveCluster(modify_ssh_setup):
raise errors.QuitGanetiException(True, "Shutdown scheduled")
def _GetLvmVgSpaceInfo(name, params):
"""Wrapper around C{_GetVgInfo} which checks the storage parameters.
@type name: string
@param name: name of the volume group
@type params: list
@param params: list of storage parameters, which in this case should be
containing only one for exclusive storage
if params is None:
raise errors.ProgrammerError("No storage parameter for LVM vg storage"
" reporting is provided.")
if not isinstance(params, list):
raise errors.ProgrammerError("The storage parameters are not of type"
" list: '%s'" % params)
if not len(params) == 1:
raise errors.ProgrammerError("Received more than one storage parameter:"
" '%s'" % params)
excl_stor = bool(params[0])
return _GetVgInfo(name, excl_stor)
def _GetVgInfo(name, excl_stor):
"""Retrieves information about a LVM volume group.
......@@ -714,7 +737,7 @@ _STORAGE_TYPE_INFO_FN = {
constants.ST_EXT: None,
constants.ST_FILE: _GetFileStorageSpaceInfo,
constants.ST_LVM_PV: _GetVgSpindlesInfo,
constants.ST_LVM_VG: _GetVgInfo,
constants.ST_LVM_VG: _GetLvmVgSpaceInfo,
constants.ST_RADOS: None,
......@@ -905,8 +905,12 @@ def _CheckNodesFreeDiskOnVG(lu, node_uuids, vg, requested):
info = nodeinfo[node]
info.Raise("Cannot get current information from node %s" % node_name,
prereq=True, ecode=errors.ECODE_ENVIRON)
(_, (vg_info, ), _) = info.payload
vg_free = vg_info.get("storage_free", None)
(_, space_info, _) = info.payload
lvm_vg_info =
space_info, constants.ST_LVM_VG)
if not lvm_vg_info:
raise errors.OpPrereqError("Can't retrieve storage information for LVM")
vg_free = lvm_vg_info.get("storage_free", None)
if not isinstance(vg_free, int):
raise errors.OpPrereqError("Can't compute free disk space on node"
" %s for vg %s, result was '%s'" %
......@@ -730,8 +730,8 @@ def _AddExclusiveStorageFlagToLvmStorageUnits(storage_units, es_flag):
result = []
for (storage_type, storage_key) in storage_units:
if storage_type == constants.ST_LVM_VG:
result.append((storage_type, storage_key, es_flag))
if storage_type in [constants.ST_LVM_VG, constants.ST_LVM_PV]:
result.append((storage_type, storage_key, [es_flag]))
result.append((storage_type, storage_key, []))
return result
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