Skip to content

Commit

Permalink
Rename size->space in LVMFactory._get_total_space
Browse files Browse the repository at this point in the history
The variable actually holds the information about the space the container
occupies so 'space' is just a better name.
  • Loading branch information
vpodzime authored and vathpela committed Nov 6, 2015
1 parent c924655 commit d49704a
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions blivet/devicefactory.py
Expand Up @@ -1235,45 +1235,45 @@ def _set_device_size(self):

def _get_total_space(self):
""" Total disk space requirement for this device and its container. """
size = Size(0)
space = Size(0)
if self.container and self.container.exists:
return size
return space

if self.container_size == SIZE_POLICY_AUTO:
# automatic container size management
if self.container:
size += sum([p.size for p in self.container.parents])
size -= self.container.free_space
space += sum([p.size for p in self.container.parents])
space -= self.container.free_space
elif self.container_size == SIZE_POLICY_MAX:
# grow the container as large as possible
if self.container:
size += sum(p.size for p in self.container.parents)
log.debug("size bumped to %s to include container parents", size)
space += sum(p.size for p in self.container.parents)
log.debug("size bumped to %s to include container parents", space)

size += self._get_free_disk_space()
log.debug("size bumped to %s to include free disk space", size)
space += self._get_free_disk_space()
log.debug("size bumped to %s to include free disk space", space)
else:
# container_size is a request for a fixed size for the container
# XXX: should respect the real extent size
size += blockdev.lvm.get_lv_physical_size(self.container_size, lvm.LVM_PE_SIZE)
space += blockdev.lvm.get_lv_physical_size(self.container_size, lvm.LVM_PE_SIZE)

# this does not apply if a specific container size was requested
if self.container_size in [SIZE_POLICY_AUTO, SIZE_POLICY_MAX]:
size += self._get_device_space()
log.debug("size bumped to %s to include new device space", size)
space += self._get_device_space()
log.debug("size bumped to %s to include new device space", space)
if self.device and self.container_size == SIZE_POLICY_AUTO:
# The member count here uses the container's current member set
# since that's the basis for the current device's disk space
# usage.
# XXX: should respect the real extent size
size -= blockdev.lvm.get_lv_physical_size(self.device.size, lvm.LVM_PE_SIZE)
log.debug("size cut to %s to omit old device space", size)
space -= blockdev.lvm.get_lv_physical_size(self.device.size, lvm.LVM_PE_SIZE)
log.debug("size cut to %s to omit old device space", space)

if self.container_encrypted:
# Add space for LUKS metadata, each parent will be encrypted
size += lvm.LVM_PE_SIZE * len(self.disks)
space += lvm.LVM_PE_SIZE * len(self.disks)

return size
return space

#
# methods related to parent/container devices
Expand Down

0 comments on commit d49704a

Please sign in to comment.