Cannot get dev=sda bus=sata

Greetings,

I am trying to create a template for a very specific type of machine on OpenNebula 5.2.0. This OS currently only supports a SATA boot device, but no matter what I put in the template the resulting XML is

<target dev='sda'/> or <target dev='sda' bus='scsi'/>

when I need it to be

<target dev='sda' bus='sata'/>

I’ve tried changing the bus type for the disk image to ‘custom’ and typing ‘sata’ into the box, and setting an attribute on the image definition called ‘BUS’. No matter what I do the bus gets set to ‘scsi’ or somehow qemu thinks I am requesting an old-style parallel IDE disk.

I found an issue discussing this (https://dev.opennebula.org/issues/3061), and I suspect the ‘custom’ option was intended to address it, but it doesn’t seem to be wired up. Ideas? Thanks.

Sorry to reply to my own post, but I did find a workaround.

In the “Target device” field for the boot disk I put

sda' bus='sata

Note the seemingly mismatched quotes. ONE’s xml template facility just blindly copies the field contents and generates what I wanted, which was

<target dev='sda' bus='sata'/>

and now the machine boots!

I’m guessing this is not the right way to do this, but it gets me to the next step.

DEV_PREFIX is used to specify the target, and to keep opennebula as hypervisor agnostic as possible, they choose that path. Still, it will not let you specify the bus that way, maybe it is an option to pass this as raw data to the hypervisor ?

When you update a template in sunstone, the “other” tab allows you to place raw XML code that opennebula passes to the hypervisor, maybe that will allow you to specify specific settings ?

as an example, this is what we needed to add for CPU passthrough in KVM, maybe something similar can be done to specify the bus, or to replace the entire storage part of your template instead:

Tab: Other
Field: Raw Data
Type: KVM
Data: <cpu mode='host-passthrough'/>

Thank you for sharing your workaround, this solved an issue we were facing!

Will it be properly fixed ?

This workaround only seems to work for 1 disk. We try to add a sdb:
erreur :unsupported configuration: target must be 0 for ide controller

In the disk attach view in sunstone, there are also many input fields (image mapping driver,
Disk provisioning type, Bus adapter controller) where we can choose “custom”, but no custom field appears. Only for the BUS field we can type something in a custom field, but it doesn’t appear in the deployment XML definition.

In upcoming OpenNebula 5.10 (and also already in master branch) you may configure the SD_DEVICE_BUS to either sata or scsi in VM template or vmm_exec_kvm.conf. Then when you choose DEV_PREFIX="sd" (in Sunstone you need to choose BUS option SCSI/SATA) you should get bus=sata in the libvirt deployment.

1 Like

happy little exploit right there.