mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
runc update: handle duplicated devs properly
In case there's a duplicate in the device list, the latter entry overrides the former one. So, we need to modify the last entry, not the first one. To do that, use slices.Backward. Amend the test case to test the fix. Reported-by: lifubang <lifubang@acmcoder.com> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -905,6 +905,14 @@ EOF
|
||||
echo "==="
|
||||
skip "can't get device major number from /proc/partitions (got $major)"
|
||||
fi
|
||||
# Add an entry to check that
|
||||
# - existing devices can be updated;
|
||||
# - duplicates are handled properly;
|
||||
# (see func upsert* in update.go).
|
||||
update_config ' .linux.resources.blockIO.throttleReadBpsDevice |= [
|
||||
{ major: '"$major"', minor: 0, rate: 485760 },
|
||||
{ major: '"$major"', minor: 0, rate: 485760 }
|
||||
]'
|
||||
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_update
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
Reference in New Issue
Block a user