Public bug reported:

If the first trait you try to retrieve from placement doesn't exist,
traits are not synced from os_traits into the database, so it winds up
empty.

        try:
            rp_obj.Trait.get_by_name(self.ctx, 'CUSTOM_GOLD')
        except exception.TraitNotFound:
            pass
        rp_obj.Trait.get_by_name(self.ctx, os_traits.HW_CPU_X86_AVX2)  # <== 
raises TraitNotFound

I *think* what's happening is this:

1    @staticmethod
2    @db_api.api_context_manager.writer  # trait sync can cause a write
3    def _get_by_name_from_db(context, name):
4        _ensure_trait_sync(context)
5        result = context.session.query(models.Trait).filter_by(
6            name=name).first()
7        if not result:
8            raise exception.TraitNotFound(names=name)
9        return result

Line 4 "succeeds" and sets _TRAITS_SYNCED = True.
But because line 8 raises, the transaction is rolled back.  Database stays 
empty.
Subsequent retrieval attempts see _TRAITS_SYNCED == True so don't try to resync.

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: placement

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1760322

Title:
  Traits not synced if first retrieval fails

Status in OpenStack Compute (nova):
  New

Bug description:
  If the first trait you try to retrieve from placement doesn't exist,
  traits are not synced from os_traits into the database, so it winds up
  empty.

          try:
              rp_obj.Trait.get_by_name(self.ctx, 'CUSTOM_GOLD')
          except exception.TraitNotFound:
              pass
          rp_obj.Trait.get_by_name(self.ctx, os_traits.HW_CPU_X86_AVX2)  # <== 
raises TraitNotFound

  I *think* what's happening is this:

  1    @staticmethod
  2    @db_api.api_context_manager.writer  # trait sync can cause a write
  3    def _get_by_name_from_db(context, name):
  4        _ensure_trait_sync(context)
  5        result = context.session.query(models.Trait).filter_by(
  6            name=name).first()
  7        if not result:
  8            raise exception.TraitNotFound(names=name)
  9        return result

  Line 4 "succeeds" and sets _TRAITS_SYNCED = True.
  But because line 8 raises, the transaction is rolled back.  Database stays 
empty.
  Subsequent retrieval attempts see _TRAITS_SYNCED == True so don't try to 
resync.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1760322/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to