This feature auto mounts NFS volumes for datastores. The behavior can be controlled with the following template attributes:

- ANFS_ENABLE: YES/NO to enable the automatic NFS management
- ANFS_HOST: hostname/IP of the NFS server
- ANFS_PATH: of the NFS share for this datastore
- ANFS_OPTS: Comma separated options (fstab-like) used for mounting the NFS shares

The shared drivers also performs a "garbage-collector" like to unmount NFS volumes on the hypervisors when the datastores are deleted. This operation is performed in a "lazy" way, when VMs are deployed on the hypervisor.

* oneimage create: mount/umount DS on demand

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Move sh mount/umount logic to libfs.sh

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* oneimage delete: mount/umount DS on demand

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Limit NFS mount/umount from SH code to 30s

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* oneimage clone: mount/umount DS on demand

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* onevm deploy: mount DS on demand

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Temporal mount only when needed

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* onevm deploy: mount DS on demand (persisten)

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Linter

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* onevm deploy: umount unneeded DS

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Allow mount/umount/sed from sudoers

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Temporal mount: use NFS_AUTO_OPTS

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Do AutoNFS cleanup even during non-related ops

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Final refactor and improvements

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* ro values for Datastore object

* Wording for AutoNFS RO attributes

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* NFS_AUTO_ENABLE: change 'true' to 'yes'

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* sudoers: merge everythng into ONE_NFS

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Quote NFS_AUTO_OPTS

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Fix difference between sudoers specs

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Touch .automounted in AutoNFS mounts

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

* Update sudoers.rb

* Update rm

* Quote bash variable expansion

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>

---------

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>
Co-authored-by: Ruben S. Montero <rsmontero@opennebula.org>
This commit is contained in:
Guillemo RamosandRuben S. Montero authored and GitHub committed 2025-01-20 16:55:22 +01:00
1 parent 36857e154e
commit 696e69a957
40 files changed
+289 -73

No files matched your search

+9 -6
View File
@@ -294,13 +294,13 @@ int PoolObjectSQL::replace_template(
return -1;
}
obj_template = move(new_tmpl);
obj_template = std::move(new_tmpl);
if (post_update_template(error) == -1)
if (post_update_template(error, old_tmpl.get()) == -1)
{
if (old_tmpl)
{
obj_template = move(old_tmpl);
obj_template = std::move(old_tmpl);
}
else
{
@@ -344,7 +344,9 @@ int PoolObjectSQL::append_template(
error ="User Template includes a restricted attribute " + rname;
return -1;
}
old_tmpl = std::make_unique<Template>(*obj_template);
obj_template->merge(new_tmpl.get());
}
else
@@ -354,14 +356,15 @@ int PoolObjectSQL::append_template(
error ="User Template includes a restricted attribute " + rname;
return -1;
}
obj_template = move(new_tmpl);
obj_template = std::move(new_tmpl);
}
if (post_update_template(error) == -1)
if (post_update_template(error, old_tmpl.get()) == -1)
{
if (old_tmpl)
{
obj_template = move(old_tmpl);
obj_template = std::move(old_tmpl);
}
else
{