'Extend volume to new size.
Extends the volume backing\'s virtual disk to new size. First, try to
extend in place on the same datastore. If that fails due to
insufficient disk space, then try to relocate the volume to a different
datastore that can accommodate the backing with new size and retry
extend.
:param volume: dictionary describing the existing \'available\' volume
:param new_size: new size in GB to extend this volume to'

def extend_volume(self, volume, new_size):

    vol_name = volume['name']
    backing = self.volumeops.get_backing(vol_name)
    if (not backing):
        LOG.info('There    is    no    backing    for    volume:    %s;    no    need    to    extend    the    virtual    disk.', vol_name)
        return
    try:
        self._extend_backing(backing, new_size)
        LOG.info('Successfully    extended    volume:    %(vol)s    to    size:    %(size)s    GB.', {'vol': vol_name, 'size': new_size})
        return
    except exceptions.NoDiskSpaceException:
        LOG.warning('Unable    to    extend    volume:    %(vol)s    to    size:    %(size)s    on    current    datastore    due    to    insufficient    space.', {'vol': vol_name, 'size': new_size})
    LOG.info('Relocating    volume:    %s    to    a    different    datastore    due    to    insufficient    disk    space    on    current    datastore.', vol_name)
    try:
        create_params = {CREATE_PARAM_DISK_SIZE: new_size}
        (host, rp, folder, summary) = self._select_ds_for_volume(volume, create_params=create_params)
        self.volumeops.relocate_backing(backing, summary.datastore, rp, host)
        self.volumeops.move_backing_to_folder(backing, folder)
        self._extend_backing(backing, new_size)
    except exceptions.VMwareDriverException:
        with excutils.save_and_reraise_exception():
            LOG.error('Failed    to    extend    volume:    %(vol)s    to    size:    %(size)s    GB.', {'vol': vol_name, 'size': new_size})
    LOG.info('Successfully    extended    volume:    %(vol)s    to    size:    %(size)s    GB.', {'vol': vol_name, 'size': new_size})
