qemuBuildVirtioDevStr: Don't return early
To simplify upcoming refactors change the logic such that we don't return early for device types which can't be transitional. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
bc130288a3
commit
085d9b40a6
@ -615,7 +615,8 @@ qemuBuildVirtioDevStr(virBuffer *buf,
|
||||
const char *implName = NULL;
|
||||
virDomainDeviceDef device = { .type = devtype };
|
||||
virDomainDeviceInfo *info;
|
||||
bool has_tmodel, has_ntmodel;
|
||||
bool has_tmodel = false;
|
||||
bool has_ntmodel = false;
|
||||
|
||||
virDomainDeviceSetData(&device, devdata);
|
||||
info = virDomainDeviceGetInfo(&device);
|
||||
@ -667,10 +668,10 @@ qemuBuildVirtioDevStr(virBuffer *buf,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
||||
if (device.data.hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST)
|
||||
return 0;
|
||||
if (device.data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) {
|
||||
has_tmodel = device.data.hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL;
|
||||
has_ntmodel = device.data.hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TRANSITIONAL;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_RNG:
|
||||
@ -694,10 +695,10 @@ qemuBuildVirtioDevStr(virBuffer *buf,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_INPUT:
|
||||
if (device.data.input->type != VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH)
|
||||
return 0;
|
||||
if (device.data.input->type == VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) {
|
||||
has_tmodel = device.data.input->model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL;
|
||||
has_ntmodel = device.data.input->model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_CONTROLLER:
|
||||
@ -707,8 +708,6 @@ qemuBuildVirtioDevStr(virBuffer *buf,
|
||||
} else if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
|
||||
has_tmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL;
|
||||
has_ntmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -731,11 +730,11 @@ qemuBuildVirtioDevStr(virBuffer *buf,
|
||||
case VIR_DOMAIN_DEVICE_AUDIO:
|
||||
case VIR_DOMAIN_DEVICE_LAST:
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
||||
(has_tmodel || has_ntmodel)) {
|
||||
if (has_tmodel || has_ntmodel) {
|
||||
if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("virtio (non-)transitional models are not "
|
||||
"supported for address type=%s"),
|
||||
@ -770,6 +769,7 @@ qemuBuildVirtioDevStr(virBuffer *buf,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user