getting state while scripting, filesystem or pvesh?

pixel

Renowned Member
Aug 6, 2014
138
3
83
We script and use pvesh for almost everything. either on the command line or called from python. these python scripts are slow from multiple get calls.

are there any hidden pitfalls, race conditions, etc that could happen with getting data by parsing the config files in /etc/pve as opposed to the rest api?

i dont mind the time delay in using the api for setting state as it also gives a layer of error checking.
 
You can get the whole VM/CT/Storage config with one API call, so I don't think it is worth to read the files directly. And yes, there are race conditions if you do not lock the files, but this depends on the usage scenario.