diff --git a/pkg/unikontainers/hypervisors/cloud_hypervisor.go b/pkg/unikontainers/hypervisors/cloud_hypervisor.go index 606a3c02..62bf9e08 100644 --- a/pkg/unikontainers/hypervisors/cloud_hypervisor.go +++ b/pkg/unikontainers/hypervisors/cloud_hypervisor.go @@ -108,6 +108,7 @@ func (ch *CloudHypervisor) BuildExecCmd(args types.ExecArgs, ukernel types.Unike // Block device configuration blockArgs := ukernel.MonitorBlockCli() + var disks []string for _, blockArg := range blockArgs { if blockArg.ExactArgs != "" { exArgs = append(exArgs, strings.Split(strings.TrimSpace(blockArg.ExactArgs), " ")...) @@ -116,9 +117,13 @@ func (ch *CloudHypervisor) BuildExecCmd(args types.ExecArgs, ukernel types.Unike if blockArg.ID != "" { diskArg += fmt.Sprintf(",id=%s", blockArg.ID) } - exArgs = append(exArgs, "--disk", diskArg) + disks = append(disks, diskArg) } } + if len(disks) > 0 { + exArgs = append(exArgs, "--disk") + exArgs = append(exArgs, disks...) + } // Initrd configuration if args.InitrdPath != "" {