xref: /openbmc/qemu/tests/migration/guestperf/scenario.py (revision f3604191e296da90feb1b0bb24e986bc016809a8)
1409437e1SDaniel P. Berrange#
2409437e1SDaniel P. Berrange# Migration test scenario parameter description
3409437e1SDaniel P. Berrange#
4409437e1SDaniel P. Berrange# Copyright (c) 2016 Red Hat, Inc.
5409437e1SDaniel P. Berrange#
6409437e1SDaniel P. Berrange# This library is free software; you can redistribute it and/or
7409437e1SDaniel P. Berrange# modify it under the terms of the GNU Lesser General Public
8409437e1SDaniel P. Berrange# License as published by the Free Software Foundation; either
93a645d36SGan Qixin# version 2.1 of the License, or (at your option) any later version.
10409437e1SDaniel P. Berrange#
11409437e1SDaniel P. Berrange# This library is distributed in the hope that it will be useful,
12409437e1SDaniel P. Berrange# but WITHOUT ANY WARRANTY; without even the implied warranty of
13409437e1SDaniel P. Berrange# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14409437e1SDaniel P. Berrange# Lesser General Public License for more details.
15409437e1SDaniel P. Berrange#
16409437e1SDaniel P. Berrange# You should have received a copy of the GNU Lesser General Public
17409437e1SDaniel P. Berrange# License along with this library; if not, see <http://www.gnu.org/licenses/>.
18409437e1SDaniel P. Berrange#
19409437e1SDaniel P. Berrange
20409437e1SDaniel P. Berrange
21409437e1SDaniel P. Berrangeclass Scenario(object):
22409437e1SDaniel P. Berrange
23409437e1SDaniel P. Berrange    def __init__(self, name,
24409437e1SDaniel P. Berrange                 downtime=500,
25409437e1SDaniel P. Berrange                 bandwidth=125000, # 1000 gig-e, effectively unlimited
26409437e1SDaniel P. Berrange                 max_iters=30,
27409437e1SDaniel P. Berrange                 max_time=300,
28409437e1SDaniel P. Berrange                 pause=False, pause_iters=5,
29409437e1SDaniel P. Berrange                 post_copy=False, post_copy_iters=5,
30409437e1SDaniel P. Berrange                 auto_converge=False, auto_converge_step=10,
31409437e1SDaniel P. Berrange                 compression_mt=False, compression_mt_threads=1,
321c3baa1aSHyman                 compression_xbzrle=False, compression_xbzrle_cache=10,
33*22b7cb2cSHyman Huang                 multifd=False, multifd_channels=2,
34*22b7cb2cSHyman Huang                 dirty_limit=False, x_vcpu_dirty_limit_period=500,
35*22b7cb2cSHyman Huang                 vcpu_dirty_limit=1):
36409437e1SDaniel P. Berrange
37409437e1SDaniel P. Berrange        self._name = name
38409437e1SDaniel P. Berrange
39409437e1SDaniel P. Berrange        # General migration tunables
40409437e1SDaniel P. Berrange        self._downtime = downtime  # milliseconds
41409437e1SDaniel P. Berrange        self._bandwidth = bandwidth # MiB per second
42409437e1SDaniel P. Berrange        self._max_iters = max_iters
43409437e1SDaniel P. Berrange        self._max_time = max_time # seconds
44409437e1SDaniel P. Berrange
45409437e1SDaniel P. Berrange
46409437e1SDaniel P. Berrange        # Strategies for ensuring completion
47409437e1SDaniel P. Berrange        self._pause = pause
48409437e1SDaniel P. Berrange        self._pause_iters = pause_iters
49409437e1SDaniel P. Berrange
50409437e1SDaniel P. Berrange        self._post_copy = post_copy
51409437e1SDaniel P. Berrange        self._post_copy_iters = post_copy_iters
52409437e1SDaniel P. Berrange
53409437e1SDaniel P. Berrange        self._auto_converge = auto_converge
54409437e1SDaniel P. Berrange        self._auto_converge_step = auto_converge_step # percentage CPU time
55409437e1SDaniel P. Berrange
56409437e1SDaniel P. Berrange        self._compression_mt = compression_mt
57409437e1SDaniel P. Berrange        self._compression_mt_threads = compression_mt_threads
58409437e1SDaniel P. Berrange
59409437e1SDaniel P. Berrange        self._compression_xbzrle = compression_xbzrle
60409437e1SDaniel P. Berrange        self._compression_xbzrle_cache = compression_xbzrle_cache # percentage of guest RAM
61409437e1SDaniel P. Berrange
621c3baa1aSHyman        self._multifd = multifd
631c3baa1aSHyman        self._multifd_channels = multifd_channels
641c3baa1aSHyman
65*22b7cb2cSHyman Huang        self._dirty_limit = dirty_limit
66*22b7cb2cSHyman Huang        self._x_vcpu_dirty_limit_period = x_vcpu_dirty_limit_period
67*22b7cb2cSHyman Huang        self._vcpu_dirty_limit = vcpu_dirty_limit
68*22b7cb2cSHyman Huang
69409437e1SDaniel P. Berrange    def serialize(self):
70409437e1SDaniel P. Berrange        return {
71409437e1SDaniel P. Berrange            "name": self._name,
72409437e1SDaniel P. Berrange            "downtime": self._downtime,
73409437e1SDaniel P. Berrange            "bandwidth": self._bandwidth,
74409437e1SDaniel P. Berrange            "max_iters": self._max_iters,
75409437e1SDaniel P. Berrange            "max_time": self._max_time,
76409437e1SDaniel P. Berrange            "pause": self._pause,
77409437e1SDaniel P. Berrange            "pause_iters": self._pause_iters,
78409437e1SDaniel P. Berrange            "post_copy": self._post_copy,
79409437e1SDaniel P. Berrange            "post_copy_iters": self._post_copy_iters,
80409437e1SDaniel P. Berrange            "auto_converge": self._auto_converge,
81409437e1SDaniel P. Berrange            "auto_converge_step": self._auto_converge_step,
82409437e1SDaniel P. Berrange            "compression_mt": self._compression_mt,
83409437e1SDaniel P. Berrange            "compression_mt_threads": self._compression_mt_threads,
84409437e1SDaniel P. Berrange            "compression_xbzrle": self._compression_xbzrle,
85409437e1SDaniel P. Berrange            "compression_xbzrle_cache": self._compression_xbzrle_cache,
861c3baa1aSHyman            "multifd": self._multifd,
871c3baa1aSHyman            "multifd_channels": self._multifd_channels,
88*22b7cb2cSHyman Huang            "dirty_limit": self._dirty_limit,
89*22b7cb2cSHyman Huang            "x_vcpu_dirty_limit_period": self._x_vcpu_dirty_limit_period,
90*22b7cb2cSHyman Huang            "vcpu_dirty_limit": self._vcpu_dirty_limit,
91409437e1SDaniel P. Berrange        }
92409437e1SDaniel P. Berrange
93409437e1SDaniel P. Berrange    @classmethod
94409437e1SDaniel P. Berrange    def deserialize(cls, data):
95409437e1SDaniel P. Berrange        return cls(
96409437e1SDaniel P. Berrange            data["name"],
97409437e1SDaniel P. Berrange            data["downtime"],
98409437e1SDaniel P. Berrange            data["bandwidth"],
99409437e1SDaniel P. Berrange            data["max_iters"],
100409437e1SDaniel P. Berrange            data["max_time"],
101409437e1SDaniel P. Berrange            data["pause"],
102409437e1SDaniel P. Berrange            data["pause_iters"],
103409437e1SDaniel P. Berrange            data["post_copy"],
104409437e1SDaniel P. Berrange            data["post_copy_iters"],
105409437e1SDaniel P. Berrange            data["auto_converge"],
106409437e1SDaniel P. Berrange            data["auto_converge_step"],
107409437e1SDaniel P. Berrange            data["compression_mt"],
108409437e1SDaniel P. Berrange            data["compression_mt_threads"],
109409437e1SDaniel P. Berrange            data["compression_xbzrle"],
1101c3baa1aSHyman            data["compression_xbzrle_cache"],
1111c3baa1aSHyman            data["multifd"],
1121c3baa1aSHyman            data["multifd_channels"])
113