Skip to content

Commit

Permalink
Merge "GlusterFS: Synchronize operations that manipulate qcow2 data"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Nov 22, 2013
2 parents 034a360 + 8a1fd88 commit a106f68
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cinder/volume/drivers/glusterfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
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__)
Expand Down Expand Up @@ -62,6 +63,10 @@
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'
Expand Down Expand Up @@ -187,6 +192,7 @@ def create_cloned_volume(self, volume, src_vref):

return {'provider_location': src_vref['provider_location']}

@utils.synchronized('glusterfs', external=False)
def create_volume(self, volume):
"""Creates a volume."""

Expand Down Expand Up @@ -259,6 +265,7 @@ def _copy_volume_from_snapshot(self, snapshot, volume, volume_size):
path_to_new_vol,
out_format)

@utils.synchronized('glusterfs', external=False)
def delete_volume(self, volume):
"""Deletes a logical volume."""

Expand All @@ -273,6 +280,7 @@ def delete_volume(self, volume):

self._execute('rm', '-f', mounted_path, run_as_root=True)

@utils.synchronized('glusterfs', external=False)
def create_snapshot(self, snapshot):
"""Create a snapshot.
Expand Down Expand Up @@ -525,6 +533,7 @@ def _get_matching_backing_file(self, backing_chain, snapshot_file):
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.
Expand Down Expand Up @@ -833,6 +842,7 @@ def remove_export(self, ctx, volume):
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."""

Expand Down Expand Up @@ -905,6 +915,7 @@ def copy_volume_to_image(self, context, volume, image_service, image_meta):
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)
Expand Down

0 comments on commit a106f68

Please sign in to comment.