Skip to content

Commit

Permalink
Use CONF.volume.volume_size when image virtual_size is None
Browse files Browse the repository at this point in the history
Use CONF.volume.volume_size in case the virtual_size attribute of the
image info is None.

Change-Id: I6ce18c49f287b1a1fa98bbf120b11346fd4d6613
(cherry picked from commit df64a64)
  • Loading branch information
rdiazcam committed Nov 2, 2023
1 parent 153e6db commit b4efdbd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nfv_tempest_plugin/tests/scenario/baremetal_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,10 @@ def create_volume(self, **volume_args):
if 'size' not in volume_args:
volume_args['size'] = CONF.volume.volume_size
if 'imageRef' in volume_args:
volume_args['size'] = \
int(self.image_client.show_image(
volume_args['imageRef'])['virtual_size'] / 1073741824) + 1
image_virtual_size = self.image_client.show_image(
volume_args['imageRef'])['virtual_size']
if image_virtual_size:
volume_args['size'] = int(image_virtual_size / 1073741824) + 1
volume = self.volumes_client.create_volume(**volume_args)['volume']
self.addClassResourceCleanup(
self.volumes_client.wait_for_resource_deletion, volume['id'])
Expand Down

0 comments on commit b4efdbd

Please sign in to comment.