Use delay configoption for ssh.SSHPower drivers

In Newton (6.0.0), the configuration option
'[neutron]/port_setup_delay' was introduced [1].
In order not to break ssh power drivers, if that
option was set to 0 (default value), we coded it
to be 15 seconds.

The deprecation period for that is over; this
removes that code. Users should explicitly set the
option to the desired value.

[1] https://review.openstack.org/#/c/293876/

Change-Id: Iffddb1087dcb424101bf693d4c2ae83e1639fd17
Fixes-Bug: #1661050
This commit is contained in:
Ruby Loo 2017-02-01 17:33:58 +00:00
parent 965619314d
commit 2a086dbf1b
3 changed files with 9 additions and 51 deletions

View File

@ -26,7 +26,6 @@ from ironic.common import network
from ironic.common import neutron
from ironic.conf import CONF
from ironic.dhcp import base
from ironic.drivers.modules import ssh
from ironic import objects
LOG = logging.getLogger(__name__)
@ -146,14 +145,6 @@ class NeutronDHCPApi(base.BaseDHCP):
# sufficient DHCP config for netboot. It may occur when we are using
# VMs or hardware server with fast boot enabled.
port_delay = CONF.neutron.port_setup_delay
# TODO(vsaienko) remove hardcoded value for SSHPower driver
# after Newton release.
if isinstance(task.driver.power, ssh.SSHPower) and port_delay == 0:
LOG.warning(_LW("Setting the port delay to 15 for SSH power "
"driver by default, this will be removed in "
"Ocata release. Please set configuration "
"parameter port_setup_delay to 15."))
port_delay = 15
if port_delay != 0:
LOG.debug("Waiting %d seconds for Neutron.", port_delay)
time.sleep(port_delay)

View File

@ -25,7 +25,6 @@ from ironic.common import exception
from ironic.common import pxe_utils
from ironic.conductor import task_manager
from ironic.dhcp import neutron
from ironic.drivers.modules import ssh
from ironic.tests.unit.conductor import mgr_utils
from ironic.tests.unit.db import base as db_base
from ironic.tests.unit.objects import utils as object_utils
@ -162,45 +161,6 @@ class TestNeutron(db_base.DbTestCase):
mock_gnvi.assert_called_once_with(task)
self.assertEqual(2, mock_updo.call_count)
@mock.patch('time.sleep', autospec=True)
@mock.patch.object(neutron.NeutronDHCPApi, 'update_port_dhcp_opts',
autospec=True)
@mock.patch('ironic.common.network.get_node_vif_ids', autospec=True)
def test_update_dhcp_set_sleep_and_ssh(self, mock_gnvi, mock_updo,
mock_ts):
mock_gnvi.return_value = {'ports': {'port-uuid': 'vif-uuid'},
'portgroups': {}}
self.config(port_setup_delay=30, group='neutron')
with task_manager.acquire(self.context,
self.node.uuid) as task:
task.driver.power = ssh.SSHPower()
opts = pxe_utils.dhcp_options_for_instance(task)
api = dhcp_factory.DHCPFactory()
api.update_dhcp(task, opts)
mock_ts.assert_called_with(30)
mock_updo.assert_called_once_with(mock.ANY, 'vif-uuid', opts)
@mock.patch.object(neutron, 'LOG', autospec=True)
@mock.patch('time.sleep', autospec=True)
@mock.patch.object(neutron.NeutronDHCPApi, 'update_port_dhcp_opts',
autospec=True)
@mock.patch('ironic.common.network.get_node_vif_ids', autospec=True)
def test_update_dhcp_unset_sleep_and_ssh(self, mock_gnvi, mock_updo,
mock_ts, mock_log):
mock_gnvi.return_value = {'ports': {'port-uuid': 'vif-uuid'},
'portgroups': {}}
with task_manager.acquire(self.context,
self.node.uuid) as task:
opts = pxe_utils.dhcp_options_for_instance(task)
task.driver.power = ssh.SSHPower()
api = dhcp_factory.DHCPFactory()
api.update_dhcp(task, opts)
self.assertTrue(mock_log.warning.called)
self.assertIn('Setting the port delay to 15 for SSH',
mock_log.warning.call_args[0][0])
mock_ts.assert_called_with(15)
mock_updo.assert_called_once_with(mock.ANY, 'vif-uuid', opts)
@mock.patch.object(neutron, 'LOG', autospec=True)
@mock.patch('time.sleep', autospec=True)
@mock.patch.object(neutron.NeutronDHCPApi, 'update_port_dhcp_opts',
@ -218,7 +178,6 @@ class TestNeutron(db_base.DbTestCase):
api.update_dhcp(task, opts)
mock_log.debug.assert_called_once_with(
"Waiting %d seconds for Neutron.", 30)
mock_log.warning.assert_not_called()
mock_ts.assert_called_with(30)
mock_updo.assert_called_once_with(mock.ANY, 'vif-uuid', opts)
@ -236,7 +195,6 @@ class TestNeutron(db_base.DbTestCase):
api = dhcp_factory.DHCPFactory()
api.update_dhcp(task, opts)
mock_log.debug.assert_not_called()
mock_log.warning.assert_not_called()
mock_updo.assert_called_once_with(mock.ANY, 'vif-uuid', opts)
def test__get_fixed_ip_address(self):

View File

@ -0,0 +1,9 @@
---
upgrade:
- |
For SSH power drivers, if the configuration option
``[neutron]/port_setup_delay`` had been set to 0,
a delay of 15 seconds was used. This is no longer
the case. Please set the configuration option to
the desired value; otherwise the service will not
wait for Neutron agents to set up a port.