Remove agent vendor passthru from drivers

Agent lookup/heartbeat as vendor passthru interface is deprecated and
is being removed from Ironic.

This patch updates all the drivers in ironic-staging-drivers to not rely
in this functionality.

Change-Id: Idfcfdff6a8657d6e6f09b8fe85ebaa0251969955
Related-Bug: #1640533
This commit is contained in:
Pavlo Shchelokovskyy 2016-11-15 19:04:27 +02:00
parent 9de213f26f
commit fd7a07f981
8 changed files with 39 additions and 53 deletions

View File

@ -20,11 +20,12 @@ from ironic.drivers.modules import deploy_utils
from ironic.drivers.modules import iscsi_deploy
class AMTPXEVendorPassthru(iscsi_deploy.VendorPassthru):
class AMTISCSIDeploy(iscsi_deploy.ISCSIDeploy):
"""AMT-specific version of ISCSIDeploy driver interface"""
@task_manager.require_exclusive_lock
def continue_deploy(self, task):
if deploy_utils.get_boot_option(task.node) == "netboot":
task.driver.management.ensure_next_boot_device(task.node,
boot_devices.PXE)
super(AMTPXEVendorPassthru, self).continue_deploy(task)
super(AMTISCSIDeploy, self).continue_deploy(task)

View File

@ -17,13 +17,12 @@ from ironic.common import exception as ironic_exception
from ironic.drivers import base
from ironic.drivers.modules import agent
from ironic.drivers.modules import fake
from ironic.drivers.modules import iscsi_deploy
from ironic.drivers.modules import pxe
from oslo_utils import importutils
from ironic_staging_drivers.amt import deploy as amt_deploy
from ironic_staging_drivers.amt import management as amt_management
from ironic_staging_drivers.amt import power as amt_power
from ironic_staging_drivers.amt import vendor as amt_vendor
from ironic_staging_drivers.common.i18n import _
@ -38,7 +37,6 @@ class FakeAMTFakeDriver(base.BaseDriver):
self.power = amt_power.AMTPower()
self.deploy = fake.FakeDeploy()
self.management = amt_management.AMTManagement()
self.vendor = amt_vendor.AMTPXEVendorPassthru()
class PXEAndAMTISCSIDriver(base.BaseDriver):
@ -58,9 +56,8 @@ class PXEAndAMTISCSIDriver(base.BaseDriver):
reason=_("Unable to import pywsman library"))
self.power = amt_power.AMTPower()
self.boot = pxe.PXEBoot()
self.deploy = iscsi_deploy.ISCSIDeploy()
self.deploy = amt_deploy.AMTISCSIDeploy()
self.management = amt_management.AMTManagement()
self.vendor = amt_vendor.AMTPXEVendorPassthru()
class PXEAndAMTAgentDriver(base.BaseDriver):
@ -82,4 +79,3 @@ class PXEAndAMTAgentDriver(base.BaseDriver):
self.boot = pxe.PXEBoot()
self.deploy = agent.AgentDeploy()
self.management = amt_management.AMTManagement()
self.vendor = agent.AgentVendorInterface()

View File

@ -57,7 +57,6 @@ class PXEIBootISCSIDriver(base.BaseDriver):
self.power = iboot_power.IBootPower()
self.boot = pxe.PXEBoot()
self.deploy = iscsi_deploy.ISCSIDeploy()
self.vendor = iscsi_deploy.VendorPassthru()
class PXEIBootAgentDriver(base.BaseDriver):
@ -78,4 +77,3 @@ class PXEIBootAgentDriver(base.BaseDriver):
self.power = iboot_power.IBootPower()
self.boot = pxe.PXEBoot()
self.deploy = agent.AgentDeploy()
self.vendor = agent.AgentVendorInterface()

View File

@ -38,12 +38,10 @@ class AgentAndIPMIToolIntelNMDriver(base.BaseDriver):
self.deploy = agent.AgentDeploy()
self.management = ipmitool.IPMIManagement()
self.console = ipmitool.IPMIShellinaboxConsole()
self.agent_vendor = agent.AgentVendorInterface()
self.ipmi_vendor = ipmitool.VendorPassthru()
self.nm_vendor = nm_vendor.IntelNMVendorPassthru()
self.mapping = {'send_raw': self.ipmi_vendor,
'bmc_reset': self.ipmi_vendor,
'heartbeat': self.agent_vendor,
'control_nm_policy': self.nm_vendor,
'set_nm_policy': self.nm_vendor,
'get_nm_policy': self.nm_vendor,
@ -55,10 +53,7 @@ class AgentAndIPMIToolIntelNMDriver(base.BaseDriver):
'get_nm_version': self.nm_vendor,
'get_nm_statistics': self.nm_vendor,
'reset_nm_statistics': self.nm_vendor}
self.driver_passthru_mapping = {'lookup': self.agent_vendor}
self.vendor = utils.MixinVendorInterface(
self.mapping,
driver_passthru_mapping=self.driver_passthru_mapping)
self.vendor = utils.MixinVendorInterface(self.mapping)
self.raid = agent.AgentRAID()
self.inspect = inspector.Inspector.create_if_enabled(
'AgentAndIPMIToolDriver')

View File

@ -45,7 +45,6 @@ class PXELibvirtAgentDriver(base.BaseDriver):
self.boot = pxe.PXEBoot()
self.deploy = agent.AgentDeploy()
self.management = power.LibvirtManagement()
self.vendor = agent.AgentVendorInterface()
self.raid = agent.AgentRAID()
@ -65,4 +64,3 @@ class PXELibvirtISCSIDriver(base.BaseDriver):
self.boot = pxe.PXEBoot()
self.deploy = iscsi_deploy.ISCSIDeploy()
self.management = power.LibvirtManagement()
self.vendor = iscsi_deploy.VendorPassthru()

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Test class for AMT Vendor methods."""
"""Test class for AMT Deploy methods."""
from ironic.common import boot_devices
from ironic.common import states
@ -28,37 +28,19 @@ from ironic_staging_drivers.tests.unit.amt import utils as test_utils
INFO_DICT = test_utils.get_test_amt_info()
class AMTPXEVendorPassthruTestCase(db_base.DbTestCase):
class AMTISCSIDeployTestCase(db_base.DbTestCase):
def setUp(self):
super(AMTPXEVendorPassthruTestCase, self).setUp()
super(AMTISCSIDeployTestCase, self).setUp()
mgr_utils.mock_the_extension_manager(driver="pxe_amt_iscsi")
self.node = obj_utils.create_test_node(
self.context, driver='pxe_amt_iscsi', driver_info=INFO_DICT)
def test_vendor_routes(self):
expected = ['heartbeat']
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
vendor_routes = task.driver.vendor.vendor_routes
self.assertIsInstance(vendor_routes, dict)
self.assertEqual(sorted(expected), sorted(list(vendor_routes)))
def test_driver_routes(self):
expected = ['lookup']
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
driver_routes = task.driver.vendor.driver_routes
self.assertIsInstance(driver_routes, dict)
self.assertEqual(sorted(expected), sorted(list(driver_routes)))
@mock.patch.object(amt_mgmt.AMTManagement, 'ensure_next_boot_device',
spec_set=True, autospec=True)
@mock.patch.object(iscsi_deploy.VendorPassthru, 'continue_deploy',
@mock.patch.object(iscsi_deploy.ISCSIDeploy, 'continue_deploy',
spec_set=True, autospec=True)
def test_vendorpassthru_continue_deploy_netboot(self,
mock_pxe_vendorpassthru,
mock_ensure):
def test_continue_deploy_netboot(self, mock_continue, mock_ensure):
with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task:
task.node.provision_state = states.DEPLOYWAIT
@ -66,25 +48,23 @@ class AMTPXEVendorPassthruTestCase(db_base.DbTestCase):
task.node.instance_info['capabilities'] = {
"boot_option": "netboot"
}
task.driver.vendor.continue_deploy(task)
task.driver.deploy.continue_deploy(task)
mock_ensure.assert_called_with(
task.driver.management, task.node, boot_devices.PXE)
mock_pxe_vendorpassthru.assert_called_once_with(
task.driver.vendor, task)
mock_continue.assert_called_once_with(
task.driver.deploy, task)
@mock.patch.object(amt_mgmt.AMTManagement, 'ensure_next_boot_device',
spec_set=True, autospec=True)
@mock.patch.object(iscsi_deploy.VendorPassthru, 'continue_deploy',
@mock.patch.object(iscsi_deploy.ISCSIDeploy, 'continue_deploy',
spec_set=True, autospec=True)
def test_vendorpassthru_continue_deploy_localboot(self,
mock_pxe_vendorpassthru,
mock_ensure):
def test_continue_deploy_localboot(self, mock_continue, mock_ensure):
with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task:
task.node.provision_state = states.DEPLOYWAIT
task.node.target_provision_state = states.ACTIVE
task.node.instance_info['capabilities'] = {"boot_option": "local"}
task.driver.vendor.continue_deploy(task,)
task.driver.deploy.continue_deploy(task,)
self.assertFalse(mock_ensure.called)
mock_pxe_vendorpassthru.assert_called_once_with(
task.driver.vendor, task)
mock_continue.assert_called_once_with(
task.driver.deploy, task)

View File

@ -46,7 +46,6 @@ class PXEWakeOnLanISCSIDriver(base.BaseDriver):
self.boot = pxe.PXEBoot()
self.power = wol_power.WakeOnLanPower()
self.deploy = iscsi_deploy.ISCSIDeploy()
self.vendor = iscsi_deploy.VendorPassthru()
class PXEWakeOnLanAgentDriver(base.BaseDriver):
@ -64,4 +63,3 @@ class PXEWakeOnLanAgentDriver(base.BaseDriver):
self.boot = pxe.PXEBoot()
self.power = wol_power.WakeOnLanPower()
self.deploy = agent.AgentDeploy()
self.vendor = agent.AgentVendorInterface()

View File

@ -0,0 +1,20 @@
---
upgrade:
- Implementations and dependency on Ironic Python Agent (IPA)
lookup/heartbeats as vendor passthru methods is removed from
all drivers in ``ironic-staging-drivers`` as it has been deprecated
and removed from ironic as well.
Effectively, ``AMT``, ``iBoot``, ``Libvirt`` and ``WoL`` drivers
no longer have any vendor passthru methods.
``Intel NodeManager`` drivers still have most of their vendor passthru
methods related to IPMI and Intel NodeManager-specific extensions,
except for ``lookup`` and ``heartbeat`` vendor passthru methods.
This also means that drivers in ``ironic-staging-drivers`` are now
incompatible with ironic < 6.1.0 and IPA < 1.5.0.
On upgrade of ironic-staging-drivers, operators must ensure that their
ironic version and verison of IPA in deploy ramdisks is compatible and
upgrade those too if needed.
Users of custom (non-IPA-based) implementations for lookup/heartbeats
from ramdisk are required to update those to use ironic API v1.22.