On Tue, Apr 18, 2023 at 03:19:45PM +0200, Ján Tomko wrote:
On a Tuesday in 2023, Andrea Bolognani wrote:
> That's already the case in practice, but it's a better
> experience for the user if we reject this configuration
> outright instead of silently ignoring part of it.
>
> Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
> ---
> src/conf/domain_validate.c | 9 +++++++++
> ...t-user-slirp-portforward.x86_64-latest.err | 1 +
> .../net-user-slirp-portforward.xml | 20 +++++++++++++++++++
> tests/qemuxml2argvtest.c | 1 +
> 4 files changed, 31 insertions(+)
> create mode 100644
tests/qemuxml2argvdata/net-user-slirp-portforward.x86_64-latest.err
> create mode 100644 tests/qemuxml2argvdata/net-user-slirp-portforward.xml
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Thanks for the review!
Right before pushing, I realized that VIR_ERR_INTERNAL_ERROR is
probably not the best fit for this scenario. Are you okay with me
squashing in the changes below?
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 9c7ee6d75d..e04b85fee4 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2101,7 +2101,7 @@ virDomainNetDefValidate(const virDomainNetDef *net)
(net->type != VIR_DOMAIN_NET_TYPE_USER ||
(net->type == VIR_DOMAIN_NET_TYPE_USER &&
net->backend.type != VIR_DOMAIN_NET_BACKEND_PASST))) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("The <portForward> element can only be used
with <interface type='user'> and its 'passt' backend"));
return -1;
}
diff --git a/tests/qemuxml2argvdata/net-user-slirp-portforward.x86_64-latest.err
b/tests/qemuxml2argvdata/net-user-slirp-portforward.x86_64-latest.err
index f296db1e8c..eaa934742e 100644
--- a/tests/qemuxml2argvdata/net-user-slirp-portforward.x86_64-latest.err
+++ b/tests/qemuxml2argvdata/net-user-slirp-portforward.x86_64-latest.err
@@ -1 +1 @@
-internal error: The <portForward> element can only be used with
<interface type='user'> and its 'passt' backend
+unsupported configuration: The <portForward> element can only be used
with <interface type='user'> and its 'passt' backend
--
Andrea Bolognani / Red Hat / Virtualization