xref: /openbmc/qemu/tests/migration/guestperf/scenario.py (revision 1c3baa1ac4dee2b52837fda89d1d9deeb5da512e)
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,
32*1c3baa1aSHyman                 compression_xbzrle=False, compression_xbzrle_cache=10,
33*1c3baa1aSHyman                 multifd=False, multifd_channels=2):
34409437e1SDaniel P. Berrange
35409437e1SDaniel P. Berrange        self._name = name
36409437e1SDaniel P. Berrange
37409437e1SDaniel P. Berrange        # General migration tunables
38409437e1SDaniel P. Berrange        self._downtime = downtime  # milliseconds
39409437e1SDaniel P. Berrange        self._bandwidth = bandwidth # MiB per second
40409437e1SDaniel P. Berrange        self._max_iters = max_iters
41409437e1SDaniel P. Berrange        self._max_time = max_time # seconds
42409437e1SDaniel P. Berrange
43409437e1SDaniel P. Berrange
44409437e1SDaniel P. Berrange        # Strategies for ensuring completion
45409437e1SDaniel P. Berrange        self._pause = pause
46409437e1SDaniel P. Berrange        self._pause_iters = pause_iters
47409437e1SDaniel P. Berrange
48409437e1SDaniel P. Berrange        self._post_copy = post_copy
49409437e1SDaniel P. Berrange        self._post_copy_iters = post_copy_iters
50409437e1SDaniel P. Berrange
51409437e1SDaniel P. Berrange        self._auto_converge = auto_converge
52409437e1SDaniel P. Berrange        self._auto_converge_step = auto_converge_step # percentage CPU time
53409437e1SDaniel P. Berrange
54409437e1SDaniel P. Berrange        self._compression_mt = compression_mt
55409437e1SDaniel P. Berrange        self._compression_mt_threads = compression_mt_threads
56409437e1SDaniel P. Berrange
57409437e1SDaniel P. Berrange        self._compression_xbzrle = compression_xbzrle
58409437e1SDaniel P. Berrange        self._compression_xbzrle_cache = compression_xbzrle_cache # percentage of guest RAM
59409437e1SDaniel P. Berrange
60*1c3baa1aSHyman        self._multifd = multifd
61*1c3baa1aSHyman        self._multifd_channels = multifd_channels
62*1c3baa1aSHyman
63409437e1SDaniel P. Berrange    def serialize(self):
64409437e1SDaniel P. Berrange        return {
65409437e1SDaniel P. Berrange            "name": self._name,
66409437e1SDaniel P. Berrange            "downtime": self._downtime,
67409437e1SDaniel P. Berrange            "bandwidth": self._bandwidth,
68409437e1SDaniel P. Berrange            "max_iters": self._max_iters,
69409437e1SDaniel P. Berrange            "max_time": self._max_time,
70409437e1SDaniel P. Berrange            "pause": self._pause,
71409437e1SDaniel P. Berrange            "pause_iters": self._pause_iters,
72409437e1SDaniel P. Berrange            "post_copy": self._post_copy,
73409437e1SDaniel P. Berrange            "post_copy_iters": self._post_copy_iters,
74409437e1SDaniel P. Berrange            "auto_converge": self._auto_converge,
75409437e1SDaniel P. Berrange            "auto_converge_step": self._auto_converge_step,
76409437e1SDaniel P. Berrange            "compression_mt": self._compression_mt,
77409437e1SDaniel P. Berrange            "compression_mt_threads": self._compression_mt_threads,
78409437e1SDaniel P. Berrange            "compression_xbzrle": self._compression_xbzrle,
79409437e1SDaniel P. Berrange            "compression_xbzrle_cache": self._compression_xbzrle_cache,
80*1c3baa1aSHyman            "multifd": self._multifd,
81*1c3baa1aSHyman            "multifd_channels": self._multifd_channels,
82409437e1SDaniel P. Berrange        }
83409437e1SDaniel P. Berrange
84409437e1SDaniel P. Berrange    @classmethod
85409437e1SDaniel P. Berrange    def deserialize(cls, data):
86409437e1SDaniel P. Berrange        return cls(
87409437e1SDaniel P. Berrange            data["name"],
88409437e1SDaniel P. Berrange            data["downtime"],
89409437e1SDaniel P. Berrange            data["bandwidth"],
90409437e1SDaniel P. Berrange            data["max_iters"],
91409437e1SDaniel P. Berrange            data["max_time"],
92409437e1SDaniel P. Berrange            data["pause"],
93409437e1SDaniel P. Berrange            data["pause_iters"],
94409437e1SDaniel P. Berrange            data["post_copy"],
95409437e1SDaniel P. Berrange            data["post_copy_iters"],
96409437e1SDaniel P. Berrange            data["auto_converge"],
97409437e1SDaniel P. Berrange            data["auto_converge_step"],
98409437e1SDaniel P. Berrange            data["compression_mt"],
99409437e1SDaniel P. Berrange            data["compression_mt_threads"],
100409437e1SDaniel P. Berrange            data["compression_xbzrle"],
101*1c3baa1aSHyman            data["compression_xbzrle_cache"],
102*1c3baa1aSHyman            data["multifd"],
103*1c3baa1aSHyman            data["multifd_channels"])
104