Hi,
Can someone please point me to a relevant person?
It looks like there is a potential issue with "*getImageSize()*" function
there:
*'image_bytes' might be referenced before assignment*.
There is also a suspicion that this code is not used at all, so instead of
fixing it might be a good idea to just delete it.
See the code below:
def getImageSize(disk_image, driver_type):
'''
Obtain qcow2 image size in GiBs
'''
if driver_type == 'block':
dev_buffer = ' ' * 8
with open(disk_image) as device:
dev_buffer = fcntl.ioctl(device.fileno(), BLKGETSIZE64, dev_buffer)
image_bytes = struct.unpack(FORMAT, dev_buffer)[0]
elif driver_type == 'file':
image_bytes = os.stat(disk_image).st_size
return float(image_bytes / GIB)
Thank you in advance!
Pavel