... | ... | @@ -113,6 +113,52 @@ Besides saving the new configuration revision, the CM also creates a reverse `su |
|
|
|
|
|
![CMRemoteSubnet4Set.svg](uploads/5a5059d30158b698e4b83475ff5f1ac4/CMRemoteSubnet4Set.svg)
|
|
|
|
|
|
### Configuration Manager API
|
|
|
|
|
|
```golang
|
|
|
package config // import "isc.org/stork/server/config"
|
|
|
|
|
|
|
|
|
TYPES
|
|
|
|
|
|
type KeaModule struct {
|
|
|
manager Manager
|
|
|
}
|
|
|
|
|
|
func newKeaModule(manager Manager) *KeaModule
|
|
|
func (kea *KeaModule) ApplyEdit(ctx context.Context, daemonID int64) error
|
|
|
func (kea *KeaModule) BeginEdit(ctx context.Context, daemonID int64) error
|
|
|
func (kea *KeaModule) SaveConfig(c dbmodel.KeaConfig) error
|
|
|
type LockKey int64
|
|
|
|
|
|
type Manager interface {
|
|
|
GetKeaModule() *KeaModule
|
|
|
Lock(context.Context, string, ...int64) error
|
|
|
Unlock(context.Context, ...int64)
|
|
|
}
|
|
|
Common place
|
|
|
|
|
|
func NewManager() Manager
|
|
|
type lock struct {
|
|
|
key LockKey
|
|
|
user string
|
|
|
}
|
|
|
|
|
|
type managerImpl struct {
|
|
|
locks map[int64]lock
|
|
|
key LockKey
|
|
|
kea *KeaModule
|
|
|
}
|
|
|
|
|
|
func (manager *managerImpl) GetKeaModule() *KeaModule
|
|
|
func (manager *managerImpl) Lock(ctx context.Context, user string, daemonIDs ...int64) error
|
|
|
func (manager *managerImpl) Unlock(ctx context.Context, daemonIDs ...int64)
|
|
|
func (manager *managerImpl) generateNewKey() LockKey
|
|
|
func (manager *managerImpl) isLocked(daemonID int64) (string, bool)
|
|
|
func (manager *managerImpl) lock(ctx context.Context, user string, daemonID int64) error
|
|
|
func (manager *managerImpl) unlock(ctx context.Context, daemonID int64) bool
|
|
|
```
|
|
|
|
|
|
## Configuration Versioning
|
|
|
|
|
|
Stork holds a current Kea daemon configuration in the `kea_daemon` table. It replaces this configuration every time the state puller detects a configuration change. Once Stork gains new Kea configuration capabilities, the administrators should use Stork to apply configuration changes. However, Stork's configuration capabilities will be initially somewhat limited. In addition, we can't guarantee that someone with direct access to the Kea configuration won't apply a configuration change by editing the configuration file - either in case of some emergency or by mistake. Stork must deal with out-of-bound configuration updates smoothly.
|
... | ... | |