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
This commit is contained in:
parent
d491ef543a
commit
a7623d92dc
@ -88,10 +88,17 @@ def _save_disk_layout(node, i_info):
|
|||||||
def check_image_size(task):
|
def check_image_size(task):
|
||||||
"""Check if the requested image is larger than the root partition size.
|
"""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.
|
:param task: a TaskManager instance containing the node to act on.
|
||||||
:raises: InstanceDeployFailure if size of the image is greater than root
|
:raises: InstanceDeployFailure if size of the image is greater than root
|
||||||
partition.
|
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)
|
i_info = deploy_utils.parse_instance_info(task.node)
|
||||||
image_path = _get_image_file_path(task.node.uuid)
|
image_path = _get_image_file_path(task.node.uuid)
|
||||||
image_mb = disk_utils.get_image_mb(image_path)
|
image_mb = disk_utils.get_image_mb(image_path)
|
||||||
|
@ -117,6 +117,17 @@ class IscsiDeployMethodsTestCase(db_base.DbTestCase):
|
|||||||
get_image_mb_mock.assert_called_once_with(
|
get_image_mb_mock.assert_called_once_with(
|
||||||
iscsi_deploy._get_image_file_path(task.node.uuid))
|
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)
|
@mock.patch.object(disk_utils, 'get_image_mb', autospec=True)
|
||||||
def test_check_image_size_fails(self, get_image_mb_mock):
|
def test_check_image_size_fails(self, get_image_mb_mock):
|
||||||
get_image_mb_mock.return_value = 1025
|
get_image_mb_mock.return_value = 1025
|
||||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user