[1.3] runc update: support per-device weight and iops by kolyshkin · Pull Request #4931 · opencontainers/runc (original) (raw)

@kolyshkin

This support was missing from runc, and thus the example from the podman-update wasn't working.

To fix, introduce a function to either update or insert new weights and iops.

Add integration tests.

Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com (cherry picked from commit 7696402) Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com

@kolyshkin

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 (cherry picked from commit 0b01dcc) Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com

@kolyshkin

Apparently, having a minor of 0 does not always mean it's the whole device (not a partition):

 === /proc/partitions (using major: 259) ===
 major minor  #blocks  name

    8       16   78643200 sdb
    8       17   77593583 sdb1
    8       30       4096 sdb14
    8       31     108544 sdb15
  259        0     934912 sdb16
    8        0   78643200 sda
    8        1   78641152 sda1

Rewrite the test to not assume minor is 0, and use lsblk -d to find out whole devices.

This fixes a test case which was added in commit 7696402.

Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com (cherry picked from commit 46dac58) Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com

@cyphar @kolyshkin

If an error occurs during a test which sets up loopback devices, the loopback device is not freed. Since most systems have very conservative limits on the number of loopback devices, re-running a failing test locally to debug it often ends up erroring out due to loopback device exhaustion.

So let's just move the "losetup -d" to teardown, where it belongs.

Signed-off-by: Aleksa Sarai cyphar@cyphar.com (cherry picked from commit ceef984) Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com

@cyphar @kolyshkin

openSUSE has an unfortunate default udev setup which forcefully sets all loop devices to use the "none" scheduler, even if you manually set it. As this is a property of the host configuration (and udev is monitoring from the host) we cannot really change this behaviour from inside our test container.

So we should just skip the test in this (hopefully unusual) case. Ideally tools running the test suite should disable this behaviour when running our test suite.

Signed-off-by: Aleksa Sarai cyphar@cyphar.com (cherry picked from commit e6b4b5a) Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com

lifubang

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})