Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0
4.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ public void FioExecutorSelectsTheExpectedDisksForTest_AllDisksScenario()
}
}

[Test]
public void FioExecutorExcludesUnmountedDisksEvenWhenTheyMatchTheDiskFilter()
{
Disk unmountedDisk = this.CreateDisk(4, PlatformID.Unix, os: false, "/dev/sdf", "/dev/sdf1");
unmountedDisk.Volumes.Single().AccessPaths = Array.Empty<string>();
this.profileParameters[nameof(FioExecutor.DiskFilter)] = "DiskPath:/dev/sdf";

using (TestFioExecutor workloadExecutor = new TestFioExecutor(this.Dependencies, this.profileParameters))
{
IEnumerable<Disk> actualDisks = workloadExecutor.GetDisksToTest(new[] { unmountedDisk });
Assert.IsEmpty(actualDisks);
}
}

[Test]
public void FioExecutorIdentifiesTheExpectedDisksWhenTheyAreExplicitlyDefined_LinuxScenario()
{
Expand Down
9 changes: 4 additions & 5 deletions src/VirtualClient/VirtualClient.Actions/FIO/FioExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -677,16 +677,15 @@ await this.Logger.LogMessageAsync($"{this.GetType().Name}.DeleteFiles", telemetr
}

/// <summary>
/// Returns the disks to test from the set of all disks.
/// Returns the mounted disks to test from the set of all disks.
/// </summary>
/// <param name="disks">All disks on the system.</param>
protected IEnumerable<Disk> GetDisksToTest(IEnumerable<Disk> disks)
{
List<Disk> disksToTest = new List<Disk>();
this.DiskFilter = string.IsNullOrWhiteSpace(this.DiskFilter) ? DiskFilters.DefaultDiskFilter : this.DiskFilter;
disksToTest = DiskFilters.FilterDisks(disks, this.DiskFilter, this.Platform).ToList();
IEnumerable<Disk> mountedDisks = disks.Where(disk => disk.Volumes?.Any(volume => volume.AccessPaths?.Any() == true) == true);

return disksToTest;
return DiskFilters.FilterDisks(mountedDisks, this.DiskFilter, this.Platform).ToList();
}

/// <summary>
Expand Down Expand Up @@ -830,7 +829,7 @@ protected virtual void CaptureMetrics(IProcessProxy workloadProcess, string test
this.MetadataContract.Add("fio_version", fioVersion, MetadataContract.DependenciesCategory);
}
}

if (this.MetricFilters?.Any() == true)
{
metrics = metrics.FilterBy(this.MetricFilters).ToList();
Expand Down
Loading