[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 3/7] virDomainActualNetDefContentsFormat: Format class_id more frequently



On 04/14/2015 12:59 PM, Michal Privoznik wrote:
> After a360912179 the formatting of virDomainActualNetDefPtr was
> changed a bit. However, during the function rewrite, iface's class_id
> is not formatted as frequently as it could be. In fact, after rewrite
> it's formatted only for iface of type VIR_DOMAIN_NET_TYPE_DIRECT where
> it makes no sense and is unused. While where needed (_TYPE_NETWORK) is
> not formatted at all. 

Yikes! That was a typo when moving the code around. Should have been
VIR_DOMAIN_NET_TYPE_NETWORK (that bit was inside "case
VIR_DOMAIN_NET_TYPE_NETWORK previous to the patch)

> This makes the daemon forget it upon daemon
> restart resulting in bad behaviour.
>
> Signed-off-by: Michal Privoznik <mprivozn redhat com>
> ---
>  src/conf/domain_conf.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 4d7e3c9..ab4f2bf 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -18608,8 +18608,7 @@ virDomainActualNetDefContentsFormat(virBufferPtr buf,
>  
>          virBufferAddLit(buf, "/>\n");
>      }
> -    if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT &&
> -        def->data.network.actual && def->data.network.actual->class_id) {
> +    if (def->data.network.actual && def->data.network.actual->class_id) {
>          virBufferAsprintf(buf, "<class id='%u'/>\n",
>                            def->data.network.actual->class_id);
>      }

I suppose since the modes that wouldn't have been able to setup any
bandwidth limiting would have class_id == 0, this works. If you for some
reason wanted to protect against using it for hostdev interfaces, yoou
could move it up into the preceding else clause, but I guess I don't see
any gain from that.

ACK.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]