Boot from volume fails with 'iscsi' deploy interface

When boot from volume is requested for a node with 'iscsi' deploy
interface and no 'image_source' is provided in
'node.instance_info'. It calls boot.prepare_ramdisk() and fails
while trying to perform validation for 'image_source'. This commit
fixes the issue.

Closes-Bug: #1714147

Change-Id: Ia3bad7f3325576ba091284f9b63b67a1b26cb3b7
This commit is contained in:
Shivanand Tendulker 2017-08-31 00:25:56 -04:00
parent 9daabbbb05
commit e9ecdbbadc
3 changed files with 17 additions and 4 deletions

View File

@ -528,6 +528,11 @@ class ISCSIDeploy(AgentDeployMixin, base.DeployInterface):
task.driver.network.unconfigure_tenant_networks(task)
task.driver.network.add_provisioning_network(task)
task.driver.storage.attach_volumes(task)
if not task.driver.storage.should_write_image(task):
# We have nothing else to do as this is handled in the
# backend storage system, and we can return to the caller
# as we do not need to boot the agent to deploy.
return
deploy_opts = deploy_utils.build_agent_options(node)
task.driver.boot.prepare_ramdisk(task, deploy_opts)

View File

@ -681,15 +681,14 @@ class ISCSIDeployTestCase(db_base.DbTestCase):
task.driver.deploy.prepare(task)
mock_agent_options.assert_called_once_with(task.node)
mock_prepare_ramdisk.assert_called_once_with(
task.driver.boot, task, {'c': 'd'})
self.assertFalse(mock_agent_options.called)
self.assertFalse(mock_prepare_ramdisk.called)
self.assertFalse(add_provisioning_net_mock.called)
self.assertFalse(unconfigure_tenant_net_mock.called)
storage_driver_info_mock.assert_called_once_with(task)
storage_attach_volumes_mock.assert_called_once_with(
task.driver.storage, task)
self.assertEqual(1, storage_should_write_mock.call_count)
self.assertEqual(2, storage_should_write_mock.call_count)
@mock.patch.object(manager_utils, 'node_power_action', autospec=True)
@mock.patch.object(iscsi_deploy, 'check_image_size', autospec=True)

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Fixes an issue in boot from volume for ``iscsi`` deploy interface. Boot
from a volume fails when it is requested for a node having ``iscsi``
deploy interface and no ``image_source`` is provided in node's
``node.instance_info``. It fails while trying to perform validation of
``image_source``. See `bug 1714147
<https://bugs.launchpad.net/ironic/+bug/1714147>`_ for details.