Unexpected UID/GID Ownership Changes on OpenNebula Datastores by Hosts

In our OpenNebula environment, we’ve noticed that some directories under /var/lib/one/datastores/ are unexpectedly owned by UID and GID 1001, instead of oneadmin (which has UID and GID 9869). This appears to happen after interaction with some OpenNebula hosts—possibly during datastore mounting or file operations.

  • How could the ownership (UID/GID) of these directories be getting changed by the hosts?
  • What is the best way to prevent this from happening again, ideally without causing major disruption to the current setup?

Example output:

root@svl-opennebula1:~# ls -l /var/lib/one/datastores/
...
drwxr-xr-x 10     1001     1001 16384 Jul 10 05:33 1
...
drwxr-xr-x  3     1001     1001  4096 May 29 18:30 2

Expected ownership:

root@svl-opennebula1:~# id -u oneadmin
9869
root@svl-opennebula1:~# id -g oneadmin
9869

How can we resolve this ownership mismatch and prevent further issues, ideally without significant downtime?

In my experience, this happens because before the installation of the opennebula-node package a user oneadmin already exists and it has been created as a regular user, hence having a UID/GID >= 1000

As soon as the /var/lib/one is writable and owned by the user oneadmin everything should be running OK. The best way to ensure that this does not happen is keeping track of the existing users before the installation of the nodes on them.