Howdy guys,
So I've been using the openstack driver as a backend for heat ->
deltacloud work. I just posted a few patches to resolve issues that I
have run into but I've now hit a more serious roadblock and that is the
lack of volume support for openstack.
In heat we do create:
vol = self.nova('volume').volumes.create(self.properties['Size'],
display_name=self.physical_resource_name(),
display_description=self.physical_resource_name())
Check state and delete:
vol = self.nova('volume').volumes.get(self.instance_id)
if vol.status == 'in-use':
logger.warn('cant delete volume when in-use')
raise exception.Error("Volume in use")
self.nova('volume').volumes.delete(self.instance_id)
Attachment with verify:
va = volapi.create_server_volume(server_id=server_id,
volume_id=volume_id,
device=self.properties['Device'])
vol = self.nova('volume').volumes.get(va.id)
while vol.status == 'available' or vol.status == 'attaching':
eventlet.sleep(1)
vol.get()
if vol.status == 'in-use':
self.instance_id_set(va.id)
Removal and verify:
volapi.delete_server_volume(server_id,
volume_id)
vol = self.nova('volume').volumes.get(volume_id)
logger.info('un-attaching %s, status %s' % (volume_id, vol.status))
while vol.status == 'in-use':
logger.info('trying to un-attach %s, but still %s' %
(volume_id, vol.status))
eventlet.sleep(1)
try:
volapi.delete_server_volume(server_id,
volume_id)
This can all be found in the volume.py:
https://github.com/heat-api/heat/blob/master/heat/engine/resources/volume.py
I'm going to be out of the office Friday & Monday so if anyone has a chance to
look at this during that time, that'd be great!
Thanks!
Ian