Merge "py3: Use real division operator" into f/centos8

This commit is contained in:
Zuul 2021-07-06 13:57:47 +00:00 committed by Gerrit Code Review
commit bc18f5edbc
4 changed files with 12 additions and 12 deletions

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
#
# Copyright (c) 2013-2019 Wind River Systems, Inc.
# Copyright (c) 2013-2021 Wind River Systems, Inc.
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4
@ -60,11 +60,11 @@ class Storage(base.APIDictWrapper):
def _Bytes_to_MiB(value_B):
return (value_B / (1024 * 1024))
return (value_B // (1024 * 1024))
def _Bytes_to_GiB(value_B):
return (value_B / (1024 * 1024 * 1024))
return (value_B // (1024 * 1024 * 1024))
def cluster_get():
@ -122,14 +122,14 @@ def storage_get():
'write_op_per_sec' in stats) else 0
if reads_per_sec:
io = {
'reads_per_sec': reads_per_sec / 1024,
'reads_per_sec': reads_per_sec // 1024,
'read_operations_per_sec': read_operations_per_sec,
'writes_per_sec': writes_per_sec / 1024,
'writes_per_sec': writes_per_sec // 1024,
'write_operations_per_sec': write_operations_per_sec
}
else:
io = {
'writes_per_sec': writes_per_sec / 1024,
'writes_per_sec': writes_per_sec // 1024,
'write_operations_per_sec': write_operations_per_sec
}

View File

@ -316,7 +316,7 @@ class StorageVolume(base.APIResourceWrapper):
@property
def journal_size_gib(self):
if self.journal_size_mib:
return self.journal_size_mib / 1024
return self.journal_size_mib // 1024
class PhysicalVolume(base.APIResourceWrapper):

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2013-2019 Wind River Systems, Inc.
# Copyright (c) 2013-2021 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -66,7 +66,7 @@ class UpdateCpuFunctionsView(forms.ModalFormView):
def get_physical_core_count(self, host, cpufunc, socket):
value = cpufunc.socket_cores_number.get(socket, 0)
if host.hyperthreading.lower() == "yes":
value = value / 2
value = value // 2
return value
def get_initial(self):

View File

@ -1,4 +1,4 @@
# Copyright (c) 2013-2019 Wind River Systems, Inc.
# Copyright (c) 2013-2021 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -347,7 +347,7 @@ class UpdateMemory(forms.SelfHandlingForm):
if(m.vm_pending_as_percentage == "True"):
vm_2M_field.initial = str(
round(m.vm_hugepages_nr_2M *
100 / m.vm_hugepages_possible_2M))
100 // m.vm_hugepages_possible_2M))
else:
vm_2M_field.initial = str(m.vm_hugepages_nr_2M)
else:
@ -370,7 +370,7 @@ class UpdateMemory(forms.SelfHandlingForm):
if(m.vm_pending_as_percentage == "True"):
vm_1G_field.initial = \
str(int(m.vm_hugepages_nr_1G
* 100 / m.vm_hugepages_possible_1G))
* 100 // m.vm_hugepages_possible_1G))
else:
vm_1G_field.initial = str(m.vm_hugepages_nr_1G)
elif vm_1g_supported: