From d5e6b713526063e4820f552a5ef3ac9d92326d3a Mon Sep 17 00:00:00 2001 From: Ramakrishnan G Date: Fri, 6 Mar 2015 15:42:42 +0000 Subject: [PATCH] Add label to virtual floppy image This commit adds a label "ir-vfd-dev" to the virtual floppy image that is created by Ironic for virtual media deploy. This helps ramdisks to find the partition by using /dev/disk/by-label/ir-vfd-dev. Closes-Bug: #1429340 Change-Id: If5b78d9af7048f2631d050ee5ce01ab7a67e2354 --- ironic/common/images.py | 5 ++++- ironic/tests/test_images.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ironic/common/images.py b/ironic/common/images.py index 5a18edf913..8919055e04 100644 --- a/ironic/common/images.py +++ b/ironic/common/images.py @@ -112,7 +112,10 @@ def create_vfat_image(output_file, files_info=None, parameters=None, with utils.tempdir() as tmpdir: try: - utils.mkfs('vfat', output_file) + # The label helps ramdisks to find the partition containing + # the parameters (by using /dev/disk/by-label/ir-vfd-dev). + # NOTE: FAT filesystem label can be up to 11 characters long. + utils.mkfs('vfat', output_file, label="ir-vfd-dev") utils.mount(output_file, tmpdir, '-o', 'umask=0') except processutils.ProcessExecutionError as e: raise exception.ImageCreationFailed(image_type='vfat', error=e) diff --git a/ironic/tests/test_images.py b/ironic/tests/test_images.py index 8d07f8cda2..60b706dea0 100644 --- a/ironic/tests/test_images.py +++ b/ironic/tests/test_images.py @@ -270,7 +270,8 @@ class FsImageTestCase(base.TestCase): 'count=1', 'bs=1000KiB') - mkfs_mock.assert_called_once_with('vfat', 'tgt_file') + mkfs_mock.assert_called_once_with('vfat', 'tgt_file', + label="ir-vfd-dev") mount_mock.assert_called_once_with('tgt_file', 'tempdir', '-o', 'umask=0')