epics-modules/iocStats

Read-only iocStats databases

stephAllison opened this issue · 3 comments

Some time ago (over a year!), J. Lewis Muir requested an option be added to the iocStats databases to prevent records that perform invasive actions (like reboot or load a new access security file) from being loaded. There are several ways to implement this but one way that seemed the least amount of work and the least changes to existing startup files is one recommended by Lewis - add a new macro that would be used like this:

$(RO_$(RO=NO),RO_YES=#,RO_NO=)record(sub, "$(IOC,undefined):SYSRESET")
$(RO_$(RO=NO),RO_YES=#,RO_NO=){
$(RO_$(RO=NO),RO_YES=#,RO_NO=)    alias("$(IOC,undefined):SysReset")
$(RO_$(RO=NO),RO_YES=#,RO_NO=)    field(DESC, "IOC Restart" )
$(RO_$(RO=NO),RO_YES=#,RO_NO=)    field(SNAM, "rebootProc")
$(RO_$(RO=NO),RO_YES=#,RO_NO=)    field(BRSV,"INVALID")
$(RO_$(RO=NO),RO_YES=#,RO_NO=)    field(L,"1")
$(RO_$(RO=NO),RO_YES=#,RO_NO=)}
==============

And set RO (Read Only) to YES to remove the record instance:

=== st.cmd ===
dbLoadRecords("$(DEVIOCSTATS)/db/iocAdminVxWorks.db","IOC=17lab,RO=YES")
==============

Or invert the sense of the macro to RW (Read Write), and I can set it to
NO.

(ANJ edited to format suggested changes better)

Is "read-only/read-write" the best language to use to describe this feature? Without actually looking at the database the argument RO=YES tells me nothing about what it's purpose is — maybe something like SYSRESET=LOAD/SKIP?

BTW $(IOC,undefined) should be $(IOC) - the ,undefined part was probably inserted by MSI at some point in the past, it shouldn't be included in the original sources.

Since there are more records in that group (Stephanie mentioned reloading access security definitions), SYSRESET is only gradually better than RO.
So ... next things would be INVASIVE=LOAD/SKIP or INCLUDEINVASIVE=YES/NO?

I wasn't sure how many different groups there might be. Using a group name instead of a specific functionality would make it easier to use. One important question is probably whether the defaults should load everything ("useful"?) or just the "safe" records.