libvirt openvswitch del-port when it exists

Bug #1343262 reported by Karol Czeryna
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libvirt (Ubuntu)
Fix Released
Medium
Unassigned
Trusty
Fix Released
Medium
Unassigned

Bug Description

===================================================
SRU Justification:

Impact: a VM may fail to start due to a ovs port already existing
Test case:

    virsh start vm
    service openvswitch-switch stop
    virsh destroy vm
    service openvswitch-switch start
    virsh start vm

Regression potential: this patch has been applied upstream and only changes the ovs command used to create the ovs port. Nothing else should regress.
======================================================

Please submit a patch from mailing list,
Here is a content:

>-----Original Message-----
>From: Michal Privoznik [mailto:mprivozn redhat com]
>Sent: Thursday, July 03, 2014 8:39 PM
>To: Lichunhe; libvir-list redhat com
>Subject: Re: [libvirt] [PATCH]util:ovs:Delete port if it is exist when add port
>
>On 03.07.2014 13:57, 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,
>>
>> virsh start vm
>> service openvswitch-switch stop
>> virsh destroy vm
>> service openvswitch-switch start
>> virsh start vm
>>
>>
>> Signed-off-by: Chunhe Li <lichunhe huawei com>
>> ---
>>
>> src/util/virnetdevopenvswitch.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/util/virnetdevopenvswitch.c
>> b/src/util/virnetdevopenvswitch.c index 9bcbfb1..dd601c0 100644
>> --- a/src/util/virnetdevopenvswitch.c
>> +++ b/src/util/virnetdevopenvswitch.c
>> @@ -84,7 +84,8 @@ int virNetDevOpenvswitchAddPort(const char *brname,
>> const char *ifname,
>>
>> cmd = virCommandNew(OVSVSCTL);
>>
>> - virCommandAddArgList(cmd, "--timeout=5", "--", "--may-exist",
>"add-port",
>> + virCommandAddArgList(cmd, "--timeout=5", "--", "--if-exists",
>"del-port",
>> + ifname, "--", "--may-exist", "add-port",
>> brname, ifname, NULL);
>
>So what's the meaning of '--may-exist' then? Does it do anything useful after all?
>
>Michal

Also here is a reproduction of that bug (forgive me these is in Polish, I forgot to do LANG=C)

root@cthulu ~ % virsh start xmbc
błąd: Uruchomienie domeny xmbc nie powiodło się
błąd: Unable to add port vnet4 to OVS bridge br-nfs: Operation not permitted

root@cthulu ~ % ovs-vsctl del-port vnet4
root@cthulu ~ % virsh start xmbc
Domena xmbc została uruchomiona

root@cthulu ~ % virsh start testy
błąd: Uruchomienie domeny testy nie powiodło się
błąd: Unable to add port vnet5 to OVS bridge ovbr0: Operation not permitted

root@cthulu ~ % virsh list --all
root@cthulu ~ % ovs-vsctl del-port vnet5
root@cthulu ~ % virsh start testy
błąd: Uruchomienie domeny testy nie powiodło się
błąd: Unable to add port vnet6 to OVS bridge br-nfs: Operation not permitted

root@cthulu ~ % ovs-vsctl del-port vnet6
root@cthulu ~ % virsh start testy
Domena testy została uruchomiona

Here is the original link:
http://www.redhat.com/archives/libvir-list/2014-July/msg00181.html

Karol Czeryna (czeryna)
description: updated
Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 1343262] [NEW] libvirt openvswitch del-port when it exists

Thanks for submitting this bug.

Do you know whether

 a. this bug affects libvirt in trusty, or only in utopic?
 b. If this is fixed in the latest release?

If it is fixed in the latest release then we will suck the fix in with the
next merge. However if the bug also affects trusty then we'll need to
back-port the fix anyway.

 status: incomplete
 importance: medium

Changed in libvirt (Ubuntu):
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Karol Czeryna (czeryna) wrote :

a) I have utopic on my 'host' machine... So I can't check is it affects trusty but I believe in that.
b) no, it is not fixed in the latest release (but in git repo it is fixed**).

**According to libvirt gitrepo it is fixed: http://libvirt.org/git/?p=libvirt.git;a=commit;h=33445ce8446d9d061a1620cd8ec5e81fcca127d9

Changed in libvirt (Ubuntu):
status: Incomplete → Triaged
Changed in libvirt (Ubuntu Trusty):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libvirt - 1.2.6-0ubuntu5

---------------
libvirt (1.2.6-0ubuntu5) utopic; urgency=medium

  * cgroups-ignore-systemd-failure - fix incoming migration failures when
    systemd-shim is installed.
  * ovs-delete-port-if-exists-while-adding-new-one - cherrypick commit 33445ce
    from upstream (LP: #1343262)
 -- Serge Hallyn <email address hidden> Fri, 08 Aug 2014 09:56:43 -0500

Changed in libvirt (Ubuntu):
status: Triaged → Fix Released
description: updated
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Karol, or anyone else affected,

Accepted libvirt into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/libvirt/1.2.2-0ubuntu13.1.6 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in libvirt (Ubuntu Trusty):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Verified the test case passes with trusty-proposed.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Adam Conrad (adconrad) wrote : Update Released

The verification of the Stable Release Update for libvirt has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libvirt - 1.2.2-0ubuntu13.1.6

---------------
libvirt (1.2.2-0ubuntu13.1.6) trusty-proposed; urgency=medium

  * 9029-ovs-delete-port-if-it-exists-when-adding-new-one: cherrypick commit
    33445ce from upstream (LP: #1343262)
  * fix migration failure with ssh password authentication (LP: #1365947)
    - 9030-virsh-add-keepalive-in-new-vshconnect-fn
    - 9031-cmdmigrate-move-vshconnect-before-vshwatchjob
    - 9032-virsh-initialize-vsh-data-in-cmdmigrate
  * libvirt-bin.postinst: check for confiles whichhave been removed rather
    than fail package install (LP: #1375910)
  * Support incoming migration from 12.04 hosts (LP: #1374622)
    - debian/patches/support-incoming-qemu-kvm: add a flag to
      /etc/libvirt/qemu.conf to specify whether pc-1.0 came from a 12.04 host
    - Add a note in README.Debian.
 -- Serge Hallyn <email address hidden> Tue, 30 Sep 2014 13:54:31 -0500

Changed in libvirt (Ubuntu Trusty):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.