'Extend an existing volume to the new size.'

def extend_volume(self, volume, new_size):

    LOG.info('Extending    volume    %s.', volume.id)
    extend_by = (int(new_size) - volume.size)
    if (not self._is_share_eligible(volume.provider_location, extend_by)):
        raise exception.ExtendVolumeError(reason=('Insufficient    space    to    extend    volume    %s    to    %sG' % (volume.id, new_size)))
    path = self.local_path(volume)
    LOG.info('Resizing    file    to    %sG...', new_size)
    image_utils.resize_image(path, new_size, run_as_root=self._execute_as_root)
    if (not self._is_file_size_equal(path, new_size)):
        raise exception.ExtendVolumeError(reason='Resizing    image    file    failed.')
