コード例 #1
0
 def delete(self, request, export_id):
     try:
         eg = validate_export_group(export_id, request)
         cur_exports = list(NFSExport.objects.all())
         for e in NFSExport.objects.filter(export_group=eg):
             export_pt = ('%s%s' % (settings.NFS_EXPORT_ROOT, e.share.name))
             if (e.export_group.nohide):
                 snap_name = e.mount.split(e.share.name + '_')[-1]
                 export_pt = ('%s/%s' % (export_pt, snap_name))
             teardown_wrapper(export_pt, request, logger)
             cur_exports.remove(e)
             e.delete()
         eg.delete()
         exports = create_nfs_export_input(cur_exports)
         adv_entries = [
             e.export_str for e in AdvancedNFSExport.objects.all()
         ]
         exports_d = create_adv_nfs_export_input(adv_entries, request)
         exports.update(exports_d)
         refresh_wrapper(exports, request, logger)
         return Response()
     except RockStorAPIException:
         raise
     except Exception, e:
         handle_exception(e, request)
コード例 #2
0
ファイル: share_nfs.py プロジェクト: kamal-gade/rockstor-core
 def delete(self, request, sname, export_id):
     try:
         share = validate_share(sname, request)
         eg = validate_export_group(export_id, request)
         cur_exports = list(NFSExport.objects.all())
         export = NFSExport.objects.get(export_group=eg, share=share)
         for e in NFSExport.objects.filter(share=share):
             if (e.export_group.host_str == eg.host_str):
                 export_pt = ('%s%s' % (settings.NFS_EXPORT_ROOT,
                                        share.name))
                 if (e.export_group.nohide):
                     snap_name = e.mount.split(e.share.name + '_')[-1]
                     export_pt = ('%s%s/%s' % (settings.NFS_EXPORT_ROOT,
                                               e.share.name, snap_name))
                 teardown_wrapper(export_pt, request, logger)
                 cur_exports.remove(e)
         exports = create_nfs_export_input(cur_exports)
         export.delete()
         if (NFSExport.objects.filter(export_group=eg).count() == 0):
             #delete only when this is the only share in the group
             eg.delete()
         refresh_wrapper(exports, request, logger)
         return Response()
     except RockStorAPIException:
         raise
     except Exception, e:
         handle_exception(e, request)
コード例 #3
0
ファイル: share_nfs.py プロジェクト: rcgade/rockstor-core
 def delete(self, request, sname, export_id):
     try:
         share = validate_share(sname, request)
         eg = validate_export_group(export_id, request)
         cur_exports = list(NFSExport.objects.all())
         export = NFSExport.objects.get(export_group=eg, share=share)
         for e in NFSExport.objects.filter(share=share):
             if (e.export_group.host_str == eg.host_str):
                 export_pt = ('%s%s' %
                              (settings.NFS_EXPORT_ROOT, share.name))
                 if (e.export_group.nohide):
                     snap_name = e.mount.split(e.share.name + '_')[-1]
                     export_pt = ('%s%s/%s' % (settings.NFS_EXPORT_ROOT,
                                               e.share.name, snap_name))
                 teardown_wrapper(export_pt, request, logger)
                 cur_exports.remove(e)
         exports = create_nfs_export_input(cur_exports)
         export.delete()
         if (NFSExport.objects.filter(export_group=eg).count() == 0):
             #delete only when this is the only share in the group
             eg.delete()
         refresh_wrapper(exports, request, logger)
         return Response()
     except RockStorAPIException:
         raise
     except Exception, e:
         handle_exception(e, request)
コード例 #4
0
ファイル: nfs_exports.py プロジェクト: drtyhbo/rockstor-core
 def delete(self, request, export_id):
     with self._handle_exception(request):
         eg = validate_export_group(export_id, request)
         cur_exports = list(NFSExport.objects.all())
         for e in NFSExport.objects.filter(export_group=eg):
             export_pt = ('%s%s' % (settings.NFS_EXPORT_ROOT, e.share.name))
             if (e.export_group.nohide):
                 snap_name = e.mount.split(e.share.name + '_')[-1]
                 export_pt = ('%s/%s' % (export_pt, snap_name))
             teardown_wrapper(export_pt, request, logger)
             cur_exports.remove(e)
             e.delete()
         eg.delete()
         exports = create_nfs_export_input(cur_exports)
         adv_entries = [e.export_str for e in
                        AdvancedNFSExport.objects.all()]
         exports_d = create_adv_nfs_export_input(adv_entries, request)
         exports.update(exports_d)
         refresh_wrapper(exports, request, logger)
         return Response()
コード例 #5
0
ファイル: nfs_exports.py プロジェクト: sigkill/rockstor-core
 def delete(self, request, export_id):
     try:
         eg = validate_export_group(export_id, request)
         cur_exports = list(NFSExport.objects.all())
         for e in NFSExport.objects.filter(export_group=eg):
             export_pt = ('%s%s' % (settings.NFS_EXPORT_ROOT, e.share.name))
             if (e.export_group.nohide):
                 snap_name = e.mount.split(e.share.name + '_')[-1]
                 export_pt = ('%s/%s' % (export_pt, snap_name))
             teardown_wrapper(export_pt, request, logger)
             cur_exports.remove(e)
             e.delete()
         eg.delete()
         exports = create_nfs_export_input(cur_exports)
         refresh_wrapper(exports, request, logger)
         return Response()
     except RockStorAPIException:
         raise
     except Exception, e:
         handle_exception(e, request)
コード例 #6
0
ファイル: share_nfs.py プロジェクト: wanminxg/rockstor-core
 def delete(self, request, sname, export_id):
     with self._handle_exception(request):
         share = validate_share(sname, request)
         eg = validate_export_group(export_id, request)
         cur_exports = list(NFSExport.objects.all())
         export = NFSExport.objects.get(export_group=eg, share=share)
         for e in NFSExport.objects.filter(share=share):
             if e.export_group.host_str == eg.host_str:
                 export_pt = "%s%s" % (settings.NFS_EXPORT_ROOT, share.name)
                 if e.export_group.nohide:
                     snap_name = e.mount.split(e.share.name + "_")[-1]
                     export_pt = "%s%s/%s" % (settings.NFS_EXPORT_ROOT, e.share.name, snap_name)
                 teardown_wrapper(export_pt, request, logger)
                 cur_exports.remove(e)
         exports = create_nfs_export_input(cur_exports)
         export.delete()
         if NFSExport.objects.filter(export_group=eg).count() == 0:
             # delete only when this is the only share in the group
             eg.delete()
         refresh_wrapper(exports, request, logger)
         return Response()