When available, use "pigz" to speedup compression.
This commit is contained in:
@@ -42,6 +42,12 @@ func Build(name string, buildForce bool) error {
|
||||
|
||||
wwlog.Printf(wwlog.DEBUG, "Building VNFS image: '%s' -> '%s'\n", rootfsPath, imagePath)
|
||||
cmd := fmt.Sprintf("cd %s; find . | cpio --quiet -o -H newc | gzip -c > \"%s\"", rootfsPath, imagePath)
|
||||
// use pigz if available
|
||||
err = exec.Command("/bin/sh", "-c", "command -v pigz").Run()
|
||||
if err == nil {
|
||||
cmd = fmt.Sprintf("cd %s; find . | cpio --quiet -o -H newc | pigz -c > \"%s\"", rootfsPath, imagePath)
|
||||
}
|
||||
wwlog.Printf(wwlog.DEBUG, "RUNNING: %s\n", cmd)
|
||||
err = exec.Command("/bin/sh", "-c", cmd).Run()
|
||||
if err != nil {
|
||||
return errors.New("Failed building VNFS")
|
||||
|
||||
@@ -100,7 +100,13 @@ func Build(kernelVersion string, root string) (string, error) {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Building Kernel driver image\n")
|
||||
if _, err := os.Stat(kernelDrivers); err == nil {
|
||||
cmd := fmt.Sprintf("cd /; find .%s | cpio --quiet -o -H newc | gzip -c > \"%s\"", kernelDrivers, driversDestination)
|
||||
err := exec.Command("/bin/sh", "-c", cmd).Run()
|
||||
// use pigz if available
|
||||
err := exec.Command("/bin/sh", "-c", "command -v pigz").Run()
|
||||
if err == nil {
|
||||
cmd = fmt.Sprintf("cd /; find .%s | cpio --quiet -o -H newc | pigz -c > \"%s\"", kernelDrivers, driversDestination)
|
||||
}
|
||||
wwlog.Printf(wwlog.DEBUG, "RUNNING: %s\n", cmd)
|
||||
err = exec.Command("/bin/sh", "-c", cmd).Run()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -255,6 +255,11 @@ func buildOverlay(nodeList []node.NodeInfo, overlayType string) error {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Finished generating overlay directory for: %s\n", n.Id.Get())
|
||||
|
||||
cmd := fmt.Sprintf("cd \"%s\"; find . | cpio --quiet -o -H newc | gzip -c > \"%s\"", tmpDir, OverlayFile)
|
||||
// use pigz if available
|
||||
err = exec.Command("/bin/sh", "-c", "command -v pigz").Run()
|
||||
if err == nil {
|
||||
cmd = fmt.Sprintf("cd \"%s\"; find . | cpio --quiet -o -H newc | pigz -c > \"%s\"", tmpDir, OverlayFile)
|
||||
}
|
||||
wwlog.Printf(wwlog.DEBUG, "RUNNING: %s\n", cmd)
|
||||
err = exec.Command("/bin/sh", "-c", cmd).Run()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user