virt-install -n "NAME" -r 1024 --import --disk path="1703_Disk.img" --accelerate --network network=default --connect=qemu:///system --vnc -v
Can someone explain me how to execute this in golang
virt-install -n "NAME" -r 1024 --import --disk path="1703_Disk.img" --accelerate --network network=default --connect=qemu:///system --vnc -v
Can someone explain me how to execute this in golang
The os/exec
package is what you're looking for:
cmdName := "virt-install"
args := []string{
"-n", "NAME",
"-r", "1024",
"--import",
"--disk", "path=1703_Disk.img"
"--accelerate",
"--network", "network=default",
"--connect=qemu:///system",
"-vnc",
"-v",
}
cmd := exec.Command(cmdName, args...)
if err := cmd.Start(); err != nil {
log.Fatal(err)
}
if err := cmd.Wait(); err != nil {
log.Fatal(err)
}