I would like to help the user during an upgrade from one version of my plug-in to the next by copying their data to my new plug-in. My plug-in uses a config file/database to store user-entered information. I thought I might put this file in /usr/lib/vmware-virgo/server/ as the userid/groupid was vsphere-client/users but I see in vCenter 6.0U2 the directory is now root/root and I'm not able to read or write to that directory.
What directory can I use to store inforamtion that I can find when a user upgrades? The plug-in themselves seem to be installed in a directory with a psuedo-random name, making finding it difficult.
To answer my own question the environment variable, VMWARE_DATA_DIR is used to define the location for plug-in data. The 5.5 and 6.0 SDK has a Java program, GlobalServiceImpl.java that makes use of the variable.
You shouldn't hardcode the values defined by VMWARE_DATA_DIR but for Windows it's
C:\ProgramData\VMware\vCenterServer\data, Linux it's
/storage and for Mac it's
A best practice would be to create a subdirectory under that using your company name or stock symbol for isolation and uniqueness.
Except for one problem. The /storage directory is owned by root/root on both 5.5 and 6.0. That's OK on 5.5 as Virgo is running as root, you'll be able to create files in the directory. On 6.0, Virgo is running as vsphere-client so can't create files in the /storage directory. It can however create files in the /storage/vsphere-client directory. This should work on both 5.5 and 6.0.
I'm looking at you VMware. The example in the 6.0 SDK can't possibly work and you should probably fix the permissions on the /storage directory rather than update the SDK example. You should also check for this situation on the next release of vCenter.
Editorial - VMware is making it difficult to provide a seemless user experience during upgrades. Plug-ins must be able to find and manage settings from previous installs and migrate to new configurations.