This does put the new snapshot into the resource, but immediately restarts the device itself. Which was already running the changes--that's the point of the live editing, it doesn't persist until deliberately saved. Restart isn't instant, so this will disrupt fast data collection processes.
However, I do want the new config propagated to the peer in a redundant pair...
No, when push a list of changes to the config manager, no scanning is required. If I wrote directly to Config.xml in the resource folder, that might produce the effect I want on the master system, but I don't think it will propagate without scanning. And any random later scan for other purposes would restart the live device at that point.
I suppose I could make an entirely separate resource tree for this, under my own module ID (devices are under the OPC server ID). Blegh.
Oh jeez... that's not even a part of the core resource system, it's added by NamedResourceHandler::create. It does seem stable though... and looks to be used by a couple other things as a FK. Might have been its intent.
edit: no I remember now, the intent had something to do with assisting the handlers with renames.
Yeah, the UUID is added to all "named" resources (as distinct from singletons) by various layers of the system. I wouldn't assume it's always present, but the intention is for it to be stable once created, precisely to handle renames.
Divert the write of Config.xml when live to the module config dir as ${uuid}.xml, unconditionally overwriting anything there, creating folders as needed.
Check during device startup if there is a resource uuid, and if there is a module config dir, and it holds an XML file for that uuid. If so:
Load the alternate file as the config for the device, and
Schedule an independent runnable for a few millis in the future to:
Push the new config into the resource collection, and
Delete the alternate file.
That will cause a quick extra restart when a live config is present.
My future WebUI will need to unconditionally delete an alternate when directly importing a new Config.xml.