On Thu, Jan 13, 2022 at 03:43:12PM +0100, Michal Prívozník wrote:
> switch ((virDomainChrSerialTargetModel)
serial->targetModel) {
> case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
> @@ -10750,11 +10752,24 @@ qemuBuildSerialChrDeviceProps(const virDomainDef *def,
> return NULL;
> }
>
> - if (virJSONValueObjectAdd(&props,
> - "s:driver",
virDomainChrSerialTargetModelTypeToString(serial->targetModel),
> - "s:chardev", chardev,
> - "s:id", serial->info.alias,
> - NULL) < 0)
There's no need to remove this code, especially when you're replacing it
with itself. The pattern that we can use here is:
if (virJSONValueObjectAdd(&props, ...) < 0) /* this is the unchanged
return NULL; call */
if (serial->targetModel == ISA_SERIAL &&
virJSONValueObjectAdd(&props,
"k:index", serial->target.port,
NULL) < 0)
return NULL;
Ah yes, much better, thanks!
regards
john