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 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):
89 self
._duration
= duration
90 self
._downtime
= downtime
91 self
._downtime
_expected
= downtime_expected
92 self
._setup
_time
= setup_time
93 self
._throttle
_pcent
= throttle_pcent
97 "status": self
._status
,
98 "ram": self
._ram
.serialize(),
100 "duration": self
._duration
,
101 "downtime": self
._downtime
,
102 "downtime_expected": self
._downtime
_expected
,
103 "setup_time": self
._setup
_time
,
104 "throttle_pcent": self
._throttle
_pcent
,
108 def deserialize(cls
, data
):
111 ProgressStats
.deserialize(data
["ram"]),
115 data
["downtime_expected"],
117 data
["throttle_pcent"])