Univention Bugzilla – Bug 50193
nfsmounts does not mount self-mounts
Last modified: 2023-03-15 14:14:28 CET
Created attachment 10183 [details] Fix and modernize nfsmountss.py - UVMM setup with master and backup - master is NFS server having "/var/lib/libvirt/images.nfs" - policy to mount shared on "/var/lib/libvirt/images" The Master must mount its own export to access the VM image files. But `nfsmounts` refuses to do so: > /usr/lib/univention-directory-policy/nfsmounts --verbose > NFS Mount: cn=libvirt,cn=shares,dc=phahn,dc=dev /var/lib/libvirt/images ... is self, skipping Having the Master access the images as a local file and other hosts using NFS leads to data-loss when migrating a VM! The attached patch: - fixes the self mount - switched to print_function - convert getopt to argparse - uses open() in context - fixes flake8 issues
<git:phahn/50193-nfsmounts>
[5.0-3] e3de05a847 fix(nfs): Mount from self if path is different base/univention-base-files/debian/changelog | 6 ++++++ base/univention-base-files/univention-directory-policy/nfsmounts.py | 10 +++++----- doc/errata/staging/univention-base-files.yaml | 11 +++++++++++ test/ucs-test/tests/01_base/17_nfsmounts.py | 6 +----- 4 files changed, 23 insertions(+), 10 deletions(-) Package: univention-base-files Version: 9.0.5-2A~5.0.0.202302222033 Branch: ucs_5.0-0 Scope: errata5.0-3 [5.0-3] 9a985ad3dd Bug #50193: univention-base-files 9.0.5-2A~5.0.0.202302222033 doc/errata/staging/univention-base-files.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) QA: eval "$(ucr shell ldap/base ldap/hostdn server/role)" udm shares/share create --option nfs --set name=bug50193 --set host="$(hostname -f)" --set path=/src --set directorymode=0770 grep --color -n -F /src /etc/exports udm policies/nfsmounts create --set name=bug50193pol --set nfsMounts="\"cn=bug50193,$ldap_base\" \"/dst\"" udm "computers/$server_role" modify --dn "$ldap_hostdn" --policy-reference "cn=bug50193pol,$ldap_base" /usr/lib/univention-directory-policy/nfsmounts grep --color -n -F /dst /etc/fstab QA: udm policies/nfsmounts create --set name=bug50193pol --set nfsMounts="\"cn=bug50193,$ldap_base\" \"/src\"" should not be mounted.
More pending changed in MR!678
[5.0-3] a2af4e4ad0 style(base): shellcheck issues base/univention-base-files/debian/univention-base-files.postinst | 18 +++++++++--------- base/univention-base-files/etc/X11/Xsession.d/33-univention-environment | 1 + base/univention-base-files/scripts/init-autostart.lib | 1 + base/univention-base-files/scripts/univention-config-registry-backup | 3 ++- 4 files changed, 13 insertions(+), 10 deletions(-) [5.0-3] 9859191ecc refactor(base): Remove old package update code base/univention-base-files/debian/univention-base-files.postinst | 1 - base/univention-base-files/debian/univention-base-files.postrm | 1 - base/univention-base-files/debian/univention-base-files.preinst | 1 - 3 files changed, 3 deletions(-) [5.0-3] be106f0d66 feat(base): Remove empty univention-default-ntp-pool base/univention-base-files/scripts/univention-default-ntp-pool | 0 1 file changed, 0 insertions(+), 0 deletions(-) [5.0-3] c039a2a9e8 feat(base): Remove univention-keyboardmapping base/univention-base-files/debian/changelog | 1 + base/univention-base-files/debian/univention-base-files.install | 1 - .../univention-base-files/debian/univention-base-files.manpages | 1 - base/univention-base-files/scripts/univention-keyboardmapping | 273 ---------------------------- doc/errata/staging/univention-base-files.yaml | 1 + 5 files changed, 2 insertions(+), 275 deletions(-) [5.0-3] 919380fd7b fix(base/nfsmount): Forbid overlapping paths base/univention-base-files/debian/changelog | 6 ++++++ base/univention-base-files/univention-directory-policy/nfsmounts.py | 23 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) [5.0-3] 5447d3e981 refactor(base): Move code and update descriptions base/univention-base-files/conffiles/autostart.py | 4 ++-- base/univention-base-files/conffiles/interfaces.py | 5 ++--- base/univention-base-files/conffiles/xkbKeyboard.py | 5 ++--- base/univention-base-files/univention-directory-policy/nfsmounts.py | 11 +++++------ .../univention-directory-policy/univention-policy-update-config-registry.py | 10 +++++----- 5 files changed, 16 insertions(+), 19 deletions(-) [5.0-3] 781d6f4975 refactor(base): Use univention.config_registry.ucr base/univention-base-files/univention-directory-policy/nfsmounts.py | 12 ++++-------- .../univention-directory-policy/univention-policy-update-config-registry.py | 4 +--- 2 files changed, 5 insertions(+), 11 deletions(-) [5.0-3] e931348fee doc(base): PEP-484 type hints .../univention-directory-policy/nfsmounts.py | 29 +++++++++++++++-------------- .../univention-policy-update-config-registry.py | 4 ++-- 2 files changed, 17 insertions(+), 16 deletions(-) Package: univention-base-files Version: 9.0.5-3A~5.0.0.202303081504 Branch: ucs_5.0-0 Scope: errata5.0-3 [5.0-3] fdc5d74c36 Bug #50193: univention-base-files 9.0.5-3A~5.0.0.202303081504 doc/errata/staging/univention-base-files.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
[5.0-3] f131de469c fix(base/nfsmount): Invert overlap logic base/univention-base-files/debian/changelog | 6 ++++++ base/univention-base-files/univention-directory-policy/nfsmounts.py | 4 ++-- doc/errata/staging/univention-base-files.yaml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) Package: univention-base-files Version: 9.0.5-4A~5.0.0.202303081518 Branch: ucs_5.0-0 Scope: errata5.0-3 [5.0-3] fdc5d74c36 Bug #50193: univention-base-files 9.0.5-3A~5.0.0.202303081504 doc/errata/staging/univention-base-files.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (In reply to Philipp Hahn from comment #2) > QA: eval "$(ucr shell ldap/base ldap/hostdn server/role)" udm shares/share create --option nfs --set name=bug50193 --set host="$(hostname -f)" --set path=/src --set directorymode=0770 --set root_squash=0 grep --color -n -F /src /etc/exports udm policies/nfsmounts create --set name=bug50193pol --set nfsMounts="\"cn=bug50193,$ldap_base\" \"/dst\"" udm "computers/$server_role" modify --dn "$ldap_hostdn" --policy-reference "cn=bug50193pol,$ldap_base" /usr/lib/univention-directory-policy/nfsmounts -v grep --color -n -F /dst /etc/fstab ls -la /src /dst > QA: udm policies/nfsmounts modify --dn "cn=bug50193pol,$ldap_base" --set nfsMounts="\"cn=bug50193,$ldap_base\" \"/src\"" /usr/lib/univention-directory-policy/nfsmounts -v
OK: nfs mount OK: univention-keyboardmapping removal OK: test cases OK: YAML
<https://errata.software-univention.de/#/?erratum=5.0x613>