pyocf: rio: Fix the default JobSpec

Make JobSpec dataclass' default values immutable.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
Michal Mielewczyk 2023-05-22 12:34:22 +02:00
parent 8668ae9c37
commit 16830cd3c3

View File

@ -1,12 +1,13 @@
# #
# Copyright(c) 2022 Intel Corporation # Copyright(c) 2022 Intel Corporation
# Copyright(c) 2024 Huawei Technologies
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
# #
from ctypes import c_int, c_void_p, CFUNCTYPE from ctypes import c_int, c_void_p, CFUNCTYPE
from enum import Enum, auto from enum import Enum, auto
from random import Random from random import Random
from dataclasses import dataclass from dataclasses import dataclass, field
from datetime import timedelta, datetime from datetime import timedelta, datetime
from itertools import cycle from itertools import cycle
from threading import Thread, Condition, Event from threading import Thread, Condition, Event
@ -61,12 +62,12 @@ class JobSpec:
randseed: int = 1 randseed: int = 1
rwmixwrite: int = 50 rwmixwrite: int = 50
randommap: bool = True randommap: bool = True
bs: Size = Size.from_B(512) bs: Size = field(default_factory=lambda: Size.from_B(512))
offset: Size = Size(0) offset: Size = field(default_factory=lambda: Size(0))
njobs: int = 1 njobs: int = 1
qd: int = 1 qd: int = 1
size: Size = Size(0) size: Size = field(default_factory=lambda: Size(0))
io_size: Size = Size(0) io_size: Size = field(default_factory=lambda: Size(0))
target: Volume = None target: Volume = None
time_based: bool = False time_based: bool = False
time: timedelta = None time: timedelta = None