Parallel overlay builds

- Closes #1018

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-12-19 04:29:34 -07:00
parent 53e5805fbe
commit a59403ab3b
9 changed files with 83 additions and 50 deletions

View File

@@ -86,7 +86,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
}
}
return overlay.BuildSpecificOverlays(updateNodes, []string{overlayName})
return overlay.BuildSpecificOverlays(updateNodes, []string{overlayName}, Workers)
}
return nil

View File

@@ -1,6 +1,8 @@
package imprt
import (
"runtime"
"github.com/spf13/cobra"
"github.com/warewulf/warewulf/internal/pkg/overlay"
)
@@ -24,11 +26,13 @@ var (
}
NoOverlayUpdate bool
CreateDirs bool
Workers int
)
func init() {
baseCmd.PersistentFlags().BoolVarP(&NoOverlayUpdate, "noupdate", "n", false, "Don't update overlays")
baseCmd.PersistentFlags().BoolVarP(&CreateDirs, "parents", "p", false, "Create any necessary parent directories")
baseCmd.PersistentFlags().IntVar(&Workers, "workers", runtime.NumCPU(), "The number of parallel workers building overlays")
}
// GetRootCommand returns the root cobra.Command for the application.