Skip to content

Commit

Permalink
squash: rename SizedConstraint
Browse files Browse the repository at this point in the history
  • Loading branch information
happz committed Jan 11, 2024
1 parent 379ef8f commit aef8e77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tmt/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ def variants(
yield (members or []) + [self]


class SizedConstraint(Constraint['Size']):
class SizeConstraint(Constraint['Size']):
""" A constraint representing a size of resource, usually a storage """

@classmethod
Expand Down Expand Up @@ -989,7 +989,7 @@ def _parse_disk(spec: Spec, disk_index: int) -> BaseConstraint:
group = And()

group.constraints += [
SizedConstraint.from_specification(
SizeConstraint.from_specification(
f'disk[{disk_index}].{constraint_name}',
str(spec[constraint_name]))
for constraint_name in ('size',)
Expand Down Expand Up @@ -1111,7 +1111,7 @@ def _parse_generic_spec(spec: Spec) -> BaseConstraint:
group.constraints += [_parse_cpu(spec['cpu'])]

if 'memory' in spec:
group.constraints += [SizedConstraint.from_specification('memory', str(spec['memory']))]
group.constraints += [SizeConstraint.from_specification('memory', str(spec['memory']))]

if 'disk' in spec:
group.constraints += [_parse_disks(spec['disk'])]
Expand Down
8 changes: 4 additions & 4 deletions tmt/steps/provision/testcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def _combine_hw_memory(self) -> None:
if self.memory is None:
return

memory_constraint = tmt.hardware.SizedConstraint.from_specification(
memory_constraint = tmt.hardware.SizeConstraint.from_specification(
'memory', str(self.memory))

self.hardware.and_(memory_constraint)
Expand All @@ -495,7 +495,7 @@ def _combine_hw_disk_size(self) -> None:
if self.disk is None:
return

disk_size_constraint = tmt.hardware.SizedConstraint.from_specification(
disk_size_constraint = tmt.hardware.SizeConstraint.from_specification(
'disk[0].size',
str(self.disk))

Expand All @@ -519,7 +519,7 @@ def _apply_hw_memory(self, domain: 'DomainConfiguration') -> None:
memory_constraints = [
constraint
for constraint in variant
if isinstance(constraint, tmt.hardware.SizedConstraint)
if isinstance(constraint, tmt.hardware.SizeConstraint)
and constraint.expand_name().name == 'memory']

if not memory_constraints:
Expand Down Expand Up @@ -565,7 +565,7 @@ def _apply_hw_disk_size(self, domain: 'DomainConfiguration') -> 'QCow2StorageDev
disk_size_constraints = [
constraint
for constraint in variant
if isinstance(constraint, tmt.hardware.SizedConstraint)
if isinstance(constraint, tmt.hardware.SizeConstraint)
and constraint.expand_name().name == 'disk'
and constraint.expand_name().child_name == 'size']

Expand Down

0 comments on commit aef8e77

Please sign in to comment.