Sent: Wednesday, July 18, 2018 at 12:38 AM
From: "John Ferlan" <jferlan(a)redhat.com>
To: "Shi Lei" <shilei.massclouds(a)gmx.com>, libvir-list(a)redhat.com
Subject: Re: [libvirt] [PATCH 3/3] fix other functions to add VIR_NETWORK_FORWARD_VLAN
On 07/05/2018 11:36 PM, Shi Lei wrote:
> Signed-off-by: Shi Lei <shilei.massclouds(a)gmx.com>
> ---
> src/conf/domain_conf.c | 1 +
> src/conf/virnetworkobj.c | 1 +
> src/qemu/qemu_process.c | 1 +
> 3 files changed, 3 insertions(+)
>
This should have been merged into the previous patch; however, this
doing point out to me that perhaps rather than "if" type conditions,
maybe it'd be better if there was a typed switch() with case:'s that
would then be noted during compilation when a new VIR_NETWORK_FORWARD_*
type was added.... That could be a patch added *prior to* patch 2.
John
OK and maybe I can try to make the patch (from 'if' to 'switch').
Thanks again!
Shi Lei
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index f4e59f6..bd8b050 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -29912,6 +29912,7 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface)
> if ((def->forward.type == VIR_NETWORK_FORWARD_NONE) ||
> (def->forward.type == VIR_NETWORK_FORWARD_NAT) ||
> (def->forward.type == VIR_NETWORK_FORWARD_ROUTE) ||
> + (def->forward.type == VIR_NETWORK_FORWARD_VLAN) ||
> (def->forward.type == VIR_NETWORK_FORWARD_OPEN)) {
> /* for these forward types, the actual net type really *is*
> * NETWORK; we just keep the info from the portgroup in
> diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
> index e00c8a7..3869021 100644
> --- a/src/conf/virnetworkobj.c
> +++ b/src/conf/virnetworkobj.c
> @@ -1012,6 +1012,7 @@ virNetworkLoadConfig(virNetworkObjListPtr nets,
> if (def->forward.type == VIR_NETWORK_FORWARD_NONE ||
> def->forward.type == VIR_NETWORK_FORWARD_NAT ||
> def->forward.type == VIR_NETWORK_FORWARD_ROUTE ||
> + def->forward.type == VIR_NETWORK_FORWARD_VLAN ||
> def->forward.type == VIR_NETWORK_FORWARD_OPEN) {
>
> if (!def->mac_specified) {
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 40d35cb..0e3e1af 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -4434,6 +4434,7 @@ qemuProcessGetNetworkAddress(const char *netname,
> case VIR_NETWORK_FORWARD_NAT:
> case VIR_NETWORK_FORWARD_ROUTE:
> case VIR_NETWORK_FORWARD_OPEN:
> + case VIR_NETWORK_FORWARD_VLAN:
> ipdef = virNetworkDefGetIPByIndex(netdef, AF_UNSPEC, 0);
> if (!ipdef) {
> virReportError(VIR_ERR_INTERNAL_ERROR,
>