Volume_ID identifier needed a return in the property. Also looking for race conditions in the destructor.
This commit is contained in:
parent
2b09635a38
commit
15646df512
@ -68,11 +68,17 @@ class StorageTestCase(test.TrialTestCase):
|
|||||||
project_id = 'fake'
|
project_id = 'fake'
|
||||||
num_shelves = FLAGS.last_shelf_id - FLAGS.first_shelf_id + 1
|
num_shelves = FLAGS.last_shelf_id - FLAGS.first_shelf_id + 1
|
||||||
total_slots = FLAGS.slots_per_shelf * num_shelves
|
total_slots = FLAGS.slots_per_shelf * num_shelves
|
||||||
|
vols = []
|
||||||
for i in xrange(total_slots):
|
for i in xrange(total_slots):
|
||||||
self.mystorage.create_volume(vol_size, user_id, project_id)
|
vid = self.mystorage.create_volume(vol_size, user_id, project_id)
|
||||||
|
print vid
|
||||||
|
vols.append(vid)
|
||||||
self.assertRaises(storage.NoMoreVolumes,
|
self.assertRaises(storage.NoMoreVolumes,
|
||||||
self.mystorage.create_volume,
|
self.mystorage.create_volume,
|
||||||
vol_size, user_id, project_id)
|
vol_size, user_id, project_id)
|
||||||
|
for id in vols:
|
||||||
|
print id
|
||||||
|
self.mystorage.delete_volume(id)
|
||||||
|
|
||||||
def test_run_attach_detach_volume(self):
|
def test_run_attach_detach_volume(self):
|
||||||
# Create one volume and one node to test with
|
# Create one volume and one node to test with
|
||||||
|
@ -99,8 +99,12 @@ class BlockStore(object):
|
|||||||
self._init_volume_group()
|
self._init_volume_group()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
# TODO(josh): Get rid of this destructor, volumes destroy themselves
|
||||||
if FLAGS.fake_storage:
|
if FLAGS.fake_storage:
|
||||||
shutil.rmtree(FLAGS.aoe_export_dir)
|
try:
|
||||||
|
shutil.rmtree(FLAGS.aoe_export_dir)
|
||||||
|
except Exception, err:
|
||||||
|
pass
|
||||||
|
|
||||||
def report_state(self):
|
def report_state(self):
|
||||||
#TODO: aggregate the state of the system
|
#TODO: aggregate the state of the system
|
||||||
@ -163,7 +167,7 @@ class Volume(datastore.BasicModel):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self):
|
def identifier(self):
|
||||||
self.volume_id
|
return self.volume_id
|
||||||
|
|
||||||
def default_state(self):
|
def default_state(self):
|
||||||
return {"volume_id": self.volume_id}
|
return {"volume_id": self.volume_id}
|
||||||
|
Loading…
Reference in New Issue
Block a user