Adjust test_resize_down_revert to account for counting quotas

Change I9269ffa2b80e48db96c622d0dc0817738854f602 in the Nova
server removes the need for reservations, which means that
once the server is resized in nova-compute and the vcpus and
memory_mb are changed on the instances record, the usage count
will also change, before the resize is confirmed. This means
we need to adjust the usage assertions in the resize down test.
Usage changes once the server is in VERIFY_RESIZE state, and
the usage will change again if the resize is reverted.

Note that if we were getting usage without the 'reserved'
query paramter to the 'limits' API, the behavior would have
been the same regardless of the change to Nova for counting
quotas.

Depends-On: I9269ffa2b80e48db96c622d0dc0817738854f602

Related to blueprint cells-count-resources-to-check-quota-in-api

Change-Id: I91ca0d204454987dcce1c68d9bf0f532b469df6d
This commit is contained in:
Matt Riedemann 2017-07-15 18:01:19 -04:00
parent 8d6bde276b
commit 617eb742ab
1 changed files with 8 additions and 9 deletions

View File

@ -135,17 +135,16 @@ class TestServersResize(base.ClientTestBase):
self.nova('resize',
params='%s %s --poll' % (server_id, smaller_flavor))
resize_usage = self._get_absolute_limits()
# compare the starting usage against the resize usage; in the case of
# a resize down we don't expect usage to change until it's confirmed,
# which doesn't happen in this test since we revert
self._compare_quota_usage(
starting_usage, resize_usage, expect_diff=False)
# compare the starting usage against the resize usage; with counting
# quotas in the server there are no reservations, so the
# usage changes after the resize happens before it's confirmed.
self._compare_quota_usage(starting_usage, resize_usage)
# now revert the resize
self.nova('resize-revert', params='%s' % server_id)
# we have to wait for the server to be ACTIVE before we can check quota
self._wait_for_state_change(server_id, 'active')
# get the final quota usage which should be the same as the resize
# usage before revert
# get the final quota usage which will be different from the resize
# usage since we've reverted back *up* to the original flavor; the API
# code checks quota again if we revert up in size
revert_usage = self._get_absolute_limits()
self._compare_quota_usage(
resize_usage, revert_usage, expect_diff=False)
self._compare_quota_usage(resize_usage, revert_usage)