fix(network): reconcile fallback ownership and reclaim operation locks
Track fallback bridge arguments through the ownership ledger, restore mode and uplink selection after failed network applies, and reclaim per-VM locks only after holders and waiters finish. Reproduced all three review findings before changing behavior using an isolated control client, the production React component with simulated responses, and 512 synthetic VM names. Regression tests, full CI and 20 race-enabled lock runs pass. Existing virtual machines were not operated.
This commit is contained in:
1 parent
2edc894097
commit
dca556bff4
6 files changed
+314
-22
No files matched your search
@@ -54,13 +54,18 @@ export function VMNetworkSettings({ name, locale, running, disabled, stagedDirty
|
||||
const next = await api.ApplyVMNetwork(name, mode, uplink)
|
||||
setState(next)
|
||||
setDependencyRefresh((value) => value + 1)
|
||||
if (next.mode !== 'custom') setMode(next.mode as Mode)
|
||||
setUplink(next.uplink_guid)
|
||||
onSaved()
|
||||
} catch (err) {
|
||||
setError(parseAppError(err))
|
||||
// 失败后读取实际状态;回滚未完成时保留修复入口。
|
||||
try {
|
||||
setState(await api.GetVMNetworkSettings(name))
|
||||
const actual = await api.GetVMNetworkSettings(name)
|
||||
setState(actual)
|
||||
if (actual.mode !== 'custom') setMode(actual.mode as Mode)
|
||||
setUplink(actual.uplink_guid)
|
||||
setDependencyRefresh((value) => value + 1)
|
||||
} catch (refreshError) {
|
||||
console.warn('[network] refresh settings after apply failure:', refreshError)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user