def test_volume_type_get_with_extra_specs(self): volume_type = db.volume_type_get(context.get_admin_context(), self.volume_type1_id) self.assertEquals(volume_type['extra_specs'], self.vol_type1_specs) volume_type = db.volume_type_get(context.get_admin_context(), self.vol_type2_id) self.assertEquals(volume_type['extra_specs'], {})
def test_volume_type_get_with_extra_specs(self): volume_type = db.volume_type_get( context.get_admin_context(), self.volume_type1_id) self.assertEquals(volume_type['extra_specs'], self.vol_type1_specs) volume_type = db.volume_type_get( context.get_admin_context(), self.vol_type2_id) self.assertEquals(volume_type['extra_specs'], {})
def get_volume_type(ctxt, id): """Retrieves single volume type by id.""" if id is None: raise exception.InvalidVolumeType(volume_type=id) if ctxt is None: ctxt = context.get_admin_context() try: return db.volume_type_get(ctxt, id) except exception.DBError: raise exception.ApiError(_("Unknown volume type: %s") % id)