From 0edba8a86ca78cf73780b0f0fca5bbdc56f1e54a Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Tue, 19 Jan 2016 13:45:47 +0000 Subject: [PATCH] Extend root device hints to support device name This patch is extending the root device hints to support the device name as input. It's important to note that for SATA, SCSI and IDE disk controllers the name is not recommended to be used because the order in which the device nodes are added in Linux is arbitrary, resulting in devices like /dev/sda and /dev/sdb switching around at boot time. The documentation was updated to inform operators about this problem. Depends-On: I48d6456c75bbe6ddf16ac6561e5461ca51eb9c37 Change-Id: I564d68ab1c66505195745c34e16e829b45a00a75 Closes-Bug: #1526732 --- doc/source/deploy/install-guide.rst | 27 ++++++++++--------- ironic/drivers/modules/deploy_utils.py | 3 ++- .../unit/drivers/modules/test_deploy_utils.py | 4 +-- ...me-root-device-hints-a1484ea01e399065.yaml | 3 +++ 4 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 releasenotes/notes/name-root-device-hints-a1484ea01e399065.yaml diff --git a/doc/source/deploy/install-guide.rst b/doc/source/deploy/install-guide.rst index a2577e0258..7683bc7b67 100644 --- a/doc/source/deploy/install-guide.rst +++ b/doc/source/deploy/install-guide.rst @@ -1802,16 +1802,9 @@ The node should be in MANAGEABLE state before inspection is initiated. Specifying the disk for deployment ================================== -Starting with the Kilo release, Bare Metal service supports passing hints to the -deploy ramdisk about which disk it should pick for the deployment. In -Linux when a server has more than one SATA, SCSI or IDE disk controller, -the order in which their corresponding device nodes are added is arbitrary -[`link`_], resulting in devices like ``/dev/sda`` and ``/dev/sdb`` to -switch around between reboots. Therefore, to guarantee that a specific -disk is always chosen for the deployment, Bare Metal service introduced -root device hints. - -The list of support hints is: +Starting with the Kilo release, Bare Metal service supports passing +hints to the deploy ramdisk about which disk it should pick for the +deployment. The list of support hints is: * model (STRING): device identifier * vendor (STRING): device vendor @@ -1828,6 +1821,17 @@ The list of support hints is: * wwn (STRING): unique storage identifier * wwn_with_extension (STRING): unique storage identifier with the vendor extension appended * wwn_vendor_extension (STRING): unique vendor storage identifier +* name (STRING): the device name, e.g /dev/md0 + + + .. warning:: + The root device hint name should only be used for devices with + constant names (e.g RAID volumes). For SATA, SCSI and IDE disk + controllers this hint is not recommended because the order in which + the device nodes are added in Linux is arbitrary, resulting in + devices like /dev/sda and /dev/sdb `switching around at boot time + `_. + To associate one or more hints with a node, update the node's properties with a ``root_device`` key, for example:: @@ -1843,9 +1847,6 @@ can not be found. If multiple hints are specified, a device must satisfy all the hints. -.. _`link`: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Storage_Administration_Guide/persistent_naming.html - - .. _EnableHTTPSinSwift: Enabling HTTPS in Swift diff --git a/ironic/drivers/modules/deploy_utils.py b/ironic/drivers/modules/deploy_utils.py index 2a2767edc4..2148172290 100644 --- a/ironic/drivers/modules/deploy_utils.py +++ b/ironic/drivers/modules/deploy_utils.py @@ -85,7 +85,8 @@ if CONF.rootwrap_config != '/etc/ironic/rootwrap.conf': LOG = logging.getLogger(__name__) VALID_ROOT_DEVICE_HINTS = set(('size', 'model', 'wwn', 'serial', 'vendor', - 'wwn_with_extension', 'wwn_vendor_extension')) + 'wwn_with_extension', 'wwn_vendor_extension', + 'name')) SUPPORTED_CAPABILITIES = { 'boot_option': ('local', 'netboot'), diff --git a/ironic/tests/unit/drivers/modules/test_deploy_utils.py b/ironic/tests/unit/drivers/modules/test_deploy_utils.py index 67fa37bab0..3309432283 100644 --- a/ironic/tests/unit/drivers/modules/test_deploy_utils.py +++ b/ironic/tests/unit/drivers/modules/test_deploy_utils.py @@ -1203,10 +1203,10 @@ class OtherFunctionTestCase(db_base.DbTestCase): def test_parse_root_device_hints(self): self.node.properties['root_device'] = { 'wwn': 123456, 'model': 'foo-model', 'size': 123, - 'serial': 'foo-serial', 'vendor': 'foo-vendor', + 'serial': 'foo-serial', 'vendor': 'foo-vendor', 'name': '/dev/sda', 'wwn_with_extension': 123456111, 'wwn_vendor_extension': 111, } - expected = ('model=foo-model,serial=foo-serial,size=123,' + expected = ('model=foo-model,name=/dev/sda,serial=foo-serial,size=123,' 'vendor=foo-vendor,wwn=123456,wwn_vendor_extension=111,' 'wwn_with_extension=123456111') result = utils.parse_root_device_hints(self.node) diff --git a/releasenotes/notes/name-root-device-hints-a1484ea01e399065.yaml b/releasenotes/notes/name-root-device-hints-a1484ea01e399065.yaml new file mode 100644 index 0000000000..90f8f46abd --- /dev/null +++ b/releasenotes/notes/name-root-device-hints-a1484ea01e399065.yaml @@ -0,0 +1,3 @@ +--- +features: + - Root device hints extended to support the device name.