2 # Migration test migration operation progress
4 # Copyright (c) 2016 Red Hat, Inc.
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 class ProgressStats(object):
34 self
._transferred
_bytes
= transferred_bytes
35 self
._remaining
_bytes
= remaining_bytes
36 self
._total
_bytes
= total_bytes
37 self
._duplicate
_pages
= duplicate_pages
38 self
._skipped
_pages
= skipped_pages
39 self
._normal
_pages
= normal_pages
40 self
._normal
_bytes
= normal_bytes
41 self
._dirty
_rate
_pps
= dirty_rate_pps
42 self
._transfer
_rate
_mbs
= transfer_rate_mbs
43 self
._iterations
= iterations
47 "transferred_bytes": self
._transferred
_bytes
,
48 "remaining_bytes": self
._remaining
_bytes
,
49 "total_bytes": self
._total
_bytes
,
50 "duplicate_pages": self
._duplicate
_pages
,
51 "skipped_pages": self
._skipped
_pages
,
52 "normal_pages": self
._normal
_pages
,
53 "normal_bytes": self
._normal
_bytes
,
54 "dirty_rate_pps": self
._dirty
_rate
_pps
,
55 "transfer_rate_mbs": self
._transfer
_rate
_mbs
,
56 "iterations": self
._iterations
,
60 def deserialize(cls
, data
):
62 data
["transferred_bytes"],
63 data
["remaining_bytes"],
65 data
["duplicate_pages"],
66 data
["skipped_pages"],
69 data
["dirty_rate_pps"],
70 data
["transfer_rate_mbs"],
74 class Progress(object):
85 dirty_limit_throttle_time_per_round
,
86 dirty_limit_ring_full_time
):
91 self
._duration
= duration
92 self
._downtime
= downtime
93 self
._downtime
_expected
= downtime_expected
94 self
._setup
_time
= setup_time
95 self
._throttle
_pcent
= throttle_pcent
96 self
._dirty
_limit
_throttle
_time
_per
_round
= \
97 dirty_limit_throttle_time_per_round
98 self
._dirty
_limit
_ring
_full
_time
= \
99 dirty_limit_ring_full_time
103 "status": self
._status
,
104 "ram": self
._ram
.serialize(),
106 "duration": self
._duration
,
107 "downtime": self
._downtime
,
108 "downtime_expected": self
._downtime
_expected
,
109 "setup_time": self
._setup
_time
,
110 "throttle_pcent": self
._throttle
_pcent
,
111 "dirty_limit_throttle_time_per_round":
112 self
._dirty
_limit
_throttle
_time
_per
_round
,
113 "dirty_limit_ring_full_time":
114 self
._dirty
_limit
_ring
_full
_time
,
118 def deserialize(cls
, data
):
121 ProgressStats
.deserialize(data
["ram"]),
125 data
["downtime_expected"],
127 data
["throttle_pcent"],
128 data
["dirty_limit_throttle_time_per_round"],
129 data
["dirty_limit_ring_full_time"])