summary refs log tree commit diff stats
path: root/python/qemu/machine/machine.py
diff options
context:
space:
mode:
authorzhenwei pi <pizhenwei@bytedance.com>2023-07-28 10:20:06 +0800
committerHanna Czenczek <hreitz@redhat.com>2023-08-29 10:49:24 +0200
commit3b2337eff03e23ffcc7d6b0a0f72bd3ab2135ae9 (patch)
treedd174e4597f96888e93d1adbb8c12c83221caad6 /python/qemu/machine/machine.py
parent00ea69f50345258d1ff6262f24516abea5548d3a (diff)
downloadfocaccia-qemu-3b2337eff03e23ffcc7d6b0a0f72bd3ab2135ae9.tar.gz
focaccia-qemu-3b2337eff03e23ffcc7d6b0a0f72bd3ab2135ae9.zip
block/throttle-groups: Use ThrottleDirection instread of bool is_write
'bool is_write' style is obsolete from throttle framework, adapt
block throttle groups to the new style:
- use ThrottleDirection instead of 'bool is_write'. Ex,
  schedule_next_request(ThrottleGroupMember *tgm, bool is_write)
  -> schedule_next_request(ThrottleGroupMember *tgm, ThrottleDirection direction)

- use THROTTLE_MAX instead of hard code. Ex, ThrottleGroupMember *tokens[2]
  -> ThrottleGroupMember *tokens[THROTTLE_MAX]

- use ThrottleDirection instead of hard code on iteration. Ex, (i = 0; i < 2; i++)
  -> for (dir = THROTTLE_READ; dir < THROTTLE_MAX; dir++)

Use a simple python script to test the new style:
 #!/usr/bin/python3
import subprocess
import random
import time

commands = ['virsh blkdeviotune jammy vda --write-bytes-sec ', \
            'virsh blkdeviotune jammy vda --write-iops-sec ', \
            'virsh blkdeviotune jammy vda --read-bytes-sec ', \
            'virsh blkdeviotune jammy vda --read-iops-sec ']

for loop in range(1, 1000):
    time.sleep(random.randrange(3, 5))
    command = commands[random.randrange(0, 3)] + str(random.randrange(0, 1000000))
    subprocess.run(command, shell=True, check=True)

This works fine.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230728022006.1098509-10-pizhenwei@bytedance.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Diffstat (limited to 'python/qemu/machine/machine.py')
0 files changed, 0 insertions, 0 deletions