From: Peter Krempa <pkrempa@redhat.com>
When parsing port ranges for the port allocator VIR_ERR_INTERNAL_ERROR
is not the right error code for errors on the user-supplied numbers. Use
VIR_ERR_CONF_SYNTAX instead.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
src/qemu/qemu_conf.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index d43e0c2b97..712422f995 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -626,7 +626,7 @@ virQEMUDriverConfigLoadRemoteDisplayEntry(virQEMUDriverConfig *cfg,
/* if the port is too low, we can't get the display name
* to tell to vnc (usually subtract 5700, e.g. localhost:1
* for port 5701) */
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONF_SYNTAX,
_("%1$s: remote_websocket_port_min: port must be greater than or equal to %2$d"),
filename, QEMU_WEBSOCKET_PORT_MIN);
return -1;
@@ -636,14 +636,14 @@ virQEMUDriverConfigLoadRemoteDisplayEntry(virQEMUDriverConfig *cfg,
return -1;
if (cfg->webSocketPortMax > QEMU_WEBSOCKET_PORT_MAX ||
cfg->webSocketPortMax < cfg->webSocketPortMin) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONF_SYNTAX,
_("%1$s: remote_websocket_port_max: port must be between the minimal port and %2$d"),
filename, QEMU_WEBSOCKET_PORT_MAX);
return -1;
}
if (cfg->webSocketPortMin > cfg->webSocketPortMax) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONF_SYNTAX,
_("%1$s: remote_websocket_port_min: min port must not be greater than max port"),
filename);
return -1;
@@ -655,7 +655,7 @@ virQEMUDriverConfigLoadRemoteDisplayEntry(virQEMUDriverConfig *cfg,
/* if the port is too low, we can't get the display name
* to tell to vnc (usually subtract 5900, e.g. localhost:1
* for port 5901) */
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONF_SYNTAX,
_("%1$s: remote_display_port_min: port must be greater than or equal to %2$d"),
filename, QEMU_REMOTE_PORT_MIN);
return -1;
@@ -665,14 +665,14 @@ virQEMUDriverConfigLoadRemoteDisplayEntry(virQEMUDriverConfig *cfg,
return -1;
if (cfg->remotePortMax > QEMU_REMOTE_PORT_MAX ||
cfg->remotePortMax < cfg->remotePortMin) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONF_SYNTAX,
_("%1$s: remote_display_port_max: port must be between the minimal port and %2$d"),
filename, QEMU_REMOTE_PORT_MAX);
return -1;
}
if (cfg->remotePortMin > cfg->remotePortMax) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONF_SYNTAX,
_("%1$s: remote_display_port_min: min port must not be greater than max port"),
filename);
return -1;
@@ -979,7 +979,7 @@ virQEMUDriverConfigLoadNetworkEntry(virQEMUDriverConfig *cfg,
if (virConfGetValueUInt(conf, "migration_port_min", &cfg->migrationPortMin) < 0)
return -1;
if (cfg->migrationPortMin <= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONF_SYNTAX,
_("%1$s: migration_port_min: port must be greater than 0"),
filename);
return -1;
@@ -989,7 +989,7 @@ virQEMUDriverConfigLoadNetworkEntry(virQEMUDriverConfig *cfg,
return -1;
if (cfg->migrationPortMax > 65535 ||
cfg->migrationPortMax < cfg->migrationPortMin) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONF_SYNTAX,
_("%1$s: migration_port_max: port must be between the minimal port %2$d and 65535"),
filename, cfg->migrationPortMin);
return -1;
@@ -998,7 +998,7 @@ virQEMUDriverConfigLoadNetworkEntry(virQEMUDriverConfig *cfg,
if (virConfGetValueUInt(conf, "backup_port_min", &cfg->backupPortMin) < 0)
return -1;
if (cfg->backupPortMin <= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONF_SYNTAX,
_("%1$s: backup_port_min: port must be greater than 0"),
filename);
return -1;
@@ -1008,7 +1008,7 @@ virQEMUDriverConfigLoadNetworkEntry(virQEMUDriverConfig *cfg,
return -1;
if (cfg->backupPortMax > 65535 ||
cfg->backupPortMax < cfg->backupPortMin) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_CONF_SYNTAX,
_("%1$s: backup_port_max: port must be between the minimal port %2$d and 65535"),
filename, cfg->backupPortMin);
return -1;
--
2.53.0
© 2016 - 2026 Red Hat, Inc.