Skip to content
  • Petr Pudlak's avatar
    Make configuration per job/thread · f47b32a8
    Petr Pudlak authored
    
    
    Previously there was one shared configuration object for all jobs,
    threads and other tasks. This patch creates separate ConfigWrite
    instances for distinct jobs/threads.
    
    All exported methods of ConfigWriter are now wrapped in calls that
    obtain the ConfigLock from WConfD, read the current configuration, and
    optionally write it back to WConfD.
    
    _OpenConfig is now called at each such request (instead of just once at
    the creation time of ConfigWriter). A new method _CloseConfig is added
    that performs the necessary cleanup (saving the configuration, releasing
    the lock).
    
    _UpgradeConfig needs to be called every time a configuration is received
    from WConfd, to fix parts that aren't persisted by the Python code. This
    requires that it doesn't use any methods that acquire locks, and it must
    not save the configuration at the end (unless it's called just after
    creating a ConfigWriter instance in "offline" mode).
    
    The semantics of Update changes slightly. Before it just checked its
    argument existed in the configuration. Now it also checks that the
    its serial number is the same as in the master configuration state, to
    avoid overwriting changes in other threads. This will require fixing all
    calls to Update, in particular to avoid interspersing calls to Update
    and other ConfigWriter methods. In the future, we should aim to
    eliminate Update completely.
    
    All LUs now carry their own instance of ConfigWriter, with their
    corresponding job ID. Other cide that uses ConfigWriter identifies with
    job ID 'None' and thread ID.
    
    Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
    Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
    f47b32a8