Commit 6488e5bc authored by Santi Raffa's avatar Santi Raffa Committed by Thomas Thrainer
Browse files

Gluster: add userspace access support



Add support for the QEMU gluster: protocol. Also change the access
mode routines so they check the access parameter for all templates.
Signed-off-by: default avatarSanti Raffa <rsanti@google.com>
Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent 845b7ed1
...@@ -418,6 +418,29 @@ only need to specify the IP addresses of the RADOS Cluster monitors. ...@@ -418,6 +418,29 @@ only need to specify the IP addresses of the RADOS Cluster monitors.
For more information, please see the `Ceph Docs For more information, please see the `Ceph Docs
<http://ceph.newdream.net/docs/latest/>`_ <http://ceph.newdream.net/docs/latest/>`_
Installing Gluster
++++++++++++++++++
For Gluster integration, Ganeti requires that ``mount.glusterfs`` is
installed on each and every node. On Debian Wheezy and newer, you can
satisfy this requirement with the ``glusterfs-client`` package; see
`this guide
<http://gluster.org/community/documentation/index.php/Gluster_3.2:_Installing_the_Gluster_Native_Client>`_
for details.
KVM userspace access
~~~~~~~~~~~~~~~~~~~~
If your cluster uses a sufficiently new version of KVM (you will need at
least QEMU 1.3 with Gluster support compiled in), you can take advantage
of KVM's native support for gluster in order to have better performance
and avoid potential deadlocks in low memory scenarios.
Please be aware that QEMU 1.3 was released in December 3, 2012, and as
such this feature is not available out of the box in any distribution
older than Ubuntu 13.04; this excludes Ubuntu 12.04 LTS and Debian
Wheezy.
Other required software Other required software
+++++++++++++++++++++++ +++++++++++++++++++++++
......
...@@ -1142,14 +1142,14 @@ def CheckDiskAccessModeValidity(parameters): ...@@ -1142,14 +1142,14 @@ def CheckDiskAccessModeValidity(parameters):
@raise errors.OpPrereqError: if the check fails. @raise errors.OpPrereqError: if the check fails.
""" """
if constants.DT_RBD in parameters: for disk_template in parameters:
access = parameters[constants.DT_RBD].get(constants.RBD_ACCESS, access = parameters[disk_template].get(constants.LDP_ACCESS,
constants.DISK_KERNELSPACE) constants.DISK_KERNELSPACE)
if access not in constants.DISK_VALID_ACCESS_MODES: if access not in constants.DISK_VALID_ACCESS_MODES:
valid_vals_str = utils.CommaJoin(constants.DISK_VALID_ACCESS_MODES) valid_vals_str = utils.CommaJoin(constants.DISK_VALID_ACCESS_MODES)
raise errors.OpPrereqError("Invalid value of '{d}:{a}': '{v}' (expected" raise errors.OpPrereqError("Invalid value of '{d}:{a}': '{v}' (expected"
" one of {o})".format(d=constants.DT_RBD, " one of {o})".format(d=disk_template,
a=constants.RBD_ACCESS, a=constants.LDP_ACCESS,
v=access, v=access,
o=valid_vals_str)) o=valid_vals_str))
...@@ -1170,9 +1170,12 @@ def CheckDiskAccessModeConsistency(parameters, cfg, group=None): ...@@ -1170,9 +1170,12 @@ def CheckDiskAccessModeConsistency(parameters, cfg, group=None):
""" """
CheckDiskAccessModeValidity(parameters) CheckDiskAccessModeValidity(parameters)
if constants.DT_RBD in parameters: for disk_template in parameters:
access = parameters[constants.DT_RBD].get(constants.RBD_ACCESS, access = parameters[disk_template].get(constants.LDP_ACCESS,
constants.DISK_KERNELSPACE) constants.DISK_KERNELSPACE)
if dt not in constants.DTS_HAVE_ACCESS
continue
#Check the combination of instance hypervisor, disk template and access #Check the combination of instance hypervisor, disk template and access
#protocol is sane. #protocol is sane.
...@@ -1180,15 +1183,10 @@ def CheckDiskAccessModeConsistency(parameters, cfg, group=None): ...@@ -1180,15 +1183,10 @@ def CheckDiskAccessModeConsistency(parameters, cfg, group=None):
cfg.GetInstanceList() cfg.GetInstanceList()
for entry in inst_uuids: for entry in inst_uuids:
#hyp, disk, access
inst = cfg.GetInstanceInfo(entry) inst = cfg.GetInstanceInfo(entry)
hv = inst.hypervisor hv = inst.hypervisor
dt = inst.disk_template dt = inst.disk_template
#do not check for disk types that don't have this setting.
if dt != constants.DT_RBD:
continue
if not IsValidDiskAccessModeCombination(hv, dt, access): if not IsValidDiskAccessModeCombination(hv, dt, access):
raise errors.OpPrereqError("Instance {i}: cannot use '{a}' access" raise errors.OpPrereqError("Instance {i}: cannot use '{a}' access"
" setting with {h} hypervisor and {d} disk" " setting with {h} hypervisor and {d} disk"
...@@ -1212,7 +1210,7 @@ def IsValidDiskAccessModeCombination(hv, disk_template, mode): ...@@ -1212,7 +1210,7 @@ def IsValidDiskAccessModeCombination(hv, disk_template, mode):
return True return True
if (hv == constants.HT_KVM and if (hv == constants.HT_KVM and
disk_template == constants.DT_RBD and disk_template in (constants.DT_RBD, constants.DT_GLUSTER) and
mode == constants.DISK_USERSPACE): mode == constants.DISK_USERSPACE):
return True return True
......
...@@ -678,12 +678,16 @@ class ConfigWriter(object): ...@@ -678,12 +678,16 @@ class ConfigWriter(object):
constants.NDS_PARAMETER_TYPES) constants.NDS_PARAMETER_TYPES)
_helper_ipolicy("cluster", cluster.ipolicy, True) _helper_ipolicy("cluster", cluster.ipolicy, True)
if constants.DT_RBD in cluster.diskparams: for disk_template in cluster.diskparams:
access = cluster.diskparams[constants.DT_RBD][constants.RBD_ACCESS] if disk_template not in constants.DTS_HAVE_ACCESS:
continue
access = cluster.diskparams[disk_template].get(constants.LDP_ACCESS,
constants.DISK_KERNELSPACE)
if access not in constants.DISK_VALID_ACCESS_MODES: if access not in constants.DISK_VALID_ACCESS_MODES:
result.append( result.append(
"Invalid value of '%s:%s': '%s' (expected one of %s)" % ( "Invalid value of '%s:%s': '%s' (expected one of %s)" % (
constants.DT_RBD, constants.RBD_ACCESS, access, disk_template, constants.LDP_ACCESS, access,
utils.CommaJoin(constants.DISK_VALID_ACCESS_MODES) utils.CommaJoin(constants.DISK_VALID_ACCESS_MODES)
) )
) )
......
...@@ -402,6 +402,19 @@ class GlusterStorage(base.BlockDev): ...@@ -402,6 +402,19 @@ class GlusterStorage(base.BlockDev):
""" """
return self.file.Size() return self.file.Size()
def GetUserspaceAccessUri(self, hypervisor):
"""Generate KVM userspace URIs to be used as `-drive file` settings.
@see: L{BlockDev.GetUserspaceAccessUri}
@see: https://github.com/qemu/qemu/commit/8d6d89cb63c57569864ecdeb84d3a1c2eb
"""
if hypervisor == constants.HT_KVM:
return self.volume.GetKVMMountString(self.path)
else:
base.ThrowError("Hypervisor %s doesn't support Gluster userspace access" %
hypervisor)
@classmethod @classmethod
def Create(cls, unique_id, children, size, spindles, params, excl_stor, def Create(cls, unique_id, children, size, spindles, params, excl_stor,
dyn_params): dyn_params):
......
...@@ -896,6 +896,11 @@ dtsBlock = ...@@ -896,6 +896,11 @@ dtsBlock =
dtsLvm :: FrozenSet String dtsLvm :: FrozenSet String
dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm
-- | The set of lvm-based disk templates
dtsHaveAccess :: FrozenSet String
dtsHaveAccess = ConstantUtils.mkSet $
map Types.diskTemplateToRaw [DTRbd, DTGluster]
-- * Drbd -- * Drbd
drbdHmacAlg :: String drbdHmacAlg :: String
......
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