mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
qemu: Move watchdog model validation into the validation code
Report the error from 'qemuValidateDomainWatchdogDef' rather than 'qemuBuildWatchdogDevStr'. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
fd2aed1ab5
commit
605a1e9d2e
@ -3688,14 +3688,10 @@ qemuBuildWatchdogDevStr(const virDomainDef *def,
|
||||
{
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
const char *model = virDomainWatchdogModelTypeToString(dev->model);
|
||||
if (!model) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("missing watchdog model"));
|
||||
return NULL;
|
||||
}
|
||||
virBufferAsprintf(&buf, "%s,id=%s",
|
||||
virDomainWatchdogModelTypeToString(dev->model),
|
||||
dev->info.alias);
|
||||
|
||||
virBufferAsprintf(&buf, "%s,id=%s", model, dev->info.alias);
|
||||
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info) < 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -2143,7 +2143,9 @@ qemuValidateDomainWatchdogDef(const virDomainWatchdogDef *dev,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_WATCHDOG_MODEL_LAST:
|
||||
break;
|
||||
default:
|
||||
virReportEnumRangeError(virDomainWatchdogModel, dev->model);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user