Software Development Kit (SDK) and API Discussions
Hello all, the file group in Manageability SDK does not allow to rename a file, only directories.
Is there anything I missed about this operation?
Yeah, apparently there is no API to rename a file.
However, you can indirectly achieve the "rename" functionality for file with existing APIs as discussed below:
# Assuming we want to rename file fileA to fileB. Both files are under /vol/myvol/mydir
Step 1: Execute file-get-file-info API for existing file:
Get the value of "file-size" from the API response (say, the obtained value is 14)
Step 2: Read the data from the file:
And get the value of "data" from the API response (say, the obtained value is 53756e204175672031322030303a)
Step 3: Write the data into the new non-existing file:
Step 4: Finally delete the original file:
Thanks, but this solution requires a full copy price to pay.
In practice. this is feasible for small files only.
IMHO it doesn't make sense to miss a renaming feature from any file-oriented interface.
Even more strange, there is a directory renaming.
True, this solution can be applied only for the files with size less than 1 MB.
We can file a bug report on Data ONTAP to get this addressed.
The file-* APIs were created to manipulate ONTAP system files, which are less that 1M. At the time, there was no need to rename files.
The file-* APIs are NOT a replacement for a general file system calls. Please use NFS or CIFS.
- Rick -
Hi Rick, this is a surprise. File-* API contains all is needed to manipulate a filesystem, except for file renaming and file locking.
Furthermore I have some doubts concerning performance, being forced to hex encoding (potentially) large binary contents.
I need NetApp to implement a DMS storage subsystem, and I wanted to stay away from OS dependencies (CIFS for Windows clients, NFS for Unix clients).
However it seems I have to redesign the entire stuff.
Hi Renzo -
I can understand your disappointment; however, I think it is better to work on top of well-know, and well tested file systems. As for OS dependencies, NFS works on Windows and UNIX/Linux; and CIFS works on UNIX/Linux via SAMBA.
Hi Rick, indeed I'm considering to use JCIFS as common element, being constrained to the Java world.
Thanks and regards,
file-rename-file API is available in the Vserver context of Cluster Mode ONTAP.
Live Chat, Watch Parties, and More!
Engage digitally throughout the sales process, from product discovery to conﬁguration, and handle all your post-purchase needs.