Ejemplo n.º 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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()
Ejemplo n.º 5
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)
         refresh_wrapper(exports, request, logger)
         return Response()
     except RockStorAPIException:
         raise
     except Exception, e:
         handle_exception(e, request)
Ejemplo n.º 6
0
 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()