diff mbox

[ovs-dev,V3,1/4] tests: Fixed access denied on ovs-vswitchd.log

Message ID 1464959151-11128-1-git-send-email-pboca@cloudbasesolutions.com
State Accepted
Headers show

Commit Message

Paul Boca June 3, 2016, 1:05 p.m. UTC
On Windows trying to overwrite the opened ovs-vswitchd.log
fails with access denied. Closing it before trying to overwrite it
solves the problem

Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
---
V2: Use same command both for Windows and Linux.
    Previous version had '.exe' extension at ovs-appctl.
---
 tests/ofproto-dpif.at | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alin Serdean June 6, 2016, 7:09 p.m. UTC | #1
From windows point of view, it looks good, because we need to close file (handle) before we try to move it.

In my opinion we should not change anything on the Linux side, so either ifdef it or create a new macro for this particular case (closing a log file) which can be used later on.

Maybe the rest have a different opinion on this subject.

> On Windows trying to overwrite the opened ovs-vswitchd.log fails with

> access denied. Closing it before trying to overwrite it solves the problem

> 

> Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>

> ---

> V2: Use same command both for Windows and Linux.

>     Previous version had '.exe' extension at ovs-appctl.

> ---
Ben Pfaff June 7, 2016, 4:22 a.m. UTC | #2
On Fri, Jun 03, 2016 at 01:05:54PM +0000, Paul Boca wrote:
> On Windows trying to overwrite the opened ovs-vswitchd.log
> fails with access denied. Closing it before trying to overwrite it
> solves the problem
> 
> Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
> ---
> V2: Use same command both for Windows and Linux.
>     Previous version had '.exe' extension at ovs-appctl.

Tested fine, looked fine.  Applied to master, thanks!
Ben Pfaff June 7, 2016, 4:23 a.m. UTC | #3
This test wasn't aimed specifically to test what happens if the log file
isn't closed before it's overwritten, so it seemed reasonable to me to
just close it everywhere.

I prefer to have only a single code path where we can.

On Mon, Jun 06, 2016 at 07:09:58PM +0000, Alin Serdean wrote:
> From windows point of view, it looks good, because we need to close
> file (handle) before we try to move it.
> 
> In my opinion we should not change anything on the Linux side, so
> either ifdef it or create a new macro for this particular case
> (closing a log file) which can be used later on.
> 
> Maybe the rest have a different opinion on this subject.
> 
> > On Windows trying to overwrite the opened ovs-vswitchd.log fails with
> > access denied. Closing it before trying to overwrite it solves the problem
> > 
> > Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
> > ---
> > V2: Use same command both for Windows and Linux.
> >     Previous version had '.exe' extension at ovs-appctl.
> > ---
>
diff mbox

Patch

diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index bf9cf88..094a699 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -6923,7 +6923,7 @@  OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
 # check log.
 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
-AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
+AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && ovs-appctl vlog/close && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
 
 # enable cfm on p0.
 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
@@ -6933,7 +6933,7 @@  OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
 # check log.
 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
-AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
+  AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && ovs-appctl vlog/close && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
 
 # enable both bfd and cfm on p0.
 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])