From 00dba2e83ad80cd41b6b29efa642e2da826c2124 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Wed, 8 Aug 2018 12:54:23 -0400 Subject: [PATCH] ceph-volume util.disk do not modify self instance of Size objects Signed-off-by: Alfredo Deza --- src/ceph-volume/ceph_volume/util/disk.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ceph-volume/ceph_volume/util/disk.py b/src/ceph-volume/ceph_volume/util/disk.py index 70eb8d52864..fcefb28102a 100644 --- a/src/ceph-volume/ceph_volume/util/disk.py +++ b/src/ceph-volume/ceph_volume/util/disk.py @@ -484,31 +484,31 @@ class Size(object): def __add__(self, other): if isinstance(other, Size): - self._b = self._b + other._b - return self + _b = self._b + other._b + return Size(b=_b) raise TypeError('Cannot add "Size" object with int') def __sub__(self, other): if isinstance(other, Size): - self._b = self._b - other._b - return self + _b = self._b - other._b + return Size(b=_b) raise TypeError('Cannot subtract "Size" object from int') def __mul__(self, other): if isinstance(other, Size): raise TypeError('Cannot multiply with "Size" object') - self._b = self._b * other - return self + _b = self._b * other + return Size(b=_b) def __truediv__(self, other): if isinstance(other, Size): - raise TypeError('Cannot divide by "Size" object') + return self._b / other._b self._b = self._b / other return self def __div__(self, other): if isinstance(other, Size): - raise TypeError('Cannot divide by "Size" object') + return self._b / other._b self._b = self._b / other return self -- 2.39.5