Skip to content

Commit b030aad

Browse files
authored
Merge pull request #3150 from stgraber/main
incusd/device/nic_physical: Fix bridge handling
2 parents 13c9ae7 + 2259e71 commit b030aad

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

internal/server/device/nic_physical.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ func (d *nicPhysical) validateConfig(instConf instance.ConfigReader, partialVali
171171
// Get actual parent device from network's parent setting.
172172
d.config["parent"] = netConfig["parent"]
173173

174+
// Copy certain keys verbatim from the network's settings.
175+
for _, field := range optionalFields {
176+
_, found := netConfig[field]
177+
if found {
178+
d.config[field] = netConfig[field]
179+
}
180+
}
181+
174182
// Check if the parent is a bridge.
175183
isParentBridge := d.config["parent"] != "" && util.PathExists(fmt.Sprintf("/sys/class/net/%s/bridge", d.config["parent"]))
176184
if isParentBridge {
@@ -186,17 +194,9 @@ func (d *nicPhysical) validateConfig(instConf instance.ConfigReader, partialVali
186194
return fmt.Errorf("Failed to initialize bridged device: %w", err)
187195
}
188196

189-
// Forward the start call.
197+
// Forward the validateConfig call.
190198
return bridged.validateConfig(instConf, partialValidation)
191199
}
192-
193-
// Copy certain keys verbatim from the network's settings.
194-
for _, field := range optionalFields {
195-
_, found := netConfig[field]
196-
if found {
197-
d.config[field] = netConfig[field]
198-
}
199-
}
200200
} else {
201201
// If no network property supplied, then parent property is required.
202202
requiredFields = append(requiredFields, "parent")

0 commit comments

Comments
 (0)