'Extend an existing volume to the new size.'

def _extend_volume(self, volume, new_size, qos_policy_group_name):

    name = volume['name']
    lun = self._get_lun_from_table(name)
    path = lun.metadata['Path']
    curr_size_bytes = six.text_type(lun.size)
    new_size_bytes = six.text_type((int(new_size) * units.Gi))
    if (curr_size_bytes != new_size_bytes):
        lun_geometry = self.zapi_client.get_lun_geometry(path)
        if (lun_geometry and lun_geometry.get('max_resize') and (int(lun_geometry.get('max_resize')) >= int(new_size_bytes))):
            self.zapi_client.do_direct_resize(path, new_size_bytes)
        else:
            self._do_sub_clone_resize(path, new_size_bytes, qos_policy_group_name=qos_policy_group_name)
        self.lun_table[name].size = new_size_bytes
    else:
        LOG.info('No    need    to    extend    volume    %s    as    it    is    already    the    requested    new    size.', name)
