[libvirt PATCH 1/3] conf: remove <backend upstream='xxx'/> attribute

Jiri Denemark jdenemar at redhat.com
Fri Jan 13 08:56:53 UTC 2023


On Thu, Jan 12, 2023 at 23:42:16 -0500, Laine Stump wrote:
> This attribute was added to support setting the --interface option for
> passt, but in a post-push/pre-9.0-release review, danpb pointed out
> that it would be better to use the existing <source dev='xxx'/>
> attribute to set --interface rather than creating a new attribute (in
> the wrong place). So we remove backend/upstream, and change the passt
> commandline creation to grab the name for --interface from source/dev.
> 
> Signed-off-by: Laine Stump <laine at redhat.com>
> ---
>  docs/formatdomain.rst                     |  9 +++++----
>  src/conf/domain_conf.c                    | 15 +++++++++++++--
>  src/conf/domain_conf.h                    |  1 +
>  src/conf/schemas/domaincommon.rng         | 13 ++++++++-----
>  src/qemu/qemu_passt.c                     |  4 ++--
>  tests/qemuxml2argvdata/net-user-passt.xml |  3 ++-
>  6 files changed, 31 insertions(+), 14 deletions(-)
> 
...
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index e43dee1a60..5379204f89 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -9038,7 +9038,6 @@ virDomainNetBackendParseXML(xmlNodePtr node,
>      }
>  
>      def->backend.logFile = virXMLPropString(node, "logFile");
> -    def->backend.upstream = virXMLPropString(node, "upstream");
>  
>      if (tap)
>          def->backend.tap = virFileSanitizePath(tap);
> @@ -9464,6 +9463,9 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
>          break;
>  
>      case VIR_DOMAIN_NET_TYPE_USER:
> +        def->sourceDev = virXMLPropString(source_node, "dev");
> +        break;
> +
>      case VIR_DOMAIN_NET_TYPE_NULL:
>      case VIR_DOMAIN_NET_TYPE_LAST:
>          break;
> @@ -23277,6 +23279,9 @@ virDomainActualNetDefContentsFormat(virBuffer *buf,
>                  return -1;
>              }
>              virBufferAsprintf(buf, " mode='%s'", mode);
> +        } else if (actualType == VIR_DOMAIN_NET_TYPE_USER) {
> +
> +            virBufferEscapeString(buf, " dev='%s'", def->sourceDev);
>          }

Extra empty line.

>  
>          virBufferAddLit(buf, "/>\n");
...
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 60fc7c4eb2..3e4985a67d 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1192,6 +1192,7 @@ struct _virDomainNetDef {
>      virNetDevIPInfo hostIP;
>      char *ifname_guest_actual;
>      char *ifname_guest;
> +    char *sourceDev;
>      virNetDevIPInfo guestIP;
>      size_t nPortForwards;
>      virDomainNetPortForward **portForwards;

The pointer stored in sourceDev is not freed in virDomainNetDefFree.

Jirka


More information about the libvir-list mailing list