images_client uses incorrect exception: BuildErrorException

Bug #999256 reported by Katherine Elliott
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Low
Katherine Elliott

Bug Description

I'm seeing this on the latest-available branch. In images_client.py, both wait_for_image_resp_code and wait_for_image_status use the BuildErrorException, which makes for some really confusing results to debug. For example, in the test_images and test_list_images tests, when an added images fails to get to the "ACTIVE" state, we see this in the output:

======================================================================
ERROR: An image for the provided server should be created
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tempest/tempest/tests/test_images.py", line 46, in test_create_delete_image
    self.client.wait_for_image_status(image_id, 'ACTIVE')
  File "/tempest/tempest/services/nova/json/images_client.py", line 104, in wait_for_image_status
    raise exceptions.BuildErrorException
BuildErrorException: Server %(server_id)s failed to build and is in ERROR status

In addition, images_client is using the exception incorrectly, not passing in a "server_id" string (which should be an "image_id" string in a correct exception):

def wait_for_image_resp_code(self, image_id, code):
        """
        Waits until the HTTP response code for the request matches the
        expected value
        """
        resp, body = self.client.get("images/%s" % str(image_id))
        start = int(time.time())

        while resp.status != code:
            time.sleep(self.build_interval)
            resp, body = self.client.get("images/%s" % str(image_id))

            if int(time.time()) - start >= self.build_timeout:
                raise exceptions.BuildErrorException

To my exceptions.py here, I've added the following exception:

class ImageAddException(TempestException):
    message = "Image %(image_id) failed to become ACTIVE in the allotted time."

and changed the image tests to use this.

Revision history for this message
Jay Pipes (jaypipes) wrote :

Hi katherine, thx for the bug report (and fix)! Feel like submitting a patch into the Gerrit system for inclusion into trunk?

Revision history for this message
Katherine Elliott (katherine-elliott) wrote :

Certainly! I was just going to send a message asking if I should. What about getting it included in stable/essex, which is what we're testing with right now?

Revision history for this message
Jay Pipes (jaypipes) wrote :

No changes can go into stable/essex without first being merged into the development trunk, so you'd have to submit a patchset against the upstream master and then you could submit a patch against stable/essex.

If you want to hop onto IRC (Freenode.net #openstack-dev channel), I can assist you in walking through the contribution and review push process? My nick on IRC is jaypipes.

Best,
-jay

Jay Pipes (jaypipes)
Changed in tempest:
status: New → Triaged
importance: Undecided → Low
assignee: nobody → Katherine Elliott (katherine-elliott)
Revision history for this message
Katherine Elliott (katherine-elliott) wrote : RE: [Bug 999256] Re: images_client uses incorrect exception: BuildErrorException
Download full text (3.2 KiB)

Hi Jay!

I'm working to submit a fix for this but am waiting to be added to "OpenStack Contributors". Are you by any chance one of the team administrators who can add me? :)

Katherine

----
Katherine Elliott
You have only to observe my dogs to peer into my soul...
Pulsar - Test/QA
Manageability Solutions Lab
Hewlett-Packard
Ft. Collins, Colorado
MS 36, 6UE12
970-898-3565

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Jay Pipes
Sent: Monday, May 14, 2012 1:41 PM
To: Elliott, Katherine (MSL - Ft. Collins)
Subject: [Bug 999256] Re: images_client uses incorrect exception: BuildErrorException

** Changed in: tempest
       Status: New => Triaged

** Changed in: tempest
   Importance: Undecided => Low

** Changed in: tempest
     Assignee: (unassigned) => Katherine Elliott (katherine-elliott)

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/999256

Title:
  images_client uses incorrect exception: BuildErrorException

Status in Tempest:
  Triaged

Bug description:
  I'm seeing this on the latest-available branch. In images_client.py,
  both wait_for_image_resp_code and wait_for_image_status use the
  BuildErrorException, which makes for some really confusing results to
  debug. For example, in the test_images and test_list_images tests,
  when an added images fails to get to the "ACTIVE" state, we see this
  in the output:

  ======================================================================
  ERROR: An image for the provided server should be created
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/tempest/tempest/tests/test_images.py", line 46, in test_create_delete_image
      self.client.wait_for_image_status(image_id, 'ACTIVE')
    File "/tempest/tempest/services/nova/json/images_client.py", line 104, in wait_for_image_status
      raise exceptions.BuildErrorException
  BuildErrorException: Server %(server_id)s failed to build and is in ERROR status

  In addition, images_client is using the exception incorrectly, not
  passing in a "server_id" string (which should be an "image_id" string
  in a correct exception):

  def wait_for_image_resp_code(self, image_id, code):
          """
          Waits until the HTTP response code for the request matches the
          expected value
          """
          resp, body = self.client.get("images/%s" % str(image_id))
          start = int(time.time())

          while resp.status != code:
              time.sleep(self.build_interval)
              resp, body = self.client.get("images/%s" % str(image_id))

              if int(time.time()) - start >= self.build_timeout:
                  raise exceptions.BuildErrorException

  To my exceptions.py here, I've added the following exception:

  class ImageAddException(TempestException):
      message = "Image %(image_id) failed to become ACTIVE in the allotted time."

  and changed the image tests to use this.

To manage notifications about this bug go to:
https://bugs.la...

Read more...

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

Fix proposed to branch: master
Review: https://review.openstack.org/7586

Changed in tempest:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest (master)

Reviewed: https://review.openstack.org/7586
Committed: http://github.com/openstack/tempest/commit/74f6851665569c1a6aa8af60879ae3d156560b59
Submitter: Jenkins
Branch: master

commit 74f6851665569c1a6aa8af60879ae3d156560b59
Author: Katherine Elliott <email address hidden>
Date: Fri May 18 10:19:22 2012 -0600

    Added an AddImageException to exceptions.py and modified images_client to use this exception rather than BuildErrorException.

    Fixes bug 999256.

    exceptions.py:
    class AddImageException(TempestException):
        message = "Image %(image_id) failed to become ACTIVE in the allotted time."

    images_client.py:
    In wait_for_image_resp_code and wait_for_image_status, changed:

      raise exceptions.BuildErrorException

    to:

      raise exceptions.TimeoutException

    In wait_for_image_status, changed:

      raise exceptions.BuildErrorExcption

    to:

      raise exceptions.AddImageException(image_id=image_id)

    Replaced TimeoutException with AddImageException and replaced AddImageException with TimeoutException.

    Change-Id: Ic78f1d24151361c9886480822087931b61b3603c

Changed in tempest:
status: In Progress → Fix Committed
Jay Pipes (jaypipes)
Changed in tempest:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.