diff --git a/devstack/settings b/devstack/settings index 6d56666d..a182bb00 100644 --- a/devstack/settings +++ b/devstack/settings @@ -10,7 +10,7 @@ INSTALL_PYPOWERVM=$(trueorfalse False INSTALL_PYPOWERVM) PVM_ADMIN_GROUP=${PVM_ADMIN_GROUP:-pvm_admin} # Nova settings -PVM_DRIVER=nova_powervm.virt.powervm.driver.PowerVMDriver +PVM_DRIVER=powervm.driver.PowerVMDriver INSTANCE_NAME_TEMPLATE=${INSTANCE_NAME_TEMPLATE:-"%(display_name).13s-%(uuid).8s-pvm"} COMPUTE_MONITORS=${COMPUTE_MONITORS:-nova.compute.monitors.all_monitors} FORCE_CONFIG_DRIVE=${FORCE_CONFIG_DRIVE:-True} diff --git a/nova/__init__.py b/nova/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nova/virt/__init__.py b/nova/virt/__init__.py new file mode 100644 index 00000000..671e539d --- /dev/null +++ b/nova/virt/__init__.py @@ -0,0 +1,18 @@ +# Copyright 2016 IBM Corp. +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# Required to play nicely with namespace composition (PEP420). +__import__('pkg_resources').declare_namespace(__name__) diff --git a/nova/virt/powervm/__init__.py b/nova/virt/powervm/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nova/virt/powervm/driver.py b/nova/virt/powervm/driver.py new file mode 100644 index 00000000..8a277bf5 --- /dev/null +++ b/nova/virt/powervm/driver.py @@ -0,0 +1,35 @@ +# Copyright 2016 IBM Corp. +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +"""Shim layer for nova_powervm.virt.powervm.driver.PowerVMDriver. + +Duplicate all public symbols. This is necessary for the constants as well as +the classes - because instances of the classes need to be able to resolve +references to the constants. +""" +import nova_powervm.virt.powervm.driver as real_drv + +LOG = real_drv.LOG +CONF = real_drv.CONF +VOLUME_DRIVER_MAPPINGS = real_drv.VOLUME_DRIVER_MAPPINGS +DISK_ADPT_NS = real_drv.DISK_ADPT_NS +DISK_ADPT_MAPPINGS = real_drv.DISK_ADPT_MAPPINGS +NVRAM_NS = real_drv.NVRAM_NS +NVRAM_APIS = real_drv.NVRAM_APIS +KEEP_NVRAM_STATES = real_drv.KEEP_NVRAM_STATES +FETCH_NVRAM_STATES = real_drv.FETCH_NVRAM_STATES +PowerVMDriver = real_drv.PowerVMDriver +NovaEventHandler = real_drv.NovaEventHandler diff --git a/nova_powervm/tests/virt/powervm/fixtures.py b/nova_powervm/tests/virt/powervm/fixtures.py index 56dfa411..387a8411 100644 --- a/nova_powervm/tests/virt/powervm/fixtures.py +++ b/nova_powervm/tests/virt/powervm/fixtures.py @@ -20,7 +20,7 @@ from __future__ import absolute_import import fixtures import mock -from nova_powervm.virt.powervm import driver +from nova.virt.powervm import driver from nova.virt import fake from pypowervm.tests import test_fixtures as pvm_fx diff --git a/nova_powervm/tests/virt/powervm/test_driver.py b/nova_powervm/tests/virt/powervm/test_driver.py index 5da54858..22e37001 100644 --- a/nova_powervm/tests/virt/powervm/test_driver.py +++ b/nova_powervm/tests/virt/powervm/test_driver.py @@ -43,9 +43,10 @@ from pypowervm.wrappers import base_partition as pvm_bp from pypowervm.wrappers import logical_partition as pvm_lpar from pypowervm.wrappers import virtual_io_server as pvm_vios +from nova.virt.powervm import driver + from nova_powervm.tests.virt import powervm from nova_powervm.tests.virt.powervm import fixtures as fx -from nova_powervm.virt.powervm import driver from nova_powervm.virt.powervm import exception as p_exc from nova_powervm.virt.powervm import live_migration as lpm from nova_powervm.virt.powervm import vm @@ -260,7 +261,7 @@ class TestPowerVMDriver(test.TestCase): '.execute') @mock.patch('nova_powervm.virt.powervm.tasks.storage.CreateDiskForImg' '.execute') - @mock.patch('nova_powervm.virt.powervm.driver.PowerVMDriver.' + @mock.patch('nova.virt.powervm.driver.PowerVMDriver.' '_is_booted_from_volume') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugMgmtVif.execute') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugVifs.execute') @@ -336,7 +337,7 @@ class TestPowerVMDriver(test.TestCase): @mock.patch('nova.virt.block_device.DriverVolumeBlockDevice.save') @mock.patch('nova_powervm.virt.powervm.tasks.storage.CreateDiskForImg' '.execute') - @mock.patch('nova_powervm.virt.powervm.driver.PowerVMDriver.' + @mock.patch('nova.virt.powervm.driver.PowerVMDriver.' '_is_booted_from_volume') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugMgmtVif.execute') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugVifs.execute') @@ -391,7 +392,7 @@ class TestPowerVMDriver(test.TestCase): @mock.patch('nova.virt.block_device.DriverVolumeBlockDevice.save') @mock.patch('nova_powervm.virt.powervm.tasks.storage.CreateDiskForImg' '.execute') - @mock.patch('nova_powervm.virt.powervm.driver.PowerVMDriver.' + @mock.patch('nova.virt.powervm.driver.PowerVMDriver.' '_is_booted_from_volume') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugMgmtVif.execute') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugVifs.execute') @@ -450,7 +451,7 @@ class TestPowerVMDriver(test.TestCase): @mock.patch('nova.virt.block_device.DriverVolumeBlockDevice.save') @mock.patch('nova_powervm.virt.powervm.tasks.storage.CreateDiskForImg' '.execute') - @mock.patch('nova_powervm.virt.powervm.driver.PowerVMDriver.' + @mock.patch('nova.virt.powervm.driver.PowerVMDriver.' '_is_booted_from_volume') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugMgmtVif.execute') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugVifs.execute') @@ -505,7 +506,7 @@ class TestPowerVMDriver(test.TestCase): '.execute') @mock.patch('nova_powervm.virt.powervm.tasks.storage.FindDisk' '.execute') - @mock.patch('nova_powervm.virt.powervm.driver.PowerVMDriver.' + @mock.patch('nova.virt.powervm.driver.PowerVMDriver.' '_is_booted_from_volume') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugMgmtVif.execute') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugVifs.execute') @@ -587,7 +588,7 @@ class TestPowerVMDriver(test.TestCase): @mock.patch('nova.virt.block_device.DriverVolumeBlockDevice.save') @mock.patch('nova_powervm.virt.powervm.tasks.storage.CreateDiskForImg' '.execute') - @mock.patch('nova_powervm.virt.powervm.driver.PowerVMDriver.' + @mock.patch('nova.virt.powervm.driver.PowerVMDriver.' '_is_booted_from_volume') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugMgmtVif.execute') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugVifs.execute') @@ -595,7 +596,7 @@ class TestPowerVMDriver(test.TestCase): @mock.patch('nova.objects.flavor.Flavor.get_by_id') @mock.patch('nova_powervm.virt.powervm.tasks.vm.UpdateIBMiSettings' '.execute') - @mock.patch('nova_powervm.virt.powervm.driver.PowerVMDriver.' + @mock.patch('nova.virt.powervm.driver.PowerVMDriver.' '_get_boot_connectivity_type') @mock.patch('pypowervm.tasks.power.power_on') def test_spawn_ibmi( @@ -646,7 +647,7 @@ class TestPowerVMDriver(test.TestCase): '.execute') @mock.patch('nova_powervm.virt.powervm.tasks.storage.CreateDiskForImg' '.execute') - @mock.patch('nova_powervm.virt.powervm.driver.PowerVMDriver.' + @mock.patch('nova.virt.powervm.driver.PowerVMDriver.' '_is_booted_from_volume') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugMgmtVif.execute') @mock.patch('nova_powervm.virt.powervm.tasks.network.PlugVifs.execute') @@ -654,7 +655,7 @@ class TestPowerVMDriver(test.TestCase): @mock.patch('nova.objects.flavor.Flavor.get_by_id') @mock.patch('nova_powervm.virt.powervm.tasks.vm.UpdateIBMiSettings' '.execute') - @mock.patch('nova_powervm.virt.powervm.driver.PowerVMDriver.' + @mock.patch('nova.virt.powervm.driver.PowerVMDriver.' '_get_boot_connectivity_type') @mock.patch('pypowervm.tasks.power.power_on') def test_spawn_ibmi_without_bdms( @@ -826,7 +827,7 @@ class TestPowerVMDriver(test.TestCase): self.assertEqual(2, flow.add.call_count) @mock.patch('nova_powervm.virt.powervm.tasks.network.UnplugVifs.execute') - @mock.patch('nova_powervm.virt.powervm.driver.PowerVMDriver.' + @mock.patch('nova.virt.powervm.driver.PowerVMDriver.' '_is_booted_from_volume') @mock.patch('nova_powervm.virt.powervm.vm.dlt_lpar') @mock.patch('nova_powervm.virt.powervm.vm.power_off') @@ -1212,7 +1213,7 @@ class TestPowerVMDriver(test.TestCase): taskflow_fix.assert_tasks_added(self, expected) self.san_lpar_name.assert_called_with('resize_' + self.inst.name) - @mock.patch('nova_powervm.virt.powervm.driver.vm') + @mock.patch('nova_powervm.virt.powervm.vm') @mock.patch('nova_powervm.virt.powervm.tasks.vm.vm') @mock.patch('nova_powervm.virt.powervm.tasks.vm.power') def test_rescue(self, mock_task_pwr, mock_task_vm, mock_dvr_vm): @@ -1228,7 +1229,7 @@ class TestPowerVMDriver(test.TestCase): self.assertTrue(mock_task_pwr.power_on.called) self.assertFalse(mock_task_pwr.power_on.call_args[1]['synchronous']) - @mock.patch('nova_powervm.virt.powervm.driver.vm') + @mock.patch('nova_powervm.virt.powervm.vm') @mock.patch('nova_powervm.virt.powervm.tasks.vm.vm') @mock.patch('nova_powervm.virt.powervm.tasks.vm.power') def test_unrescue(self, mock_task_pwr, mock_task_vm, mock_dvr_vm): @@ -1243,7 +1244,7 @@ class TestPowerVMDriver(test.TestCase): self.assertTrue(mock_task_pwr.power_on.called) self.assertFalse(mock_task_pwr.power_on.call_args[1]['synchronous']) - @mock.patch.object(driver, 'LOG') + @mock.patch('nova_powervm.virt.powervm.driver.LOG') def test_log_op(self, mock_log): """Validates the log_operations.""" self.drv._log_operation('fake_op', self.inst) @@ -1360,7 +1361,7 @@ class TestPowerVMDriver(test.TestCase): def test_get_host_ip_addr(self): self.assertEqual(self.drv.get_host_ip_addr(), '127.0.0.1') - @mock.patch('nova_powervm.virt.powervm.driver.LOG.warning') + @mock.patch('nova.virt.powervm.driver.LOG.warning') @mock.patch('nova.compute.utils.get_machine_ips') def test_get_host_ip_addr_failure(self, mock_ips, mock_log): mock_ips.return_value = ['1.1.1.1'] diff --git a/setup.cfg b/setup.cfg index 99e3f1d0..58edbbc5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,6 +20,7 @@ classifier = [files] packages = nova_powervm + nova.virt.powervm [build_sphinx] source-dir = doc/source