pstorage.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:kuberdock-platform 作者: cloudlinux 项目源码 文件源码
def delete_by_id(self, drive_id):
        """
        Deletes a user drive
        :param drive_id: string -> drive id
        Raises DriveIsLockedError if drive is locked by another operation at
        the moment.
        """
        with drive_lock(drive_id=drive_id):
            pd = PersistentDisk.query.filter(
                PersistentDisk.id == drive_id
            ).first()
            if not pd:
                current_app.logger.warning(
                    'Unable to delete drive. '
                    'Unknown drive id: %s',
                    drive_id
                )
                return 1
            # self.end_stat(pd.name, pd.owner_id)
            rv = self._delete_pd(pd)
        if rv == 0 and self._cached_drives:
            self._cached_drives = [
                d for d in self._cached_drives
                if d['id'] != drive_id
            ]
        return rv
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号