Hi Paul,
The short answer is you can use the
OwnershipSpecification object to do this.
More generally, a plugin controls where and how mounts are mounted for virtual databases by implementing the
virtual.mount_specification() operation and for staging databases (if applicable) by implementing the
linked.mount_specification() operation. These operations return a
MountSpecification object that dictates where the mount is created. A MountSpecification object has an optional OwnershipSpecification. In your mount specification operation, you can create an OwnershipSpecification object with the correct user and group.
It sounds like you are trying to preserve the user and group from the source database. There are two ways to do this. The first is during discovery you could store the permissions in the
RepositoryDefinition object. You'll have access to this object during the mount specification operations. Alternatively, you could ask the user for the permissions they want in either the
LinkedSourceDefinition and/or the
VirtualSourceDefinition and they will be prompted at link or provision time respectively.
One last note, the reason you're getting permission issues while executing as root is because root squash is enabled by default so root is being mapped to an anonymous user.
Hope this helps! Let us know if you have any more questions.
- Grant
------------------------------
Grant Magdanz
Senior Member of Technical Staff II
Delphix
------------------------------
Original Message:
Sent: 06-28-2019 03:39:48 PM
From: Paul Jauquet
Subject: How to change owner:group on VDB mount?
I am developing a SDK to virtualize a MongoDB database on CentOS. Original files on the source are under /var/lib/mongo and have perms mongod:mongod. Using rsync to a staging host where the ownership is changes to delphix_os:delphix. Then when we virtualize it creates a mount of the staging directory on the target host as expected. Once the VDB is mounted I need to chown -R mongod:mongod <vdb nfs mount> to get the ownership back to the original, or perhaps even to a different user, but it is giving me Operation not permitted even though I am running as root via sudo. Looks like I cannot change permissions on a NFS mount. Is there a way to tell Delphix what the owner/group should be as part of the VDB mount? It would need to be done as part of the mount, or as a post step, since the host/group may vary based on VDB and target host. Any insight on how to accomplish this would be greatly appreciated.
------------------------------
Paul Jauquet
Senior Data Services Consultant
Axis Technology, LLC
------------------------------