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.
For more information, please see the `Ceph Docs
<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
+++++++++++++++++++++++
......
......@@ -1142,14 +1142,14 @@ def CheckDiskAccessModeValidity(parameters):
@raise errors.OpPrereqError: if the check fails.
"""
if constants.DT_RBD in parameters:
access = parameters[constants.DT_RBD].get(constants.RBD_ACCESS,
for disk_template in parameters:
access = parameters[disk_template].get(constants.LDP_ACCESS,
constants.DISK_KERNELSPACE)
if access not in 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"
" one of {o})".format(d=constants.DT_RBD,
a=constants.RBD_ACCESS,
" one of {o})".format(d=disk_template,
a=constants.LDP_ACCESS,
v=access,
o=valid_vals_str))
......@@ -1170,25 +1170,23 @@ def CheckDiskAccessModeConsistency(parameters, cfg, group=None):
"""
CheckDiskAccessModeValidity(parameters)
if constants.DT_RBD in parameters:
access = parameters[constants.DT_RBD].get(constants.RBD_ACCESS,
for disk_template in parameters:
access = parameters[disk_template].get(constants.LDP_ACCESS,
constants.DISK_KERNELSPACE)
if dt not in constants.DTS_HAVE_ACCESS
continue
#Check the combination of instance hypervisor, disk template and access
#protocol is sane.
inst_uuids = cfg.GetNodeGroupInstances(group) if group else \
cfg.GetInstanceList()
for entry in inst_uuids:
#hyp, disk, access
inst = cfg.GetInstanceInfo(entry)
hv = inst.hypervisor
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):
raise errors.OpPrereqError("Instance {i}: cannot use '{a}' access"
" setting with {h} hypervisor and {d} disk"
......@@ -1212,7 +1210,7 @@ def IsValidDiskAccessModeCombination(hv, disk_template, mode):
return True
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):
return True
......
......@@ -678,12 +678,16 @@ class ConfigWriter(object):
constants.NDS_PARAMETER_TYPES)
_helper_ipolicy("cluster", cluster.ipolicy, True)
if constants.DT_RBD in cluster.diskparams:
access = cluster.diskparams[constants.DT_RBD][constants.RBD_ACCESS]
for disk_template in cluster.diskparams:
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:
result.append(
"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)
)
)
......
......@@ -402,6 +402,19 @@ class GlusterStorage(base.BlockDev):
"""
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
def Create(cls, unique_id, children, size, spindles, params, excl_stor,
dyn_params):
......
......@@ -896,6 +896,11 @@ dtsBlock =
dtsLvm :: FrozenSet String
dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm
-- | The set of lvm-based disk templates
dtsHaveAccess :: FrozenSet String
dtsHaveAccess = ConstantUtils.mkSet $
map Types.diskTemplateToRaw [DTRbd, DTGluster]
-- * Drbd
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