Skip to content

Commit

Permalink
node: refactoring to init mount tool only needed
Browse files Browse the repository at this point in the history
  • Loading branch information
squirrelsc committed Oct 26, 2023
1 parent 1bb09a3 commit 0c8cd24
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lisa/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ def find_partition_with_freespace(
)
)

mount = self.tools[Mount]
lsblk = self.tools[Lsblk]
disks = lsblk.get_disks(force_run=True)
df = self.tools[Df]
Expand All @@ -377,8 +376,8 @@ def find_partition_with_freespace(
if disk.is_os_disk and not use_os_drive:
continue

# if the disk contains partition, check the partitions
if len(disk.partitions) > 0:
# if the disk contains partition, check the partitions only.
if disk.partitions:
for partition in disk.partitions:
# we only use root partition for OS disk
if disk.is_os_disk and partition.mountpoint != "/":
Expand All @@ -388,6 +387,7 @@ def find_partition_with_freespace(
disk_name = partition_name = partition.name
if not partition.is_mounted:
mountpoint = f"{PATH_REMOTE_ROOT}/{partition_name}"
mount = self.tools[Mount]
mount.mount(partition.device_name, mountpoint, format_=True)
else:
mountpoint = partition.mountpoint
Expand All @@ -411,6 +411,7 @@ def find_partition_with_freespace(
if not disk.is_mounted:
mountpoint = f"{PATH_REMOTE_ROOT}/{disk_name}"
self.tools[Mkfs].format_disk(disk.device_name, FileSystem.ext4)
mount = self.tools[Mount]
mount.mount(disk.device_name, mountpoint, format_=True)
else:
mountpoint = disk.mountpoint
Expand Down

0 comments on commit 0c8cd24

Please sign in to comment.