f-36: disk: check disk with vdX is only one
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
a3b85f5926
commit
fbe6496e1e
1 changed files with 6 additions and 1 deletions
|
|
@ -53,12 +53,17 @@ 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")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue