Compare commits
2 commits
a3b85f5926
...
5d157ec64d
| Author | SHA1 | Date | |
|---|---|---|---|
|
5d157ec64d |
|||
|
fbe6496e1e |
1 changed files with 9 additions and 4 deletions
|
|
@ -53,14 +53,19 @@ func Start(cfg Config) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
hasScsi := false
|
hasScsi := false
|
||||||
|
virtioBlk := 0
|
||||||
for _, d := range cfg.Disks {
|
for _, d := range cfg.Disks {
|
||||||
if strings.HasPrefix(d.Dev, "sd") {
|
if strings.HasPrefix(d.Dev, "sd") {
|
||||||
hasScsi = true
|
hasScsi = true
|
||||||
break
|
} else {
|
||||||
|
virtioBlk++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if virtioBlk > 1 {
|
||||||
|
return fmt.Errorf("qemu: %d disques virtio-blk (vd*) déclarés, un seul est supporté — utiliser des disques sd* pour les disques additionnels", virtioBlk)
|
||||||
|
}
|
||||||
if hasScsi {
|
if hasScsi {
|
||||||
args = append(args, "-device", "virtio-scsi-pci,id=scsi0")
|
args = append(args, "-device", "virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x1e")
|
||||||
}
|
}
|
||||||
|
|
||||||
sorted := make([]DiskConfig, len(cfg.Disks))
|
sorted := make([]DiskConfig, len(cfg.Disks))
|
||||||
|
|
@ -87,14 +92,14 @@ func Start(cfg Config) error {
|
||||||
} else {
|
} else {
|
||||||
args = append(args,
|
args = append(args,
|
||||||
"-drive", fmt.Sprintf("file=%s,if=none,id=%s", d.Path, d.Dev),
|
"-drive", fmt.Sprintf("file=%s,if=none,id=%s", d.Path, d.Dev),
|
||||||
"-device", fmt.Sprintf("virtio-blk-pci,drive=%s,bootindex=%d", d.Dev, bootindex),
|
"-device", fmt.Sprintf("virtio-blk-pci,drive=%s,bus=pci.0,addr=0x1f,bootindex=%d", d.Dev, bootindex),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args = append(args,
|
args = append(args,
|
||||||
"-netdev", fmt.Sprintf("tap,id=net0,ifname=tap%d,script=no,downscript=no", cfg.TapID),
|
"-netdev", fmt.Sprintf("tap,id=net0,ifname=tap%d,script=no,downscript=no", cfg.TapID),
|
||||||
"-device", fmt.Sprintf("virtio-net-pci,netdev=net0,mac=%s", cfg.Mac),
|
"-device", fmt.Sprintf("virtio-net-pci,netdev=net0,mac=%s,bus=pci.0,addr=0x03", cfg.Mac),
|
||||||
"-daemonize",
|
"-daemonize",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue