Exemple #1
0
def get_int_id_from_snapshot_uuid(context, snapshot_uuid):
    if snapshot_uuid is None:
        return
    try:
        return db.get_ec2_snapshot_id_by_uuid(context, snapshot_uuid)
    except exception.NotFound:
        return db.ec2_snapshot_create(context, snapshot_uuid)['id']
Exemple #2
0
def get_int_id_from_snapshot_uuid(context, snapshot_uuid):
    if snapshot_uuid is None:
        return
    try:
        return db.get_ec2_snapshot_id_by_uuid(context, snapshot_uuid)
    except exception.NotFound:
        return db.ec2_snapshot_create(context, snapshot_uuid)['id']
Exemple #3
0
 def test_get_snap_mapping_non_admin(self):
     ref = db.ec2_snapshot_create(self.context, 'fake-uuid')
     ec2_id = db.get_ec2_snapshot_id_by_uuid(self.context, 'fake-uuid')
     self.assertEqual(ref['id'], ec2_id)
Exemple #4
0
 def create(self, context):
     if self.obj_attr_is_set('id'):
         raise exception.ObjectActionError(action='create',
                                           reason='already created')
     db_smap = db.ec2_snapshot_create(context, self.uuid)
     self._from_db_object(context, self, db_smap)
Exemple #5
0
 def test_get_snap_mapping_non_admin(self):
     ref = db.ec2_snapshot_create(self.context, 'fake-uuid')
     ec2_id = db.get_ec2_snapshot_id_by_uuid(self.context, 'fake-uuid')
     self.assertEqual(ref['id'], ec2_id)