volume = db.volume_get(self.context, self.volume_id)
self.assertEqual(volume['status'], 'available')
+ def test_copy_volume_to_image_driver_not_initialized(self):
+ # creating volume testdata
+ db.volume_create(self.context, self.volume_attrs)
+
+ # set initialized to False
+ self.volume.driver._initialized = False
+
+ # start test
+ self.assertRaises(exception.DriverNotInitialized,
+ self.volume.copy_volume_to_image,
+ self.context,
+ self.volume_id,
+ self.image_meta)
+
+ volume = db.volume_get(self.context, self.volume_id)
+ self.assertEqual(volume.status, 'available')
+
class GetActiveByWindowTestCase(BaseVolumeTestCase):
def setUp(self):
"""
payload = {'volume_id': volume_id, 'image_id': image_meta['id']}
try:
+ volume = self.db.volume_get(context, volume_id)
+
# NOTE(flaper87): Verify the driver is enabled
# before going forward. The exception will be caught
# and the volume status updated.
utils.require_driver_initialized(self.driver)
- volume = self.db.volume_get(context, volume_id)
image_service, image_id = \
glance.get_remote_image_service(context, image_meta['id'])
self.driver.copy_volume_to_image(context, volume, image_service,