On Wed, Dec 4, 2013 at 2:50 PM, Santi Raffa <[email protected]> wrote:
> 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: Santi Raffa <[email protected]> > --- > doc/install.rst | 23 +++++++++++++++++++++++ > lib/cmdlib/common.py | 21 ++++++++------------- > lib/config.py | 7 ++++--- > lib/storage/gluster.py | 13 +++++++++++++ > 4 files changed, 48 insertions(+), 16 deletions(-) > > diff --git a/doc/install.rst b/doc/install.rst > index 2b4551a..dd8b38b 100644 > --- a/doc/install.rst > +++ b/doc/install.rst > @@ -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 > +++++++++++++++++++++++ > > diff --git a/lib/cmdlib/common.py b/lib/cmdlib/common.py > index 5a1a017..d31d011 100644 > --- a/lib/cmdlib/common.py > +++ b/lib/cmdlib/common.py > @@ -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, > - constants.DISK_KERNELSPACE) > + for disk_template in parameters: > The check for the disk template is dropped altogether, but the access parameter only makes sense for RBD and Gluster. > + 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, > RBD hardcoded while this might happen for Gluster as well. > - > a=constants.RBD_ACCESS, > + > a=constants.LDP_ACCESS, > v=access, > o=valid_vals_str)) > > @@ -1170,9 +1170,9 @@ def CheckDiskAccessModeConsistency(parameters, cfg, > group=None): > """ > CheckDiskAccessModeValidity(parameters) > > - if constants.DT_RBD in parameters: > - access = parameters[constants.DT_RBD].get(constants.RBD_ACCESS, > - constants.DISK_KERNELSPACE) > + for disk_template in parameters: > Same as above. > + access = parameters[disk_template].get(constants.LDP_ACCESS, > + constants.DISK_KERNELSPACE) > > #Check the combination of instance hypervisor, disk template and > access > #protocol is sane. > @@ -1180,15 +1180,10 @@ def CheckDiskAccessModeConsistency(parameters, > cfg, group=None): > 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. > Why drop this check? > - 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 +1207,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 > > diff --git a/lib/config.py b/lib/config.py > index 5b4b1a3..1d03c4b 100644 > --- a/lib/config.py > +++ b/lib/config.py > @@ -678,12 +678,13 @@ 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: > Again, the check for RBD or Gluster is omitted... > + access = cluster.diskparams[disk_template].get(constants.RBD_ACCESS, > ... and here, RBD_ACCESS is hardcoded. > + > 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.RBD_ACCESS, access, > Again, hardcoded RBD stuff. You might want to figure out if it's OK to substitute those with LDP_ACCESS, but please double-check with Helga if that's OK. AFAIK. LDP_* constants are only used internally when sending stuff via RPC, and RBD_ACCESS (and presumably GLUSTER_ACCESS) should be used for user-facing stuff like OpCodes. Maybe you could simply rename RBD_ACCESS to DIST_STORAGE_ACCESS or the like. > utils.CommaJoin(constants.DISK_VALID_ACCESS_MODES) > ) > ) > diff --git a/lib/storage/gluster.py b/lib/storage/gluster.py > index 2751d4b..26ab201 100644 > --- a/lib/storage/gluster.py > +++ b/lib/storage/gluster.py > @@ -393,6 +393,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): > -- > 1.8.4.1 > > -- Thomas Thrainer | Software Engineer | [email protected] | Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
