[openstack-cinder/f20: 1/2] Synchronize GlusterFS volume driver operations

Eric Harney eharney at fedoraproject.org
Mon Nov 25 16:49:56 UTC 2013


commit 93a567630a1a609edcc0b88b784604f213bb2106
Author: Eric Harney <eharney at redhat.com>
Date:   Mon Nov 25 11:32:02 2013 -0500

    Synchronize GlusterFS volume driver operations
    
    Updated patches from master-patches

 ...ynchronize-operations-that-manipulate-qco.patch |   95 ++++++++++++++++++++
 openstack-cinder.spec                              |    7 ++-
 2 files changed, 101 insertions(+), 1 deletions(-)
---
diff --git a/0005-GlusterFS-Synchronize-operations-that-manipulate-qco.patch b/0005-GlusterFS-Synchronize-operations-that-manipulate-qco.patch
new file mode 100644
index 0000000..34f6b7b
--- /dev/null
+++ b/0005-GlusterFS-Synchronize-operations-that-manipulate-qco.patch
@@ -0,0 +1,95 @@
+From 25fdaf9a7f109b8a3c2829e5d28dfe4124065d67 Mon Sep 17 00:00:00 2001
+From: Eric Harney <eharney at redhat.com>
+Date: Thu, 14 Nov 2013 15:51:15 -0500
+Subject: [PATCH] GlusterFS: Synchronize operations that manipulate qcow2 data
+
+Operations that modify qcow2 chains or the GlusterFS driver's
+snapshot info file should use locking so that more than one thread
+cannot run these operations at the same time.
+
+Without this it is possible for multiple threads to concurrently
+modify snapshot information resulting in an incomplete snapshot
+chain.
+
+Closes LP Bug: #1251425
+Resolves: rhbz 1021966
+Upstream-Havana: https://review.openstack.org/#/c/57943/
+Upstream-Icehouse: https://review.openstack.org/#/c/56462/
+
+Change-Id: I93c6ffecd9aec38560cb19085243390b9120b363
+(cherry picked from commit 8a1fd8889170c289910944db016a4206fe5e1e32)
+---
+ cinder/volume/drivers/glusterfs.py | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/cinder/volume/drivers/glusterfs.py b/cinder/volume/drivers/glusterfs.py
+index 0987be0..7f7497c 100644
+--- a/cinder/volume/drivers/glusterfs.py
++++ b/cinder/volume/drivers/glusterfs.py
+@@ -30,6 +30,7 @@ from cinder import exception
+ from cinder.image import image_utils
+ from cinder.openstack.common import log as logging
+ from cinder import units
++from cinder import utils
+ from cinder.volume.drivers import nfs
+ 
+ LOG = logging.getLogger(__name__)
+@@ -62,6 +63,10 @@ CONF.import_opt('volume_name_template', 'cinder.db')
+ class GlusterfsDriver(nfs.RemoteFsDriver):
+     """Gluster based cinder driver. Creates file on Gluster share for using it
+     as block device on hypervisor.
++
++    Operations such as create/delete/extend volume/snapshot use locking on a
++    per-process basis to prevent multiple threads from modifying qcow2 chains
++    or the snapshot .info file simultaneously.
+     """
+ 
+     driver_volume_type = 'glusterfs'
+@@ -187,6 +192,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
+ 
+         return {'provider_location': src_vref['provider_location']}
+ 
++    @utils.synchronized('glusterfs', external=False)
+     def create_volume(self, volume):
+         """Creates a volume."""
+ 
+@@ -259,6 +265,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
+                                   path_to_new_vol,
+                                   out_format)
+ 
++    @utils.synchronized('glusterfs', external=False)
+     def delete_volume(self, volume):
+         """Deletes a logical volume."""
+ 
+@@ -273,6 +280,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
+ 
+         self._execute('rm', '-f', mounted_path, run_as_root=True)
+ 
++    @utils.synchronized('glusterfs', external=False)
+     def create_snapshot(self, snapshot):
+         """Create a snapshot.
+ 
+@@ -525,6 +533,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
+         return next(f for f in backing_chain
+                     if f.get('backing-filename', '') == snapshot_file)
+ 
++    @utils.synchronized('glusterfs', external=False)
+     def delete_snapshot(self, snapshot):
+         """Delete a snapshot.
+ 
+@@ -833,6 +842,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
+     def validate_connector(self, connector):
+         pass
+ 
++    @utils.synchronized('glusterfs', external=False)
+     def initialize_connection(self, volume, connector):
+         """Allow connection to connector and return connection info."""
+ 
+@@ -905,6 +915,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
+             if temp_path is not None:
+                 self._execute('rm', '-f', temp_path)
+ 
++    @utils.synchronized('glusterfs', external=False)
+     def extend_volume(self, volume, size_gb):
+         volume_path = self.local_path(volume)
+         volume_filename = os.path.basename(volume_path)
diff --git a/openstack-cinder.spec b/openstack-cinder.spec
index a8f230d..9bb0031 100644
--- a/openstack-cinder.spec
+++ b/openstack-cinder.spec
@@ -2,7 +2,7 @@
 
 Name:             openstack-cinder
 Version:          2013.2
-Release:          2%{?dist}
+Release:          3%{?dist}
 Summary:          OpenStack Volume service
 
 Group:            Applications/System
@@ -27,6 +27,7 @@ Patch0001: 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
 Patch0002: 0002-Remove-runtime-dep-on-python-pbr-python-d2to1.patch
 Patch0003: 0003-Revert-Use-oslo.sphinx-and-remove-local-copy-of-doc-.patch
 Patch0004: 0004-GlusterFS-set-correct-filename-when-cloning-volume.patch
+Patch0005: 0005-GlusterFS-Synchronize-operations-that-manipulate-qco.patch
 
 BuildArch:        noarch
 BuildRequires:    intltool
@@ -139,6 +140,7 @@ This package contains documentation files for cinder.
 %patch0002 -p1
 %patch0003 -p1
 %patch0004 -p1
+%patch0005 -p1
 
 find . \( -name .gitignore -o -name .placeholder \) -delete
 
@@ -297,6 +299,9 @@ fi
 %endif
 
 %changelog
+* Mon Nov 25 2013 Eric Harney <eharney at redhat.com> - 2013.2-3
+- Synchronize GlusterFS volume operations
+
 * Mon Oct 28 2013 Eric Harney <eharney at redhat.com> - 2013.2-2
 - Fix GlusterFS volume driver clone operations
 


More information about the scm-commits mailing list