|
24 | 24 |
|
25 | 25 | from nova.api.openstack.compute import hypervisors \
|
26 | 26 | as hypervisors_v21
|
27 |
| -from nova.cells import utils as cells_utils |
28 | 27 | from nova import exception
|
29 | 28 | from nova import objects
|
30 | 29 | from nova import test
|
@@ -188,7 +187,7 @@ class HypervisorsTestV21(test.NoDBTestCase):
|
188 | 187 | # compute node primary key integer id or the uuid.
|
189 | 188 | expect_uuid_for_id = False
|
190 | 189 |
|
191 |
| - # copying the objects locally so the cells testcases can provide their own |
| 190 | + # TODO(stephenfin): These should just be defined here |
192 | 191 | TEST_HYPERS_OBJ = copy.deepcopy(TEST_HYPERS_OBJ)
|
193 | 192 | TEST_SERVICES = copy.deepcopy(TEST_SERVICES)
|
194 | 193 | TEST_SERVERS = copy.deepcopy(TEST_SERVERS)
|
@@ -723,93 +722,6 @@ def test_statistics_non_admin(self):
|
723 | 722 | self.controller.statistics, req)
|
724 | 723 |
|
725 | 724 |
|
726 |
| -_CELL_PATH = 'cell1' |
727 |
| - |
728 |
| - |
729 |
| -class CellHypervisorsTestV21(HypervisorsTestV21): |
730 |
| - TEST_HYPERS_OBJ = [cells_utils.ComputeNodeProxy(obj, _CELL_PATH) |
731 |
| - for obj in TEST_HYPERS_OBJ] |
732 |
| - TEST_SERVICES = [cells_utils.ServiceProxy(obj, _CELL_PATH) |
733 |
| - for obj in TEST_SERVICES] |
734 |
| - |
735 |
| - TEST_SERVERS = [dict(server, |
736 |
| - host=cells_utils.cell_with_item(_CELL_PATH, |
737 |
| - server['host'])) |
738 |
| - for server in TEST_SERVERS] |
739 |
| - |
740 |
| - DETAIL_HYPERS_DICTS = copy.deepcopy(HypervisorsTestV21.DETAIL_HYPERS_DICTS) |
741 |
| - DETAIL_HYPERS_DICTS = [dict(hyp, id=cells_utils.cell_with_item(_CELL_PATH, |
742 |
| - hyp['id']), |
743 |
| - service=dict(hyp['service'], |
744 |
| - id=cells_utils.cell_with_item( |
745 |
| - _CELL_PATH, |
746 |
| - hyp['service']['id']), |
747 |
| - host=cells_utils.cell_with_item( |
748 |
| - _CELL_PATH, |
749 |
| - hyp['service']['host']))) |
750 |
| - for hyp in DETAIL_HYPERS_DICTS] |
751 |
| - |
752 |
| - INDEX_HYPER_DICTS = copy.deepcopy(HypervisorsTestV21.INDEX_HYPER_DICTS) |
753 |
| - INDEX_HYPER_DICTS = [dict(hyp, id=cells_utils.cell_with_item(_CELL_PATH, |
754 |
| - hyp['id'])) |
755 |
| - for hyp in INDEX_HYPER_DICTS] |
756 |
| - |
757 |
| - # __deepcopy__ is added for copying an object locally in |
758 |
| - # _test_view_hypervisor_detail_cpuinfo_null |
759 |
| - cells_utils.ComputeNodeProxy.__deepcopy__ = (lambda self, memo: |
760 |
| - cells_utils.ComputeNodeProxy(copy.deepcopy(self._obj, memo), |
761 |
| - self._cell_path)) |
762 |
| - |
763 |
| - @classmethod |
764 |
| - def fake_compute_node_get_all(cls, context, limit=None, marker=None): |
765 |
| - return cls.TEST_HYPERS_OBJ |
766 |
| - |
767 |
| - @classmethod |
768 |
| - def fake_compute_node_search_by_hypervisor(cls, context, hypervisor_re): |
769 |
| - return cls.TEST_HYPERS_OBJ |
770 |
| - |
771 |
| - @classmethod |
772 |
| - def fake_compute_node_get(cls, context, compute_id): |
773 |
| - for hyper in cls.TEST_HYPERS_OBJ: |
774 |
| - if hyper.id == compute_id: |
775 |
| - return hyper |
776 |
| - raise exception.ComputeHostNotFound(host=compute_id) |
777 |
| - |
778 |
| - @classmethod |
779 |
| - def fake_service_get_by_compute_host(cls, context, host): |
780 |
| - for service in cls.TEST_SERVICES: |
781 |
| - if service.host == host: |
782 |
| - return service |
783 |
| - |
784 |
| - @classmethod |
785 |
| - def fake_instance_get_all_by_host(cls, context, host): |
786 |
| - results = [] |
787 |
| - for inst in cls.TEST_SERVERS: |
788 |
| - if inst['host'] == host: |
789 |
| - results.append(inst) |
790 |
| - return results |
791 |
| - |
792 |
| - def setUp(self): |
793 |
| - |
794 |
| - self.flags(enable=True, cell_type='api', group='cells') |
795 |
| - |
796 |
| - super(CellHypervisorsTestV21, self).setUp() |
797 |
| - |
798 |
| - host_api = self.controller.host_api |
799 |
| - host_api.compute_node_get_all = mock.MagicMock( |
800 |
| - side_effect=self.fake_compute_node_get_all) |
801 |
| - host_api.service_get_by_compute_host = mock.MagicMock( |
802 |
| - side_effect=self.fake_service_get_by_compute_host) |
803 |
| - host_api.compute_node_search_by_hypervisor = mock.MagicMock( |
804 |
| - side_effect=self.fake_compute_node_search_by_hypervisor) |
805 |
| - host_api.compute_node_get = mock.MagicMock( |
806 |
| - side_effect=self.fake_compute_node_get) |
807 |
| - host_api.compute_node_statistics = mock.MagicMock( |
808 |
| - side_effect=fake_compute_node_statistics) |
809 |
| - host_api.instance_get_all_by_host = mock.MagicMock( |
810 |
| - side_effect=self.fake_instance_get_all_by_host) |
811 |
| - |
812 |
| - |
813 | 725 | class HypervisorsTestV228(HypervisorsTestV21):
|
814 | 726 | api_version = '2.28'
|
815 | 727 |
|
|
0 commit comments