Browse Source

libvirt: Revert non-reporting DISK_GB if sharing

Change Iea283322124cb35fc0bc6d25f35548621e8c8c2f went part way toward
implementing proper accounting for sharing providers, but the gaps it
left are untenable - see the associated bug report.

This removes the main functional piece of that change with TODOs to
reinstate it once the broader issues have been resolved.

Change-Id: I245a16315f97d0c2ca69c6ca9727a55a8ceb75ab
Related-Bug: #1784020
changes/14/586614/1
Eric Fried 4 years ago
parent
commit
a451686263
  1. 7
      nova/tests/functional/libvirt/test_shared_resource_provider.py
  2. 5
      nova/tests/unit/virt/libvirt/test_driver.py
  3. 18
      nova/virt/libvirt/driver.py

7
nova/tests/functional/libvirt/test_shared_resource_provider.py

@ -14,6 +14,7 @@
# under the License.
import fixtures
import unittest
from nova.compute import instance_actions
from nova import conf
@ -42,6 +43,8 @@ class SharedStorageProviderUsageTestCase(
nodename = self.compute.manager._get_nodename(None)
self.host_uuid = self._get_provider_uuid_by_host(nodename)
# TODO(efried): Bug #1784020
@unittest.expectedFailure
def test_shared_storage_rp_configuration_with_cn_rp(self):
"""Test to check whether compute node and shared storage resource
provider inventory is configured properly or not.
@ -114,6 +117,8 @@ class SharedStorageProviderUsageTestCase(
'STORAGE_DISK_SSD'])
return shared_RP['uuid']
# TODO(efried): Bug #1784020
@unittest.expectedFailure
def test_rebuild_instance_with_image_traits_on_shared_rp(self):
shared_rp_uuid = self.create_shared_storage_rp()
@ -175,6 +180,8 @@ class SharedStorageProviderUsageTestCase(
server = self.api.get_server(server['id'])
self.assertEqual(rebuild_image_ref, server['image']['id'])
# TODO(efried): Bug #1784020
@unittest.expectedFailure
def test_rebuild_instance_with_image_traits_on_shared_rp_no_valid_host(
self):
shared_rp_uuid = self.create_shared_storage_rp()

5
nova/tests/unit/virt/libvirt/test_driver.py

@ -28,6 +28,7 @@ import shutil
import signal
import threading
import time
import unittest
from castellan import key_manager
import ddt
@ -18021,7 +18022,9 @@ class TestUpdateProviderTree(test.NoDBTestCase):
return_value=memory_mb)
@mock.patch('nova.virt.libvirt.driver.LibvirtDriver._get_vcpu_total',
return_value=vcpus)
def teste_update_provider_tree_for_shared_disk_gb_resource(
# TODO(efried): Bug #1784020
@unittest.expectedFailure
def test_update_provider_tree_for_shared_disk_gb_resource(
self, mock_vcpu, mock_mem, mock_disk, mock_vgpus):
"""Test to check DISK_GB is reported from shared resource
provider.

18
nova/virt/libvirt/driver.py

@ -6434,14 +6434,16 @@ class LibvirtDriver(driver.ComputeDriver):
# If a sharing DISK_GB provider exists in the provider tree, then our
# storage is shared, and we should not report the DISK_GB inventory in
# the compute node provider.
if not provider_tree.has_sharing_provider(
rc_fields.ResourceClass.DISK_GB):
result[rc_fields.ResourceClass.DISK_GB] = {
'total': disk_gb,
'min_unit': 1,
'max_unit': disk_gb,
'step_size': 1,
}
# TODO(efried): Reinstate non-reporting of shared resource by the
# compute RP once the issues from bug #1784020 have been resolved.
if provider_tree.has_sharing_provider(rc_fields.ResourceClass.DISK_GB):
LOG.debug('Ignoring sharing provider - see bug #1784020')
result[rc_fields.ResourceClass.DISK_GB] = {
'total': disk_gb,
'min_unit': 1,
'max_unit': disk_gb,
'step_size': 1,
}
if vgpus > 0:
# Only provide VGPU resource classes if the driver supports it.

Loading…
Cancel
Save