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:
parent
4d432413e1
commit
899e952ed6
|
@ -16,6 +16,7 @@
|
||||||
import eventlet
|
import eventlet
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.engine.resources import Resource
|
from heat.engine.resources import Resource
|
||||||
|
@ -101,6 +102,16 @@ class VolumeAttachment(Resource):
|
||||||
else:
|
else:
|
||||||
self.state_set(self.CREATE_FAILED)
|
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):
|
def delete(self):
|
||||||
if self.state == self.DELETE_IN_PROGRESS or \
|
if self.state == self.DELETE_IN_PROGRESS or \
|
||||||
self.state == self.DELETE_COMPLETE:
|
self.state == self.DELETE_COMPLETE:
|
||||||
|
|
Loading…
Reference in New Issue