Merge pull request #3389 from rn/mac-qemu-rng

cmd/qemu: Disable rng on macOS
This commit is contained in:
Justin Cormack 2019-10-02 16:49:37 +01:00 committed by GitHub
commit 9e3f61058f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -574,15 +574,20 @@ func buildQemuCmdline(config QemuConfig) (QemuConfig, []string) {
}
}
rng := "rng-random,id=rng0"
if runtime.GOOS == "linux" {
rng = rng + ",filename=/dev/urandom"
}
if config.Arch == "s390x" {
qemuArgs = append(qemuArgs, "-object", rng, "-device", "virtio-rng-ccw,rng=rng0")
} else {
qemuArgs = append(qemuArgs, "-object", rng, "-device", "virtio-rng-pci,rng=rng0")
// rng-random does not work on macOS
// Temporarily disable it until fixed upstream.
if runtime.GOOS != "darwin" {
rng := "rng-random,id=rng0"
if runtime.GOOS == "linux" {
rng = rng + ",filename=/dev/urandom"
}
if config.Arch == "s390x" {
qemuArgs = append(qemuArgs, "-object", rng, "-device", "virtio-rng-ccw,rng=rng0")
} else {
qemuArgs = append(qemuArgs, "-object", rng, "-device", "virtio-rng-pci,rng=rng0")
}
}
var lastDisk int
for i, d := range config.Disks {
index := i