Skip to content

Commit

Permalink
Merge "Fix cache lock for image not consistent"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Feb 28, 2014
2 parents 8311578 + d48dd03 commit 84b616d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions nova/virt/libvirt/imagebackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ def correct_format(self):
self.driver_format = data.file_format or 'raw'

def create_image(self, prepare_template, base, size, *args, **kwargs):
@utils.synchronized(base, external=True, lock_path=self.lock_path)
filename = os.path.split(base)[-1]

@utils.synchronized(filename, external=True, lock_path=self.lock_path)
def copy_raw_image(base, target, size):
libvirt_utils.copy_image(base, target)
if size:
Expand Down Expand Up @@ -293,7 +295,9 @@ def __init__(self, instance=None, disk_name=None, path=None):
self.preallocate = CONF.preallocate_images != 'none'

def create_image(self, prepare_template, base, size, *args, **kwargs):
@utils.synchronized(base, external=True, lock_path=self.lock_path)
filename = os.path.split(base)[-1]

@utils.synchronized(filename, external=True, lock_path=self.lock_path)
def copy_qcow2_image(base, target, size):
# TODO(pbrady): Consider copying the cow image here
# with preallocation=metadata set for performance reasons.
Expand Down Expand Up @@ -374,7 +378,9 @@ def _can_fallocate(self):
return False

def create_image(self, prepare_template, base, size, *args, **kwargs):
@utils.synchronized(base, external=True, lock_path=self.lock_path)
filename = os.path.split(base)[-1]

@utils.synchronized(filename, external=True, lock_path=self.lock_path)
def create_lvm_image(base, size):
base_size = disk.get_disk_size(base)
self.verify_base_size(base, size, base_size=base_size)
Expand Down

0 comments on commit 84b616d

Please sign in to comment.