From ed4f9ca54b778de83ff4fbfa85c60f355e6fa4f6 Mon Sep 17 00:00:00 2001 From: Renuka Apte Date: Mon, 4 Jun 2012 13:48:34 -0700 Subject: [PATCH] Boot from volume for Xen Implements bp xenapi-boot-from-volume Ensure boot from volume works for XenAPI (tested using XenServer). 1. Add strip_prefix to block_device to make the command mountpoint agnostic. 2. Pass block device and delete on terminate information to driver layer. 3. Add ability to recognize and boot from the specified nova volume. Change-Id: If117087086eab809217d2b173f921bf9319a52c7 --- nova/block_device.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nova/block_device.py b/nova/block_device.py index 1b7d38145..caa521e83 100644 --- a/nova/block_device.py +++ b/nova/block_device.py @@ -72,3 +72,12 @@ _dev = re.compile('^/dev/') def strip_dev(device_name): """remove leading '/dev/'""" return _dev.sub('', device_name) + + +_pref = re.compile('^((x?v|s)d)') + + +def strip_prefix(device_name): + """ remove both leading /dev/ and xvd or sd or vd """ + device_name = strip_dev(device_name) + return _pref.sub('', device_name)