mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
python: use // for integer division
This commit is contained in:
parent
3bbdde808a
commit
b2574c2f3a
@ -497,7 +497,7 @@ class Lv(LvCommon):
|
||||
# it is a thin lv
|
||||
if not dbo.IsThinVolume:
|
||||
if optional_size == 0:
|
||||
space = dbo.SizeBytes / 80
|
||||
space = dbo.SizeBytes // 80
|
||||
remainder = space % 512
|
||||
optional_size = space + 512 - remainder
|
||||
|
||||
|
@ -112,7 +112,7 @@ class TestLvm(unittest.TestCase):
|
||||
for d in device_list:
|
||||
vg.extend(d)
|
||||
|
||||
vg.createLvLinear(name, vg.getSize() / 2)
|
||||
vg.createLvLinear(name, vg.getSize() // 2)
|
||||
vg.close()
|
||||
vg = None
|
||||
|
||||
@ -124,14 +124,14 @@ class TestLvm(unittest.TestCase):
|
||||
vg.extend(d)
|
||||
|
||||
vg.createLvThinpool(
|
||||
pool_name, vg.getSize() / 2, 0, 0, lvm.THIN_DISCARDS_PASSDOWN, 1)
|
||||
pool_name, vg.getSize() // 2, 0, 0, lvm.THIN_DISCARDS_PASSDOWN, 1)
|
||||
return vg
|
||||
|
||||
@staticmethod
|
||||
def _create_thin_lv(pv_devices, name):
|
||||
thin_pool_name = 'thin_vg_pool_' + rs(4)
|
||||
vg = TestLvm._create_thin_pool(pv_devices, thin_pool_name)
|
||||
vg.createLvThin(thin_pool_name, name, vg.getSize() / 8)
|
||||
vg.createLvThin(thin_pool_name, name, vg.getSize() // 8)
|
||||
vg.close()
|
||||
vg = None
|
||||
|
||||
@ -231,7 +231,7 @@ class TestLvm(unittest.TestCase):
|
||||
curr_size = pv.getSize()
|
||||
dev_size = pv.getDevSize()
|
||||
self.assertTrue(curr_size == dev_size)
|
||||
pv.resize(curr_size / 2)
|
||||
pv.resize(curr_size // 2)
|
||||
with AllowedPVS() as pvs:
|
||||
pv = pvs[0]
|
||||
resized_size = pv.getSize()
|
||||
@ -718,7 +718,7 @@ class TestLvm(unittest.TestCase):
|
||||
def test_percent_to_float(self):
|
||||
self.assertEqual(lvm.percentToFloat(0), 0.0)
|
||||
self.assertEqual(lvm.percentToFloat(1000000), 1.0)
|
||||
self.assertEqual(lvm.percentToFloat(1000000 / 2), 0.5)
|
||||
self.assertEqual(lvm.percentToFloat(1000000 // 2), 0.5)
|
||||
|
||||
def test_scan(self):
|
||||
self.assertEqual(lvm.scan(), None)
|
||||
|
@ -1027,7 +1027,7 @@ class TestDbusService(unittest.TestCase):
|
||||
vg.Move(
|
||||
dbus.ObjectPath(location),
|
||||
dbus.Struct((0, 0), signature='tt'),
|
||||
dbus.Array([(dst, pv.PeCount / 2, 0), ], '(ott)'),
|
||||
dbus.Array([(dst, pv.PeCount // 2, 0), ], '(ott)'),
|
||||
dbus.Int32(g_tmo),
|
||||
EOD))
|
||||
self.assertEqual(job, '/')
|
||||
@ -1320,7 +1320,7 @@ class TestDbusService(unittest.TestCase):
|
||||
|
||||
original_size = pv.SizeBytes
|
||||
|
||||
new_size = original_size / 2
|
||||
new_size = original_size // 2
|
||||
|
||||
self.handle_return(
|
||||
pv.ReSize(
|
||||
@ -1454,7 +1454,7 @@ class TestDbusService(unittest.TestCase):
|
||||
|
||||
@staticmethod
|
||||
def _write_some_data(device_path, size):
|
||||
blocks = int(size / 512)
|
||||
blocks = int(size // 512)
|
||||
block = bytearray(512)
|
||||
for i in range(0, 512):
|
||||
block[i] = i % 255
|
||||
@ -1481,7 +1481,7 @@ class TestDbusService(unittest.TestCase):
|
||||
interfaces=(LV_COMMON_INT, LV_INT, SNAPSHOT_INT, ))
|
||||
|
||||
# Write some data to snapshot so merge takes some time
|
||||
TestDbusService._write_some_data(ss.LvCommon.Path, ss_size / 2)
|
||||
TestDbusService._write_some_data(ss.LvCommon.Path, ss_size // 2)
|
||||
|
||||
job_path = self.handle_return(
|
||||
ss.Snapshot.Merge(
|
||||
|
Loading…
Reference in New Issue
Block a user