Beispiel #1
0
    def extend_share(self, share, new_size, share_server=None):
        backend_share = self.client.get_share(share['id'],
                                              share['share_proto'])

        if not self._is_share_from_snapshot(backend_share):
            self.client.extend_filesystem(backend_share.filesystem, new_size)
        else:
            share_id = share['id']
            reason = ("Driver does not support extending a "
                      "snapshot based share.")
            raise exception.ShareExtendingError(share_id=share_id,
                                                reason=reason)
Beispiel #2
0
    def extend_share(self, share, new_size, share_server=None):
        """Extend a share to new_size."""
        lcfg = self.configuration
        free_space = self.zfssa.get_project_stats(lcfg.zfssa_pool,
                                                  lcfg.zfssa_project)

        diff_space = int(new_size - share['size']) * units.Gi

        if diff_space > free_space:
            msg = (_('There is not enough free space in project %s')
                   % (lcfg.zfssa_project))
            LOG.error(msg)
            raise exception.ShareExtendingError(share_id=share['id'],
                                                reason=msg)

        arg = self.create_arg(new_size)
        self.zfssa.modify_share(lcfg.zfssa_pool, lcfg.zfssa_project,
                                share['id'], arg)