Validate invalid mountpoint.device entries

Since KVM only allows /dev/vd[a-z], we validate that implementation-specific
sd[a-z] is rejected by heat validation.

See:
http://docs.openstack.org/trunk/openstack-compute/admin/content/managing-volumes.html
Search device name

Resolves issue #71

Signed-off-by: Steven Dake <sdake@redhat.com>
This commit is contained in:
Steven Dake 2012-05-09 13:35:22 -07:00
parent 4d432413e1
commit 899e952ed6
1 changed files with 11 additions and 0 deletions

View File

@ -16,6 +16,7 @@
import eventlet
import logging
import os
import re
from heat.common import exception
from heat.engine.resources import Resource
@ -101,6 +102,16 @@ class VolumeAttachment(Resource):
else:
self.state_set(self.CREATE_FAILED)
def validate(self):
'''
Validate the mountpoint device
'''
device_re = re.compile('/dev/vd[b-z]')
if re.match(device_re, self.t['Properties']['Device']):
return None
else:
return 'MountPoint.Device must be in format /dev/vd[b-z]'
def delete(self):
if self.state == self.DELETE_IN_PROGRESS or \
self.state == self.DELETE_COMPLETE: