Selaa lähdekoodia

Merge pull request #44937 from corhere/backport-23.0/fix-44925-ipvlan-panic

[23.0 backport] libnet/d/ipvlan: gracefully migrate from older dbs
Bjorn Neergaard 2 vuotta sitten
vanhempi
commit
fc5d6c97b3
1 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  1. 6 1
      libnetwork/drivers/ipvlan/ipvlan_store.go

+ 6 - 1
libnetwork/drivers/ipvlan/ipvlan_store.go

@@ -193,7 +193,12 @@ func (config *configuration) UnmarshalJSON(b []byte) error {
 	config.Mtu = int(nMap["Mtu"].(float64))
 	config.Parent = nMap["Parent"].(string)
 	config.IpvlanMode = nMap["IpvlanMode"].(string)
-	config.IpvlanFlag = nMap["IpvlanFlag"].(string)
+	if v, ok := nMap["IpvlanFlag"]; ok {
+		config.IpvlanFlag = v.(string)
+	} else {
+		// Migrate config from an older daemon which did not have the flag configurable.
+		config.IpvlanFlag = flagBridge
+	}
 	config.Internal = nMap["Internal"].(bool)
 	config.CreatedSlaveLink = nMap["CreatedSubIface"].(bool)
 	if v, ok := nMap["Ipv4Subnets"]; ok {