Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ldapsync uses any scratch to update scratch quota #100

Open
stdweird opened this issue Aug 26, 2020 · 2 comments
Open

ldapsync uses any scratch to update scratch quota #100

stdweird opened this issue Aug 26, 2020 · 2 comments

Comments

@stdweird
Copy link
Member

ldapsync code will overwrite the scratchquota in ldap with any scratch storage quota, not only the default scratch one (inlc retired scratches).
to properly fix this, we need to do something. not sure how to filter for "default" scratch, but we should also at least filter out the retired scratches. for that the AP needs to add the retired state to the storage serialiser, so we can filter on it.

ideally, we can drop the storage quota from ldap, and sync straight from rest api (and use the exact storage name).

for now, this was fixed by hand by filtering any 'muk' from the quota parts

--- /usr/lib/python2.7/site-packages/vsc/administration/ldapsync.py~	2020-06-09 11:34:19.000000000 +0200
+++ /usr/lib/python2.7/site-packages/vsc/administration/ldapsync.py	2020-08-26 14:04:55.144106363 +0200
@@ -152,7 +152,8 @@
                 for stype in ['home', 'data', 'scratch']:
                     # only gent sets filesets for vo's, so not gvo is user. (other institutes is empty or "None"
                     if quota['storage']['storage_type'] == stype and not quota['fileset'].startswith('gvo'):
-                        ldap_attributes['%sQuota' % stype] = ["%d" % quota["hard"]]
+                        if 'muk' not in quota['storage']['name'].lower():
+                            ldap_attributes['%sQuota' % stype] = ["%d" % quota["hard"]]
 
             result = self.add_or_update(VscLdapUser, account.vsc_id, ldap_attributes, dry_run)
             accounts[result].add(account.vsc_id)
@stdweird
Copy link
Member Author

@itkovian thoughts? i'm in favour of adding the retired state to the serialised storage json from the AP, but not sure if it deserves lots of time/effort atm.

@stdweird
Copy link
Member Author

--- /usr/lib/python2.7/site-packages/vsc/administration/ldapsync.py	2020-09-23 13:52:27.080665201 +0200
+++ /root/ldapsync.py_1.3.0	2020-09-17 12:59:59.962371269 +0200
@@ -152,8 +152,7 @@
                 for stype in ['home', 'data', 'scratch']:
                     # only gent sets filesets for vo's, so not gvo is user. (other institutes is empty or "None"
                     if quota['storage']['storage_type'] == stype and not quota['fileset'].startswith('gvo'):
-                        if (('muk' not in quota['storage']['name'].lower()) and 
-                            ('theia' not in quota['storage']['name'].lower() and str(account.person.institute['name']) == 'leuven')):
+                        if 'muk' not in quota['storage']['name'].lower():
                             ldap_attributes['%sQuota' % stype] = ["%d" % quota["hard"]]
 
             result = self.add_or_update(VscLdapUser, account.vsc_id, ldap_attributes, dry_run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant