summaryrefslogtreecommitdiff
path: root/ironic
diff options
context:
space:
mode:
Diffstat (limited to 'ironic')
-rw-r--r--ironic/common/hash_ring.py4
-rw-r--r--ironic/conf/ilo.py2
-rw-r--r--ironic/conf/pxe.py2
-rw-r--r--ironic/conf/redfish.py2
-rw-r--r--ironic/db/sqlalchemy/__init__.py4
-rw-r--r--ironic/drivers/modules/redfish/management.py11
-rw-r--r--ironic/tests/unit/common/test_hash_ring.py2
-rw-r--r--ironic/tests/unit/drivers/modules/network/test_common.py10
-rw-r--r--ironic/tests/unit/drivers/modules/redfish/test_management.py10
-rw-r--r--ironic/tests/unit/drivers/modules/test_image_utils.py8
-rw-r--r--ironic/tests/unit/drivers/modules/test_ipxe.py2
11 files changed, 40 insertions, 17 deletions
diff --git a/ironic/common/hash_ring.py b/ironic/common/hash_ring.py
index 1f1107008..8986d5bd2 100644
--- a/ironic/common/hash_ring.py
+++ b/ironic/common/hash_ring.py
@@ -40,7 +40,7 @@ class HashRingManager(object):
@property
def ring(self):
interval = CONF.hash_ring_reset_interval
- limit = time.time() - interval
+ limit = time.monotonic() - interval
if not self.cache:
return self._load_hash_rings()
@@ -56,7 +56,7 @@ class HashRingManager(object):
if hash_rings is None or updated_at < limit:
LOG.debug('Rebuilding cached hash rings')
hash_rings = self._load_hash_rings()
- self.__class__._hash_rings = hash_rings, time.time()
+ self.__class__._hash_rings = hash_rings, time.monotonic()
LOG.debug('Finished rebuilding hash rings, available drivers '
'are %s', ', '.join(hash_rings))
return hash_rings
diff --git a/ironic/conf/ilo.py b/ironic/conf/ilo.py
index 197378ce7..6d1c52dd2 100644
--- a/ironic/conf/ilo.py
+++ b/ironic/conf/ilo.py
@@ -112,7 +112,7 @@ opts = [
'This setting must be set to the octal number '
'representation, meaning starting with ``0o``.')),
cfg.StrOpt('kernel_append_params',
- default='nofb nomodeset vga=normal',
+ default='nofb vga=normal',
mutable=True,
help=_('Additional kernel parameters to pass down to the '
'instance kernel. These parameters can be consumed by '
diff --git a/ironic/conf/pxe.py b/ironic/conf/pxe.py
index d96712824..e4c912192 100644
--- a/ironic/conf/pxe.py
+++ b/ironic/conf/pxe.py
@@ -24,7 +24,7 @@ from ironic.common.i18n import _
opts = [
cfg.StrOpt('kernel_append_params',
deprecated_name='pxe_append_params',
- default='nofb nomodeset vga=normal',
+ default='nofb vga=normal',
mutable=True,
help=_('Additional append parameters for baremetal PXE boot.')),
cfg.StrOpt('default_ephemeral_format',
diff --git a/ironic/conf/redfish.py b/ironic/conf/redfish.py
index 3cc9fe015..68aa96141 100644
--- a/ironic/conf/redfish.py
+++ b/ironic/conf/redfish.py
@@ -64,7 +64,7 @@ opts = [
'auto-expire. Applies only when `use_swift` is '
'enabled.')),
cfg.StrOpt('kernel_append_params',
- default='nofb nomodeset vga=normal',
+ default='nofb vga=normal',
mutable=True,
help=_('Additional kernel parameters to pass down to the '
'instance kernel. These parameters can be consumed by '
diff --git a/ironic/db/sqlalchemy/__init__.py b/ironic/db/sqlalchemy/__init__.py
index c656ed227..f92a0b600 100644
--- a/ironic/db/sqlalchemy/__init__.py
+++ b/ironic/db/sqlalchemy/__init__.py
@@ -17,10 +17,8 @@ from sqlalchemy import event
CONF = cfg.CONF
-# FIXME(stephenfin): we need to remove reliance on autocommit semantics ASAP
-# since it's not compatible with SQLAlchemy 2.0
# NOTE(dtantsur): we want sqlite as close to a real database as possible.
-enginefacade.configure(sqlite_fk=True, __autocommit=True)
+enginefacade.configure(sqlite_fk=True)
# NOTE(TheJulia): Setup a listener to trigger the sqlite write-ahead
diff --git a/ironic/drivers/modules/redfish/management.py b/ironic/drivers/modules/redfish/management.py
index a669d09bc..8bd7058a5 100644
--- a/ironic/drivers/modules/redfish/management.py
+++ b/ironic/drivers/modules/redfish/management.py
@@ -1197,9 +1197,18 @@ class RedfishManagement(base.ManagementInterface):
:raises: RedfishError on an error from the Sushy library
:returns: A list of MAC addresses for the node
"""
+ system = redfish_utils.get_system(task.node)
try:
- system = redfish_utils.get_system(task.node)
return list(redfish_utils.get_enabled_macs(task, system))
+ # NOTE(janders) we should handle MissingAttributeError separately
+ # from other SushyErrors - some servers (e.g. some Cisco UCSB and UCSX
+ # blades) are missing EthernetInterfaces attribute yet could be
+ # provisioned successfully if MAC information is provided manually AND
+ # this exception is caught and handled accordingly.
+ except sushy.exceptions.MissingAttributeError as exc:
+ LOG.warning('Cannot get MAC addresses for node %(node)s: %(exc)s',
+ {'node': task.node.uuid, 'exc': exc})
+ # if the exception is not a MissingAttributeError, raise it
except sushy.exceptions.SushyError as exc:
msg = (_('Failed to get network interface information on node '
'%(node)s: %(exc)s')
diff --git a/ironic/tests/unit/common/test_hash_ring.py b/ironic/tests/unit/common/test_hash_ring.py
index 9ecf34562..a84b9ffcf 100644
--- a/ironic/tests/unit/common/test_hash_ring.py
+++ b/ironic/tests/unit/common/test_hash_ring.py
@@ -129,7 +129,7 @@ class HashRingManagerTestCase(db_base.DbTestCase):
self.ring_manager.__class__._hash_rings = (
self.ring_manager.__class__._hash_rings[0],
- time.time() - 31
+ time.monotonic() - 31
)
ring = self.ring_manager.get_ring('hardware-type', '')
self.assertEqual(2, len(ring))
diff --git a/ironic/tests/unit/drivers/modules/network/test_common.py b/ironic/tests/unit/drivers/modules/network/test_common.py
index 7b907ad22..e58fcaa20 100644
--- a/ironic/tests/unit/drivers/modules/network/test_common.py
+++ b/ironic/tests/unit/drivers/modules/network/test_common.py
@@ -1065,10 +1065,14 @@ class TestNeutronVifPortIDMixin(db_base.DbTestCase):
expected_dhcp_opts = [{'opt_name': '61', 'opt_value': 'fake2'}]
self.port.extra = expected_extra
self.port.internal_info = expected_ii
+ what_changed_mock = mock.Mock()
+ what_changed_mock.return_value = ['extra', 'internal_info']
+ self.port.obj_what_changed = what_changed_mock
with task_manager.acquire(self.context, self.node.id) as task:
self.interface.port_changed(task, self.port)
dhcp_update_mock.assert_called_once_with(
mock.ANY, 'fake-id', expected_dhcp_opts, context=task.context)
+ self.assertEqual(2, what_changed_mock.call_count)
@mock.patch('ironic.dhcp.neutron.NeutronDHCPApi.update_port_dhcp_opts',
autospec=True)
@@ -1087,14 +1091,16 @@ class TestNeutronVifPortIDMixin(db_base.DbTestCase):
def test_port_changed_client_id_fail(self, dhcp_update_mock):
self.port.internal_info = {'tenant_vif_port_id': 'fake-id'}
self.port.extra = {'client-id': 'fake3'}
- # NOTE(TheJulia): Does not save, because it attempts to figure
- # out what has changed as part of the test.
+ what_changed_mock = mock.Mock()
+ what_changed_mock.return_value = ['extra']
+ self.port.obj_what_changed = what_changed_mock
dhcp_update_mock.side_effect = (
exception.FailedToUpdateDHCPOptOnPort(port_id=self.port.uuid))
with task_manager.acquire(self.context, self.node.id) as task:
self.assertRaises(exception.FailedToUpdateDHCPOptOnPort,
self.interface.port_changed,
task, self.port)
+ self.assertEqual(2, what_changed_mock.call_count)
@mock.patch('ironic.dhcp.neutron.NeutronDHCPApi.update_port_dhcp_opts',
autospec=True)
diff --git a/ironic/tests/unit/drivers/modules/redfish/test_management.py b/ironic/tests/unit/drivers/modules/redfish/test_management.py
index f8c82949a..1d752d909 100644
--- a/ironic/tests/unit/drivers/modules/redfish/test_management.py
+++ b/ironic/tests/unit/drivers/modules/redfish/test_management.py
@@ -1598,3 +1598,13 @@ class RedfishManagementTestCase(db_base.DbTestCase):
shared=True) as task:
self.assertEqual([],
task.driver.management.get_mac_addresses(task))
+
+ @mock.patch.object(redfish_utils, 'get_enabled_macs', autospec=True)
+ @mock.patch.object(redfish_utils, 'get_system', autospec=True)
+ def test_get_mac_addresses_missing_attr(self, mock_get_system,
+ mock_get_enabled_macs):
+ redfish_utils.get_enabled_macs.side_effect = (sushy.exceptions.
+ MissingAttributeError)
+ with task_manager.acquire(self.context, self.node.uuid,
+ shared=True) as task:
+ self.assertIsNone(task.driver.management.get_mac_addresses(task))
diff --git a/ironic/tests/unit/drivers/modules/test_image_utils.py b/ironic/tests/unit/drivers/modules/test_image_utils.py
index b6c572125..fbb6318fe 100644
--- a/ironic/tests/unit/drivers/modules/test_image_utils.py
+++ b/ironic/tests/unit/drivers/modules/test_image_utils.py
@@ -583,7 +583,7 @@ class RedfishImageUtilsTestCase(db_base.DbTestCase):
mock_create_boot_iso.assert_called_once_with(
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
boot_mode='uefi', esp_image_href='http://bootloader/img',
- kernel_params='nofb nomodeset vga=normal',
+ kernel_params='nofb vga=normal',
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
inject_files=None)
@@ -604,7 +604,7 @@ class RedfishImageUtilsTestCase(db_base.DbTestCase):
mock_create_boot_iso.assert_called_once_with(
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
boot_mode='uefi', esp_image_href=None,
- kernel_params='nofb nomodeset vga=normal',
+ kernel_params='nofb vga=normal',
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
inject_files=None)
@@ -633,7 +633,7 @@ class RedfishImageUtilsTestCase(db_base.DbTestCase):
mock_create_boot_iso.assert_called_once_with(
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
boot_mode='bios', esp_image_href=None,
- kernel_params='nofb nomodeset vga=normal',
+ kernel_params='nofb vga=normal',
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
inject_files=None)
@@ -702,7 +702,7 @@ class RedfishImageUtilsTestCase(db_base.DbTestCase):
mock_create_boot_iso.assert_called_once_with(
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
boot_mode='uefi', esp_image_href=None,
- kernel_params=f'nofb nomodeset vga=normal {kernel_params}',
+ kernel_params=f'nofb vga=normal {kernel_params}',
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
inject_files=None)
diff --git a/ironic/tests/unit/drivers/modules/test_ipxe.py b/ironic/tests/unit/drivers/modules/test_ipxe.py
index ef37e3fc4..02d254b5a 100644
--- a/ironic/tests/unit/drivers/modules/test_ipxe.py
+++ b/ironic/tests/unit/drivers/modules/test_ipxe.py
@@ -813,7 +813,7 @@ class iPXEBootTestCase(db_base.DbTestCase):
'aki_path': 'http://192.1.2.3:1234/' + uuid + '/kernel',
'ari_path': 'http://192.1.2.3:1234/' + uuid + '/ramdisk',
'ramdisk_opts': 'cat meow',
- 'pxe_append_params': 'nofb nomodeset vga=normal ipa-debug=1 '
+ 'pxe_append_params': 'nofb vga=normal ipa-debug=1 '
'ipa-global-request-'
'id=' + task.context.request_id,
'tftp_server': mock.ANY,