def get_int_id_from_volume_uuid(context, volume_uuid): if volume_uuid is None: return try: return db.get_ec2_volume_id_by_uuid(context, volume_uuid) except exception.NotFound: return db.ec2_volume_create(context, volume_uuid)['id']
def get_int_id_from_volume_uuid(context, volume_uuid): if volume_uuid is None: return try: return db.get_ec2_volume_id_by_uuid(context, volume_uuid) except exception.NotFound: raise exception.VolumeNotFound()
def test_get_vol_mapping_non_admin(self): ref = db.ec2_volume_create(self.context, 'fake-uuid') ec2_id = db.get_ec2_volume_id_by_uuid(self.context, 'fake-uuid') self.assertEqual(ref['id'], ec2_id)