Merge "Test that configdrive disk exist with test -e"

This commit is contained in:
Jenkins 2017-03-23 12:00:40 +00:00 committed by Gerrit Code Review
commit ccfb67bb82
2 changed files with 17 additions and 8 deletions

View File

@ -789,13 +789,19 @@ def create_config_drive_partition(node_uuid, device, configdrive):
else:
config_drive_part = '%s%s' % (device, new_part.pop())
# NOTE(vdrok): the partition was created successfully, let's wait
# for it to appear in /dev.
LOG.debug('Waiting until udev event queue is empty')
utils.execute('udevadm', 'settle')
# NOTE(vsaienko): check that devise actually exists,
# it is not handled by udevadm when using ISCSI, for more info see:
# https://bugs.launchpad.net/ironic/+bug/1673731
# Do not use 'udevadm settle --exit-if-exist' here
LOG.debug('Waiting for the config drive partition %(part)s '
'on node %(node)s to be ready for writing.',
{'part': config_drive_part, 'node': node_uuid})
utils.execute('udevadm', 'settle',
'--exit-if-exists=%s' % config_drive_part)
utils.execute('test', '-e', config_drive_part,
check_exit_code=[0], attempts=15,
delay_on_retry=True)
dd(confdrive_file, config_drive_part)
LOG.info("Configdrive for node %(node)s successfully "

View File

@ -1047,9 +1047,11 @@ class WholeDiskConfigDriveTestCases(test_base.BaseTestCase):
mock_execute.assert_has_calls([
mock.call('sgdisk', '-n', '0:-64MB:0', self.dev,
run_as_root=True),
mock.call('udevadm', 'settle',
'--exit-if-exists=%s' % expected_part),
mock.call('udevadm', 'settle'),
mock.call('test', '-e', expected_part, attempts=15,
check_exit_code=[0], delay_on_retry=True)
])
self.assertEqual(2, mock_list_partitions.call_count)
mock_is_disk_gpt.assert_called_with(self.dev, self.node_uuid)
mock_fix_gpt.assert_called_with(self.dev, self.node_uuid)
@ -1137,8 +1139,9 @@ class WholeDiskConfigDriveTestCases(test_base.BaseTestCase):
'-0', run_as_root=True)
mock_execute.assert_has_calls([
parted_call,
mock.call('udevadm', 'settle',
'--exit-if-exists=%s' % expected_part),
mock.call('udevadm', 'settle'),
mock.call('test', '-e', expected_part, attempts=15,
check_exit_code=[0], delay_on_retry=True)
])
self.assertEqual(2, mock_list_partitions.call_count)
mock_is_disk_gpt.assert_called_with(self.dev, self.node_uuid)