Merge "Use delay configoption for ssh.SSHPower drivers"
This commit is contained in:
commit
09de906fe3
@ -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)
|
||||
|
@ -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):
|
||||
|
@ -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.
|
Loading…
x
Reference in New Issue
Block a user