diff options
author | Dmitry Tantsur <divius.inside@gmail.com> | 2018-01-10 15:51:20 +0100 |
---|---|---|
committer | Ruby Loo <ruby.loo@intel.com> | 2018-01-17 20:19:22 +0000 |
commit | 0772e597273e6bd25280090ba4d6b74b3bab5719 (patch) | |
tree | 7f2bd82627bb9cf890692719a865e779738e9e89 | |
parent | 7eaa7e5e1133290b8fdbde51fbdacd8383f92141 (diff) | |
download | ironic-0772e597273e6bd25280090ba4d6b74b3bab5719.tar.gz |
Do not validate root partition size for whole disk images in iscsi deploy
On whole disk images a root partition is already created and populated, so
validating its size makes no sense. We don't do it for direct deploy.
Change-Id: I7a4114979afb310aeb77f99fbcf09ef7c54862d6
Closes-Bug: #1742451
(cherry picked from commit a7623d92dc4d7c7bcc436656b93c8fe963e79bfd)
-rw-r--r-- | ironic/drivers/modules/iscsi_deploy.py | 7 | ||||
-rw-r--r-- | ironic/tests/unit/drivers/modules/test_iscsi_deploy.py | 11 | ||||
-rw-r--r-- | releasenotes/notes/iscsi-whole-disk-cd464d589d029b01.yaml | 6 |
3 files changed, 24 insertions, 0 deletions
diff --git a/ironic/drivers/modules/iscsi_deploy.py b/ironic/drivers/modules/iscsi_deploy.py index 760f6820c..70a32e1c4 100644 --- a/ironic/drivers/modules/iscsi_deploy.py +++ b/ironic/drivers/modules/iscsi_deploy.py @@ -88,10 +88,17 @@ def _save_disk_layout(node, i_info): def check_image_size(task): """Check if the requested image is larger than the root partition size. + Does nothing for whole-disk images. + :param task: a TaskManager instance containing the node to act on. :raises: InstanceDeployFailure if size of the image is greater than root partition. """ + if task.node.driver_internal_info['is_whole_disk_image']: + # The root partition is already created and populated, no use + # validating its size + return + i_info = deploy_utils.parse_instance_info(task.node) image_path = _get_image_file_path(task.node.uuid) image_mb = disk_utils.get_image_mb(image_path) diff --git a/ironic/tests/unit/drivers/modules/test_iscsi_deploy.py b/ironic/tests/unit/drivers/modules/test_iscsi_deploy.py index a1f6a0e01..df4dc1648 100644 --- a/ironic/tests/unit/drivers/modules/test_iscsi_deploy.py +++ b/ironic/tests/unit/drivers/modules/test_iscsi_deploy.py @@ -116,6 +116,17 @@ class IscsiDeployMethodsTestCase(db_base.DbTestCase): iscsi_deploy._get_image_file_path(task.node.uuid)) @mock.patch.object(disk_utils, 'get_image_mb', autospec=True) + def test_check_image_size_whole_disk_image(self, get_image_mb_mock): + get_image_mb_mock.return_value = 1025 + with task_manager.acquire(self.context, self.node.uuid, + shared=False) as task: + task.node.instance_info['root_gb'] = 1 + task.node.driver_internal_info['is_whole_disk_image'] = True + # No error for whole disk images + iscsi_deploy.check_image_size(task) + self.assertFalse(get_image_mb_mock.called) + + @mock.patch.object(disk_utils, 'get_image_mb', autospec=True) def test_check_image_size_fails(self, get_image_mb_mock): get_image_mb_mock.return_value = 1025 with task_manager.acquire(self.context, self.node.uuid, diff --git a/releasenotes/notes/iscsi-whole-disk-cd464d589d029b01.yaml b/releasenotes/notes/iscsi-whole-disk-cd464d589d029b01.yaml new file mode 100644 index 000000000..e910b3212 --- /dev/null +++ b/releasenotes/notes/iscsi-whole-disk-cd464d589d029b01.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + No longer validates requested root partition size for whole-disk images + using ``iscsi`` deploy interface, see `bug 1742451 + <https://bugs.launchpad.net/ironic/+bug/1742451>`_ for details. |