[libvirt] [PATCHv2]util:openvswitch:Delete port if it is exist when add port

Michal Privoznik mprivozn at redhat.com
Mon Jul 14 11:08:52 UTC 2014


On 12.07.2014 06:47, Lichunhe wrote:
> If the ovs service stop abnormal, or host cold reboot, vm is destroyed after ovs service stop. The ovs port which connect to interface of vm will not be clear. When the ovs service restart, recover configuration from db, but the interface is no exist, port recovery failed, and then vm restart on the same host, libvirt add port again, but the port configuration is same as before, ovs will not connect the interface, only store the configuration in db. Below will trigger this problem,

We like the commit messages wrapped at 80 characters per line.
Moreover, I find it somehow hard to parse.

>
> virsh start vm
> service openvswitch-switch stop
> virsh destroy vm
> service openvswitch-switch start
> virsh start vm
>
> Signed-off-by: Chunhe Li <lichunhe at huawei.com>
> ---
>
> src/util/virnetdevopenvswitch.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>

I had some difficulties applying this patch. Did you hand edit it before 
sending?

> diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
> index 9bcbfb1..2c414ad 100644
> --- a/src/util/virnetdevopenvswitch.c
> +++ b/src/util/virnetdevopenvswitch.c
> @@ -84,8 +84,8 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
>
>       cmd = virCommandNew(OVSVSCTL);
>
> -    virCommandAddArgList(cmd, "--timeout=5", "--", "--may-exist", "add-port",
> -                        brname, ifname, NULL);
> +    virCommandAddArgList(cmd, "--timeout=5", "--", "--if-exists", "del-port",

Trailing whitespace.

> +                        ifname, "--", "add-port", brname, ifname, NULL);
>
>       if (virtVlan && virtVlan->nTags > 0) {
> --
> 1.9.2.msysgit.0

Strange git version string :)

>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>

Well, I've pointed out enough problems to request v3, but since this 
practically oneliner, I rather fix all the nits and push.

ACKed and pushed.

Congratulations on your first libvirt contribution!

Michal




More information about the libvir-list mailing list