qemu: Use virDomainControllerDefNew() more

Instead of open-coding a partial version of it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Andrea Bolognani 2024-01-26 19:56:06 +01:00
parent 518e70158b
commit ac29f9396c

View File

@ -873,9 +873,9 @@ qemuDomainFindOrCreateSCSIDiskController(virDomainObj *vm,
/* No SCSI controller present, for backward compatibility we
* now hotplug a controller */
cont = g_new0(virDomainControllerDef, 1);
cont->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI;
cont = virDomainControllerDefNew(VIR_DOMAIN_CONTROLLER_TYPE_SCSI);
cont->idx = controller;
if (model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT)
cont->model = qemuDomainGetSCSIControllerModel(vm->def, cont, priv->qemuCaps);
else