Reputation: 4612
I want to create a server within OpenStack nova. The first step is to create a volume from an image:
volume = cinder.volumes.create(5, name="test", imageRef=some_id, ...)
The volume will then for some time in the state 'creating'. Calling nova.servers.create
with a volume in creating
state fails:
novaclient.exceptions.BadRequest: Block Device f2fe64ee-f049-4a6f-8edd-52579d82fc23 is not bootable. (HTTP 400) (Request-ID: req-f036d084-e9c8-4bdf-b266-73fbbe993796)
My idea is to wait until the volume gets available
:
while volume.status != 'available':
print("Volume status [%s]" % volume.status)
time.sleep(1.0)
But it looks that the volume data itself is locally cached and never gets updated - even if the GUI and CLI shows, that the volume is already available.
Is there a (simple) way to synchronize the local data with the remote state? Like:
volume.sync()
Upvotes: 0
Views: 300
Reputation: 4612
Found the answer in the document called 'Python APIs: The best-kept secret of OpenStack':
There is the need to update / get the whole volume again:
while volume.status != 'available':
print("Volume status [%s]" % volume.status)
time.sleep(1.0)
volume = cinder.volumes.get(volume.id)
Upvotes: 0