Re: [PATCH 1/4] qemu: interface: add qemuDomainDefIsOvsport

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

 



On 6/28/21 11:18 AM, zhangjl02 wrote:
> From: zhangjl02 <zhangjl02@xxxxxxxxxx>
> 
> Tell whether a port definition is an ovs managed virtual port
> ---
>  src/qemu/qemu_domain.c | 13 +++++++++++++
>  src/qemu/qemu_domain.h |  3 +++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index fc60e15eea..da5a226fc2 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -11575,3 +11575,16 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfig *cfg,
>  
>      return 0;
>  }
> +
> +/*
> + * Check whether the port is an ovs managed port
> + */
> +bool qemuDomainDefIsOvsport(virDomainNetDef *net,
> +                         int actualType) {
> +    const virNetDevVPortProfile *vport = virDomainNetGetActualVirtPortProfile(net);
> +    if ((actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) && vport  &&
> +        vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) {
> +        return true;
> +    }
> +    return false;
> +}
> \ No newline at end of file
> diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
> index acf6ca5ab6..81a9bf0cfb 100644
> --- a/src/qemu/qemu_domain.h
> +++ b/src/qemu/qemu_domain.h
> @@ -1063,3 +1063,6 @@ int
>  qemuDomainNamePathsCleanup(virQEMUDriverConfig *cfg,
>                             const char *name,
>                             bool bestEffort);
> +
> +bool qemuDomainDefIsOvsport(virDomainNetDef *net,
> +        int actualType);
> \ No newline at end of file
> 

There's nothing QEMU specific in this function. I think it can go into
src/conf/domain_conf.c (somewhere near
virDomainNetGetActualVirtPortProfile() perhaps) and that check from the
function - we have a few places like it, those can be replaced with the
function call.

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux