Raise an error for a disk size that is too small

This commit is contained in:
Joseph Hall 2017-02-03 14:21:59 -07:00
parent 8c0dc9162a
commit 671282656a

View file

@ -644,9 +644,17 @@ def _manage_devices(devices, vm=None, container_ref=None):
' Using existing disk size.')
size_kb = device.capacityInKB
log.debug('device capacity is {0}'.format(device.capacityInKB))
log.debug('specified capacity is {0}'.format(size_kb))
if device.capacityInKB < size_kb:
# expand the disk
disk_spec = _edit_existing_hard_disk_helper(device, size_kb)
elif device.capacityInKB < size_kb:
raise SaltCloudSystemExit(
'The specified disk size is smaller than the '
'size of the disk image. It must be equal to '
'or greater than the disk image'
)
if 'mode' in devices['disk'][device.deviceInfo.label]:
if devices['disk'][device.deviceInfo.label]['mode'] \