Example #1
0
 def create_flavor_service_profile(self, context,
                                   service_profile, flavor_id):
     sp = service_profile['service_profile']
     with db_api.context_manager.writer.using(context):
         if obj_flavor.FlavorServiceProfileBinding.objects_exist(
                 context, service_profile_id=sp['id'], flavor_id=flavor_id):
             raise ext_flavors.FlavorServiceProfileBindingExists(
                 sp_id=sp['id'], fl_id=flavor_id)
         obj_flavor.FlavorServiceProfileBinding(
             context, service_profile_id=sp['id'],
             flavor_id=flavor_id).create()
     fl_obj = self._get_flavor(context, flavor_id)
     return self._make_flavor_dict(fl_obj)
Example #2
0
 def create_flavor_service_profile(self, context, service_profile,
                                   flavor_id):
     sp = service_profile['service_profile']
     with context.session.begin(subtransactions=True):
         bind_qry = context.session.query(FlavorServiceProfileBinding)
         binding = bind_qry.filter_by(service_profile_id=sp['id'],
                                      flavor_id=flavor_id).first()
         if binding:
             raise ext_flavors.FlavorServiceProfileBindingExists(
                 sp_id=sp['id'], fl_id=flavor_id)
         binding = FlavorServiceProfileBinding(service_profile_id=sp['id'],
                                               flavor_id=flavor_id)
         context.session.add(binding)
     fl_db = self._get_flavor(context, flavor_id)
     return self._make_flavor_dict(fl_db)
Example #3
0
 def create_flavor_service_profile(self, context, service_profile,
                                   flavor_id):
     sp = service_profile['service_profile']
     with db_api.context_manager.writer.using(context):
         bind_qry = context.session.query(
             flavor_models.FlavorServiceProfileBinding)
         binding = bind_qry.filter_by(service_profile_id=sp['id'],
                                      flavor_id=flavor_id).first()
         if binding:
             raise ext_flavors.FlavorServiceProfileBindingExists(
                 sp_id=sp['id'], fl_id=flavor_id)
         binding = flavor_models.FlavorServiceProfileBinding(
             service_profile_id=sp['id'], flavor_id=flavor_id)
         context.session.add(binding)
     fl_db = self._get_flavor(context, flavor_id)
     return self._make_flavor_dict(fl_db)