← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1398086] [NEW] nova servers pagination does not work with deleted marker

 

Public bug reported:

Nova does not paginate correctly if the marker is a deleted server.

I am trying to get all of the servers for a given tenant. In total (i.e.
active, delete, error, etc.) there are 405 servers.

If I query the API without a marker and with a limit larger (for example, 500)
than the total number of servers I get all of them, i.e. the following query
correctly returns 405 servers:

    curl (...) "http://cloud.example.org:8774/v1.1/foo/servers?changes-
since=2014-01-01&limit=500"

However, if I try to paginate over them, doing:

    curl (...) "http://cloud.example.org:8774/v1.1/foo/servers?changes-
since=2014-01-01&limit=100"

I get the first 100 with a link to the next page. If I try to follow it:

    curl (...) "http://cloud.example.org:8774/v1.1/foo/servers?changes-
since=2014-01-01&limit=100&marker=foobar"

I am always getting a "badRequest" error saying that the marker is not found. I
guess this is because of these lines in "nova/db/sqlalchemy/api.py"

    2000     # paginate query
    2001     if marker is not None:
    2002         try:
    2003             marker = _instance_get_by_uuid(context, marker, session=session)
    2004         except exception.InstanceNotFound:
    2005             raise exception.MarkerNotFound(marker)

The function "_instance_get_by_uuid" gets the machines that are not
deleted, therefore it fails to locate the marker if it is a deleted
server.

** Affects: nova
     Importance: Undecided
         Status: New

-- 
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/1398086

Title:
  nova servers pagination does not work with deleted marker

Status in OpenStack Compute (Nova):
  New

Bug description:
  Nova does not paginate correctly if the marker is a deleted server.

  I am trying to get all of the servers for a given tenant. In total
  (i.e. active, delete, error, etc.) there are 405 servers.

  If I query the API without a marker and with a limit larger (for example, 500)
  than the total number of servers I get all of them, i.e. the following query
  correctly returns 405 servers:

      curl (...) "http://cloud.example.org:8774/v1.1/foo/servers
  ?changes-since=2014-01-01&limit=500"

  However, if I try to paginate over them, doing:

      curl (...) "http://cloud.example.org:8774/v1.1/foo/servers
  ?changes-since=2014-01-01&limit=100"

  I get the first 100 with a link to the next page. If I try to follow
  it:

      curl (...) "http://cloud.example.org:8774/v1.1/foo/servers
  ?changes-since=2014-01-01&limit=100&marker=foobar"

  I am always getting a "badRequest" error saying that the marker is not found. I
  guess this is because of these lines in "nova/db/sqlalchemy/api.py"

      2000     # paginate query
      2001     if marker is not None:
      2002         try:
      2003             marker = _instance_get_by_uuid(context, marker, session=session)
      2004         except exception.InstanceNotFound:
      2005             raise exception.MarkerNotFound(marker)

  The function "_instance_get_by_uuid" gets the machines that are not
  deleted, therefore it fails to locate the marker if it is a deleted
  server.

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


Follow ups

References