From 28b37c1a707f5e958221b4ee28c4832d081eb706 Mon Sep 17 00:00:00 2001 From: Nikola Dipanov Date: Wed, 9 Jul 2014 11:59:15 +0200 Subject: Prepend '/dev/' to supplied dev names in the API Make sure that all user input device names end up in the database with the '/dev/' prefix. This will make things more consistent and avoid issues when attempting to parse device names. This includes two main sources - block device mapping that can be passed as part of a request or as image metadata, and root device name, passed as image metadata. Closes-bug: #1337821 Change-Id: Ibda82f511be99f1a68f2f77c72601a1b006be7a0 --- nova/block_device.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nova/block_device.py') diff --git a/nova/block_device.py b/nova/block_device.py index fbc87099db..b6dd12b64d 100644 --- a/nova/block_device.py +++ b/nova/block_device.py @@ -82,6 +82,8 @@ class BlockDeviceDict(dict): do_not_default = do_not_default or set() self._validate(bdm_dict) + if bdm_dict.get('device_name'): + bdm_dict['device_name'] = prepend_dev(bdm_dict['device_name']) # NOTE (ndipanov): Never default db fields self.update( dict((field, None) -- cgit v1.2.1