Func test for improper cn local DISK_GB reporting

Change I9c2111f7377df65c1fc3c72323f85483b3295989 fixed it so we stop
allocating the flavor's root_gb if we're booting from volume. However,
we're still reporting it against the compute node's capacity.

Furthermore, we're not reporting swap space at all.

This adds functional test coverage demonstrating these bugs.

Change-Id: Ia46754d8ff65c501545853e6c2909a5a900d45c0
Related-Bug: #1782393
Related-Bug: #1782386
This commit is contained in:
Eric Fried 2018-07-18 10:15:18 -05:00 committed by Zhenyu Zheng
parent 24bd27fcfd
commit ece289fa5a
2 changed files with 22 additions and 3 deletions

View File

@ -497,3 +497,7 @@ class TestOpenStackClient(object):
def put_aggregate(self, aggregate_id, body):
return self.api_put(
'/os-aggregates/%s' % aggregate_id, body).body['aggregate']
def get_hypervisor_stats(self):
return self.api_get(
'/os-hypervisors/statistics').body['hypervisor_statistics']

View File

@ -3586,7 +3586,6 @@ class VolumeBackedServerTest(integrated_helpers.ProviderUsageBaseTestCase):
def setUp(self):
super(VolumeBackedServerTest, self).setUp()
self.compute1 = self._start_compute('host1')
self.compute2 = self._start_compute('host2')
self.flavor_id = self._create_flavor()
def _create_flavor(self):
@ -3646,7 +3645,14 @@ class VolumeBackedServerTest(integrated_helpers.ProviderUsageBaseTestCase):
resources = list(allocs.values())[0]['resources']
self.assertIn('MEMORY_MB', resources)
# 10gb root, 20gb ephemeral, 5gb swap
self.assertEqual(35, resources['DISK_GB'])
expected_usage = 35
self.assertEqual(expected_usage, resources['DISK_GB'])
# Ensure the compute node is reporting the correct disk usage
self.assertEqual(
# TODO(efried): Due to bug #1782386, swap is not being reported.
# expected_usage,
30,
self.admin_api.get_hypervisor_stats()['local_gb_used'])
def test_volume_backed_no_disk_allocation(self):
server = self._create_volume_backed_server()
@ -3654,7 +3660,16 @@ class VolumeBackedServerTest(integrated_helpers.ProviderUsageBaseTestCase):
resources = list(allocs.values())[0]['resources']
self.assertIn('MEMORY_MB', resources)
# 0gb root, 20gb ephemeral, 5gb swap
self.assertEqual(25, resources['DISK_GB'])
expected_usage = 25
self.assertEqual(expected_usage, resources['DISK_GB'])
# Ensure the compute node is reporting the correct disk usage
self.assertEqual(
# TODO(efried): Due to bug #1782393 the flavor's root_gb is still
# being reported against the compute node's usage.
# TODO(efried): Due to bug #1782386, swap is not being reported.
# expected_usage,
30,
self.admin_api.get_hypervisor_stats()['local_gb_used'])
class TraitsBasedSchedulingTest(integrated_helpers.ProviderUsageBaseTestCase):