'Extend an existing volume to the new size.'

def extend_volume(self, volume, new_size):

    LOG.info('Extending    volume    %s.', volume['name'])
    try:
        path = self.local_path(volume)
        self._resize_image_file(path, new_size)
    except Exception as err:
        exception_msg = (_('Failed    to    extend    volume    %(name)s,    Error    msg:    %(msg)s.') % {'name': volume['name'], 'msg': six.text_type(err)})
        raise exception.VolumeBackendAPIException(data=exception_msg)
    try:
        extra_specs = na_utils.get_volume_extra_specs(volume)
        volume_copy = copy.copy(volume)
        volume_copy['size'] = new_size
        self._do_qos_for_volume(volume_copy, extra_specs, cleanup=False)
    except Exception as err:
        exception_msg = (_('Failed    to    set    QoS    for    existing    volume    %(name)s,    Error    msg:    %(msg)s.') % {'name': volume['name'], 'msg': six.text_type(err)})
        raise exception.VolumeBackendAPIException(data=exception_msg)
