Skip to content

Commit

Permalink
Merge pull request #1177 from stgraber/main
Browse files Browse the repository at this point in the history
incusd/storage/zfs: Only attempt to load the module if the tools exist
  • Loading branch information
hallyn authored Sep 3, 2024
2 parents d9e8c38 + 33a178f commit 8032164
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/server/storage/drivers/driver_zfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ func (d *zfs) load() error {
return nil
}

// Load the kernel module.
err := linux.LoadModule("zfs")
if err != nil {
return fmt.Errorf("Error loading %q module: %w", "zfs", err)
}

// Validate the needed tools are present.
for _, tool := range []string{"zpool", "zfs"} {
_, err := exec.LookPath(tool)
Expand All @@ -85,6 +79,12 @@ func (d *zfs) load() error {
}
}

// Load the kernel module.
err := linux.LoadModule("zfs")
if err != nil {
return fmt.Errorf("Error loading %q module: %w", "zfs", err)
}

// Get the version information.
if zfsVersion == "" {
version, err := d.version()
Expand Down

0 comments on commit 8032164

Please sign in to comment.