Open cameronkerrnz opened 3 years ago
@cameronkerrnz Thank you for detail bug and also an analysis around what causing it and how it can be overcome. I think this should be fix as part of our code instead having it part of Known issues. Also we are working on the windows installer side which might take care of this usecase.
cc @anjannath @gbraad
Using os.UserCacheDir
and friends was discussed a long time ago in https://github.com/code-ready/crc/issues/220, but we were not aware of the implications on remote Windows home dirs at the time
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
General information
crc setup
before starting it (Yes/No)? yesCRC version
CRC config
Host Operating System
Steps to reproduce
This is applicable for users that have Roaming Profiles forced upon them. It is relates to performance issues that would be encountered by users with home directories that are network mounted (eg. over NFS).
Analysis
In a similar vein, if I delete the CRC environment and start again while on-network, the directory "~.crc\cache" and "~.crc\machines" are also on-network, which is both very slow (which at scale becomes an issue for desktop support, network and storage teams).
On Windows, the cache and machines directories should not be ~.crc\cache (~.crc\machines) (where ~ is whatever the user's home directory is determined as), but should instead be housed within %LOCALAPPDATA% (eg. C:\Users\me\AppData\Local). The expectation would be that MachineBaseDir would be set to filepath.Join(os.UserCacheDir(), "crc"))
Golang (from version 1.12) will provide a suitable directory when you use os.UserCacheDir.
Similarly, there is os.UserConfigDir() and os.UserHomeDir(), which on Windows returns %APPDATA%, which when on-line for a roaming profile user is like C:\Users\me\AppData\Roaming
However, its probably not so useful to have the CRC configuration be remote (because it will get divorced from the machines if the user logs into a different machine), so I would advocate that the entirety of ~/.crc on Windows should really be in %LOCALAPPDATA% (filepath.Join(os.UserCacheDir(), "crc")), and a CRC installation should be understood to be a local-machine instance. At least this should be the default behaviour.
CRC attempts to determine what the user home directory using the code in GetHomeDrive(), but does not account for the fact that %HOMEDRIVE%%HOMEPATH% can be different in a connected (to profile server) versus disconnected (from profile server) state.
https://github.com/code-ready/crc/blob/f974ac2f80fddb69621b395ce0cc8e341cf75725/pkg/crc/constants/constants.go#L93-L105
Expected
crc start
should successfully start my existing environmentActual
crc start
tells me to "Run 'crc setup' to unpack the bundle to disk"Logs
Please consider posting the output of
crc start --log-level debug
on http://gist.github.com/ and post the link in the issue.Workaround
In a PowerShell session, I can change the value of HOMEDRIVE and HOMEPATH, which is enough to steer crc in the correct direction to where the data actually is.
Please can this be added to the Known Issues. Possibly a wrapper script (eg. crc.bat or crc.ps1) may be a good idea.