← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1679794] [NEW] test_show_router_attribute_with_timestamp can fail in certain environments

 

Public bug reported:

When running in an HA or DVR configured environment, the following
tempest API test can fail with an 'updated_at' timestamp mismatch:

neutron.tests.tempest.api.test_timestamp.TestTimeStampWithL3.test_show_router_attribute_with_timestamp

In the HA case, the problem is that the create_router() code in
l3_hamode_db.py looks like this:

        router_dict = super(L3_HA_NAT_db_mixin,
                            self).create_router(context, router)
        if is_ha:
            try:
                router_db = self._get_router(context, router_dict['id'])

                self.schedule_router(context, router_dict['id'])

                router_dict['ha_vr_id'] = router_db.extra_attributes.ha_vr_id
                router_dict['status'] = self._update_router_db(
                    context, router_dict['id'],
                    {'status': n_const.ROUTER_STATUS_ACTIVE})['status']
                self._notify_router_updated(context, router_db.id,
                                            schedule_routers=False)

Since a vr_id is allocated, the router DB entry is updated with that
info right after it was created.  The original POST call is returning
what is essentially "stale" data.  A subsequent get will show a changes
'updated_at' field.

You can see this if you create a router with --ha in a one-node
devstack:

(admin) $ openstack router create --ha --project
ae5c9703507546f5801a14ddb124d47e router3

$ openstack router show router3
+-------------------------+--------------------------------------+
| Field                   | Value                                |
+-------------------------+--------------------------------------+
| admin_state_up          | UP                                   |
| availability_zone_hints |                                      |
| availability_zones      | nova                                 |
| created_at              | 2017-04-03T16:01:43Z                 |
| description             |                                      |
| distributed             | False                                |
| external_gateway_info   | None                                 |
| flavor_id               | None                                 |
| ha                      | False                                |
| id                      | 08ec51fb-188e-460a-bb01-61ddf160b77c |
| name                    | router3                              |
| project_id              | ae5c9703507546f5801a14ddb124d47e     |
| revision_number         | 5                                    |
| routes                  |                                      |
| status                  | ACTIVE                               |
| updated_at              | 2017-04-03T16:01:44Z                 |
+-------------------------+--------------------------------------+

The 'updated_at' timestamp is +1s from 'created_at'.

The test should check >= instead.  The same problem would happen with
DVR.

** Affects: neutron
     Importance: Low
     Assignee: Brian Haley (brian-haley)
         Status: In Progress

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1679794

Title:
  test_show_router_attribute_with_timestamp can fail in certain
  environments

Status in neutron:
  In Progress

Bug description:
  When running in an HA or DVR configured environment, the following
  tempest API test can fail with an 'updated_at' timestamp mismatch:

  neutron.tests.tempest.api.test_timestamp.TestTimeStampWithL3.test_show_router_attribute_with_timestamp

  In the HA case, the problem is that the create_router() code in
  l3_hamode_db.py looks like this:

          router_dict = super(L3_HA_NAT_db_mixin,
                              self).create_router(context, router)
          if is_ha:
              try:
                  router_db = self._get_router(context, router_dict['id'])

                  self.schedule_router(context, router_dict['id'])

                  router_dict['ha_vr_id'] = router_db.extra_attributes.ha_vr_id
                  router_dict['status'] = self._update_router_db(
                      context, router_dict['id'],
                      {'status': n_const.ROUTER_STATUS_ACTIVE})['status']
                  self._notify_router_updated(context, router_db.id,
                                              schedule_routers=False)

  Since a vr_id is allocated, the router DB entry is updated with that
  info right after it was created.  The original POST call is returning
  what is essentially "stale" data.  A subsequent get will show a
  changes 'updated_at' field.

  You can see this if you create a router with --ha in a one-node
  devstack:

  (admin) $ openstack router create --ha --project
  ae5c9703507546f5801a14ddb124d47e router3

  $ openstack router show router3
  +-------------------------+--------------------------------------+
  | Field                   | Value                                |
  +-------------------------+--------------------------------------+
  | admin_state_up          | UP                                   |
  | availability_zone_hints |                                      |
  | availability_zones      | nova                                 |
  | created_at              | 2017-04-03T16:01:43Z                 |
  | description             |                                      |
  | distributed             | False                                |
  | external_gateway_info   | None                                 |
  | flavor_id               | None                                 |
  | ha                      | False                                |
  | id                      | 08ec51fb-188e-460a-bb01-61ddf160b77c |
  | name                    | router3                              |
  | project_id              | ae5c9703507546f5801a14ddb124d47e     |
  | revision_number         | 5                                    |
  | routes                  |                                      |
  | status                  | ACTIVE                               |
  | updated_at              | 2017-04-03T16:01:44Z                 |
  +-------------------------+--------------------------------------+

  The 'updated_at' timestamp is +1s from 'created_at'.

  The test should check >= instead.  The same problem would happen with
  DVR.

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


Follow ups