Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -458,19 +458,27 @@ func (d *driver) setKeys(keys []*key) error {
|
| 458 | 458 |
// Accept the encryption keys and clear any stale encryption map |
| 459 | 459 |
d.secMap = encrMap{}
|
| 460 | 460 |
d.keys = keys |
| 461 |
- log.G(context.TODO()).Debugf("Initial encryption keys: %v", keys)
|
|
| 461 |
+ |
|
| 462 |
+ log.G(context.TODO()).WithFields(log.Fields{
|
|
| 463 |
+ "driver": "overlay", |
|
| 464 |
+ "keys": d.keys, |
|
| 465 |
+ }).Debug("Set initial encryption keys")
|
|
| 462 | 466 |
return nil |
| 463 | 467 |
} |
| 464 | 468 |
|
| 465 | 469 |
// updateKeys allows to add a new key and/or change the primary key and/or prune an existing key |
| 466 | 470 |
// The primary key is the key used in transmission and will go in first position in the list. |
| 467 |
-func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
|
| 471 |
+func (d *driver) updateKeys(newKey, primaryKey, pruneKey *key) error {
|
|
| 468 | 472 |
d.encrMu.Lock() |
| 469 | 473 |
defer d.encrMu.Unlock() |
| 470 | 474 |
|
| 471 |
- log.G(context.TODO()).Debugf("Updating Keys. New: %v, Primary: %v, Pruned: %v", newKey, primary, pruneKey)
|
|
| 472 |
- |
|
| 473 |
- log.G(context.TODO()).Debugf("Current: %v", d.keys)
|
|
| 475 |
+ log.G(context.TODO()).WithFields(log.Fields{
|
|
| 476 |
+ "driver": "overlay", |
|
| 477 |
+ "current": d.keys, |
|
| 478 |
+ "new": newKey, |
|
| 479 |
+ "primary": primaryKey, |
|
| 480 |
+ "prune": pruneKey, |
|
| 481 |
+ }).Debug("Updating encryption keys")
|
|
| 474 | 482 |
|
| 475 | 483 |
var ( |
| 476 | 484 |
newIdx = -1 |
| ... | ... |
@@ -486,7 +494,7 @@ func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
| 486 | 486 |
newIdx += len(d.keys) |
| 487 | 487 |
} |
| 488 | 488 |
for i, k := range d.keys {
|
| 489 |
- if primary != nil && k.tag == primary.tag {
|
|
| 489 |
+ if primaryKey != nil && k.tag == primaryKey.tag {
|
|
| 490 | 490 |
priIdx = i |
| 491 | 491 |
} |
| 492 | 492 |
if pruneKey != nil && k.tag == pruneKey.tag {
|
| ... | ... |
@@ -495,7 +503,7 @@ func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
| 495 | 495 |
} |
| 496 | 496 |
|
| 497 | 497 |
if (newKey != nil && newIdx == -1) || |
| 498 |
- (primary != nil && priIdx == -1) || |
|
| 498 |
+ (primaryKey != nil && priIdx == -1) || |
|
| 499 | 499 |
(pruneKey != nil && delIdx == -1) {
|
| 500 | 500 |
return types.InvalidParameterErrorf("cannot find proper key indices while processing key update:"+
|
| 501 | 501 |
"(newIdx,priIdx,delIdx):(%d, %d, %d)", newIdx, priIdx, delIdx) |
| ... | ... |
@@ -524,8 +532,10 @@ func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
| 524 | 524 |
d.keys = append(d.keys[:delIdx], d.keys[delIdx+1:]...) |
| 525 | 525 |
} |
| 526 | 526 |
|
| 527 |
- log.G(context.TODO()).Debugf("Updated: %v", d.keys)
|
|
| 528 |
- |
|
| 527 |
+ log.G(context.TODO()).WithFields(log.Fields{
|
|
| 528 |
+ "driver": "overlay", |
|
| 529 |
+ "keys": d.keys, |
|
| 530 |
+ }).Debug("Updated encryption keys")
|
|
| 529 | 531 |
return nil |
| 530 | 532 |
} |
| 531 | 533 |
|