1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
package machine
import (
"fmt"
"path/filepath"
"github.com/crc-org/crc/v2/pkg/crc/constants"
crcos "github.com/crc-org/crc/v2/pkg/os"
)
func copyDiskImage(destDir string) (string, string, error) {
const destFormat = "qcow2"
imageName := fmt.Sprintf("%s.qcow2", constants.DefaultName)
srcPath := filepath.Join(constants.MachineInstanceDir, constants.DefaultName, imageName)
destPath := filepath.Join(destDir, imageName)
_, _, err := crcos.RunWithDefaultLocale("qemu-img", "convert", "-f", "qcow2", "-O", destFormat, srcPath, destPath)
if err != nil {
return "", "", err
}
return destPath, destFormat, nil
}
|