[libvirt] [PATCH v2 2/2] qemu: network user/direct/hostdev do not support backend.

Julio Faracco posted 2 patches 7 years, 5 months ago
[libvirt] [PATCH v2 2/2] qemu: network user/direct/hostdev do not support backend.
Posted by Julio Faracco 7 years, 5 months ago
The tag backend is not supported for user/direct/hostdev network when you
try to define them inside the domain XML. So, other ways to include devices
cannot be permitted too. But the attach-device command is wrongly adding
unsupported features. This commit fixes this bug.

After the patch:

virsh # attach-device rhel7.4 backend.xml
error: Failed to attach device from backend.xml
error: unsupported configuration: Custom tap device path is not supported for: user

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1480251

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
---
 src/qemu/qemu_domain.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index cc7596b..0215b2a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3608,6 +3608,13 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
                 goto cleanup;
             }
 
+            if (net->backend.tap) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("Custom tap device path is not supported for: %s"),
+                               virDomainNetTypeToString(net->type));
+                goto cleanup;
+            }
+
             for (i = 0; i < net->guestIP.nips; i++) {
                 const virNetDevIPAddr *ip = net->guestIP.ips[i];
 
@@ -3649,6 +3656,14 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
                     }
                 }
             }
+        } else if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT ||
+                   net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
+            if (net->backend.tap) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("Custom tap device path is not supported for: %s"),
+                               virDomainNetTypeToString(net->type));
+                goto cleanup;
+            }
         } else if (net->guestIP.nroutes || net->guestIP.nips) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Invalid attempt to set network interface "
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/2] qemu: network user/direct/hostdev do not support backend.
Posted by Ján Tomko 7 years, 5 months ago
On Fri, Nov 17, 2017 at 07:27:41PM -0200, Julio Faracco wrote:
>The tag backend is not supported for user/direct/hostdev network when you
>try to define them inside the domain XML. So, other ways to include devices
>cannot be permitted too. But the attach-device command is wrongly adding
>unsupported features. This commit fixes this bug.
>
>After the patch:
>
>virsh # attach-device rhel7.4 backend.xml
>error: Failed to attach device from backend.xml
>error: unsupported configuration: Custom tap device path is not supported for: user
>
>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1480251
>
>Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
>---
> src/qemu/qemu_domain.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
>diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>index cc7596b..0215b2a 100644
>--- a/src/qemu/qemu_domain.c
>+++ b/src/qemu/qemu_domain.c
>@@ -3649,6 +3656,14 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
>                     }
>                 }
>             }
>+        } else if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT ||
>+                   net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
>+            if (net->backend.tap) {
>+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>+                               _("Custom tap device path is not supported for: %s"),
>+                               virDomainNetTypeToString(net->type));
>+                goto cleanup;
>+            }

Adding this 'else if' clause means that the following check is no longer
executed for TYPE_DIRECT and TYPE_HOSTDEV:

>         } else if (net->guestIP.nroutes || net->guestIP.nips) {
>             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>                            _("Invalid attempt to set network interface "

Jan
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/2] qemu: network user/direct/hostdev do not support backend.
Posted by Julio Faracco 7 years, 5 months ago
Opssss... Python feelings!

2017-11-23 14:50 GMT-02:00 Ján Tomko <jtomko@redhat.com>:

> On Fri, Nov 17, 2017 at 07:27:41PM -0200, Julio Faracco wrote:
>
>> The tag backend is not supported for user/direct/hostdev network when you
>> try to define them inside the domain XML. So, other ways to include
>> devices
>> cannot be permitted too. But the attach-device command is wrongly adding
>> unsupported features. This commit fixes this bug.
>>
>> After the patch:
>>
>> virsh # attach-device rhel7.4 backend.xml
>> error: Failed to attach device from backend.xml
>> error: unsupported configuration: Custom tap device path is not supported
>> for: user
>>
>> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1480251
>>
>> Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
>> ---
>> src/qemu/qemu_domain.c | 15 +++++++++++++++
>> 1 file changed, 15 insertions(+)
>>
>> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>> index cc7596b..0215b2a 100644
>> --- a/src/qemu/qemu_domain.c
>> +++ b/src/qemu/qemu_domain.c
>> @@ -3649,6 +3656,14 @@ qemuDomainDeviceDefValidate(const
>> virDomainDeviceDef *dev,
>>                     }
>>                 }
>>             }
>> +        } else if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT ||
>> +                   net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
>> +            if (net->backend.tap) {
>> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>> +                               _("Custom tap device path is not
>> supported for: %s"),
>> +                               virDomainNetTypeToString(net->type));
>> +                goto cleanup;
>> +            }
>>
>
> Adding this 'else if' clause means that the following check is no longer
> executed for TYPE_DIRECT and TYPE_HOSTDEV:
>
>         } else if (net->guestIP.nroutes || net->guestIP.nips) {
>>             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>>                            _("Invalid attempt to set network interface "
>>
>
> Jan
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list