Introduced flag base_dir_name. Fixes bug 973194
rebased from master. If user faces locking related problem when two nova-compute hosts sharing same disk area via nfs, try to download same image into cache concurrently - Then base_dir_name can be set to "_base_$my_ip" in nova.conf Default value for base_dir_name is "_base" thus retaining existing behavior. Change-Id: Icff10ed75ba83f7256731614dc9e01e578b347a4
This commit is contained in:
1
Authors
1
Authors
@@ -124,6 +124,7 @@ Likitha Shetty <likitha.shetty@citrix.com>
|
||||
Loganathan Parthipan <parthipan@hp.com>
|
||||
Lorin Hochstein <lorin@nimbisservices.com>
|
||||
Lvov Maxim <usrleon@gmail.com>
|
||||
Mandar Vaze <mandar.vaze@vertex.co.in>
|
||||
Mandell Degerness <mdegerne@gmail.com>
|
||||
Mandar Vaze <mandar.vaze@vertex.co.in>
|
||||
Mark McClain <mark.mcclain@dreamhost.com>
|
||||
|
||||
@@ -36,6 +36,7 @@ from nova.virt.libvirt import utils as virtutils
|
||||
|
||||
|
||||
flags.DECLARE('instances_path', 'nova.compute.manager')
|
||||
flags.DECLARE('base_dir_name', 'nova.compute.manager')
|
||||
FLAGS = flags.FLAGS
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
@@ -155,7 +156,7 @@ class ImageCacheManagerTestCase(test.TestCase):
|
||||
self.stubs.Set(virtutils, 'get_disk_backing_file',
|
||||
lambda x: 'e97222e91fc4241f49a7f520d1dcf446751129b3_sm')
|
||||
|
||||
found = os.path.join(FLAGS.instances_path, '_base',
|
||||
found = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name,
|
||||
'e97222e91fc4241f49a7f520d1dcf446751129b3_sm')
|
||||
|
||||
image_cache_manager = imagecache.ImageCacheManager()
|
||||
@@ -177,7 +178,7 @@ class ImageCacheManagerTestCase(test.TestCase):
|
||||
lambda x: ('e97222e91fc4241f49a7f520d1dcf446751129b3_'
|
||||
'10737418240'))
|
||||
|
||||
found = os.path.join(FLAGS.instances_path, '_base',
|
||||
found = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name,
|
||||
'e97222e91fc4241f49a7f520d1dcf446751129b3_'
|
||||
'10737418240')
|
||||
|
||||
@@ -198,7 +199,7 @@ class ImageCacheManagerTestCase(test.TestCase):
|
||||
self.stubs.Set(virtutils, 'get_disk_backing_file',
|
||||
lambda x: 'e97222e91fc4241f49a7f520d1dcf446751129b3_sm')
|
||||
|
||||
found = os.path.join(FLAGS.instances_path, '_base',
|
||||
found = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name,
|
||||
'e97222e91fc4241f49a7f520d1dcf446751129b3_sm')
|
||||
|
||||
image_cache_manager = imagecache.ImageCacheManager()
|
||||
@@ -521,6 +522,7 @@ class ImageCacheManagerTestCase(test.TestCase):
|
||||
hashed_42 = '92cfceb39d57d914ed8b14d0e37643de0797ae56'
|
||||
|
||||
self.flags(instances_path='/instance_path')
|
||||
self.flags(base_dir_name='_base')
|
||||
self.flags(remove_unused_base_images=True)
|
||||
|
||||
base_file_list = ['00000001',
|
||||
|
||||
@@ -325,7 +325,7 @@ class CacheConcurrencyTestCase(test.TestCase):
|
||||
self.flags(instances_path='nova.compute.manager')
|
||||
|
||||
def fake_exists(fname):
|
||||
basedir = os.path.join(FLAGS.instances_path, '_base')
|
||||
basedir = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name)
|
||||
if fname == basedir:
|
||||
return True
|
||||
return False
|
||||
@@ -1393,9 +1393,10 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
|
||||
path = os.path.join(FLAGS.instances_path, '_base')
|
||||
path = os.path.join(FLAGS.instances_path, FLAGS.base_dir_name)
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(os.path.join(FLAGS.instances_path, '_base'))
|
||||
shutil.rmtree(os.path.join(FLAGS.instances_path,
|
||||
FLAGS.base_dir_name))
|
||||
|
||||
def test_get_host_ip_addr(self):
|
||||
conn = connection.LibvirtConnection(False)
|
||||
|
||||
Reference in New Issue
Block a user