On Wed, Dec 5, 2012 at 6:19 PM, Chris Evich <[email protected]> wrote:
> On 12/05/2012 01:05 AM, Mike wrote:
>>
>> 在 2012-12-04二的 17:09 -0500,Chris Evich写道:
>>>
>>> On 12/03/2012 09:37 PM, Mike Qiu wrote:
>>>>
>>>> Currently, when try to get the ip address as mutil threads wait to
>>>> login to the guest, all threads will call update_db, which need to
>>>> lock the db file, this will raise error for lots of the threads.
>>>>
>>>> As all these threads just want to get the ip address of the guest,
>>>> These errors should not happen, and it will never change the db_file,
>>>> So, no need to call func update_db.
>>>>
>>>> By the way, self._INITIALIZED will be set to true after the network
>>>> interface be init.
>>>>
>>>> Signed-off-by: Mike Qiu<[email protected]>
>>>> ---
>>>>    virttest/utils_misc.py |    3 ---
>>>>    1 files changed, 0 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/virttest/utils_misc.py b/virttest/utils_misc.py
>>>> index d37cf87..b83b7cd 100644
>>>> --- a/virttest/utils_misc.py
>>>> +++ b/virttest/utils_misc.py
>>>> @@ -1004,9 +1004,6 @@ class DbNet(VMNet):
>>>>
>>>>        def __getitem__(self, index_or_name):
>>>>            # container class attributes are read-only, hook
>>>> -        # update_db here is only alternative
>>>> -        if self._INITIALIZED:
>>>> -            self.update_db()
>>>>            return super(DbNet, self).__getitem__(index_or_name)
>>>
>>>
>>> Dang, I wish I put a better comment :(  I do remember at the time I
>>> wrote it, it was important to acquiesce the db/dict state before
>>> returning value because we cannot guarantee WHEN new guest might have
>>> networking info. added/deleted.  Also the the underlying class storing
>>> these items had a __setitem__ limitation, which I think is what my
>>> comment refers to.
>>>
>>> The good news is the underlying storage class was changed recently, so
>>> my original concern over db/dict state consistency may no longer apply.
>>>    The concern you raise about lock contention with multiple threads is a
>>> bug since this is a case I was trying to solve for.
>>>
>>> Could you describe from higher level what you are seeing?  i.e. what
>>> code is trying to get IP address?
>>>
>> It's about the kvm test case vmstop, it just use 10 threads to login
>> to the guest, and copy file to the guest.
>> So for each threads need to get the ip address of the guest.
>>
>> As you now try to fix this problem, I will follow up your steps:)
>>
>>> With your patch above, does the utils_misc_unittest.py run fine?
>>>
>> I'm so sorry that it will fail.
>>
>>
>
> Mike,
>
> I think I might have fixed it:
>
> https://github.com/cevich/virt-test/tree/kvm_vmstop
>
> I'm running the test on an older machine, so it has "other" problems. I'm
> not seeing any lock contention with the vmstop test after these changes.
> The test does fail however due to other reasons:
>
> 15:07:10 ERROR| child process failed
> 15:07:10 DEBUG| Traceback (most recent call last):
> 15:07:10 DEBUG|   File "/usr/local/autotest/client/parallel.py", line 18, in
> fork_start
> 15:07:10 DEBUG|     l()
> 15:07:10 DEBUG|   File "/usr/local/autotest/client/job.py", line 529, in
> <lambda>
> 15:07:10 DEBUG|     l = lambda : test.runtest(self, url, tag, args, dargs)
> 15:07:10 DEBUG|   File "/usr/local/autotest/client/test.py", line 115, in
> runtest
> 15:07:10 DEBUG|     job.sysinfo.log_after_each_iteration)
> 15:07:10 DEBUG|   File "/usr/local/autotest/client/shared/test.py", line
> 938, in runtest
> 15:07:10 DEBUG|     mytest._exec(args, dargs)
> 15:07:10 DEBUG|   File "/usr/local/autotest/client/shared/test.py", line
> 431, in _exec
> 15:07:10 DEBUG|     _call_test_function(self.execute, *p_args, **p_dargs)
> 15:07:10 DEBUG|   File "/usr/local/autotest/client/shared/test.py", line
> 846, in _call_test_function
> 15:07:10 DEBUG|     return func(*args, **dargs)
> 15:07:10 DEBUG|   File "/usr/local/autotest/client/shared/test.py", line
> 304, in execute
> 15:07:10 DEBUG|     postprocess_profiled_run, args, dargs)
> 15:07:10 DEBUG|   File "/usr/local/autotest/client/shared/test.py", line
> 220, in _call_run_once
> 15:07:10 DEBUG|     self.run_once_profiling(postprocess_profiled_run,
> 15:07:10 DEBUG|   File "/usr/local/autotest/client/shared/test.py", line
> 327, in run_once_profiling
> 15:07:10 DEBUG|     self.run_once(*args, **dargs)
> 15:07:10 DEBUG|   File "/usr/local/autotest/client/tests/virt/virt.py", line
> 125, in run_once
> 15:07:10 DEBUG|     run_func(self, params, env)
> 15:07:10 DEBUG|   File
> "/usr/local/autotest/client/tests/virt/kvm/tests/vmstop.py", line 73, in
> run_vmstop
> 15:07:10 DEBUG|     raise error.TestFail("The produced state files differ")
> 15:07:10 DEBUG| TestFail: The produced state files differ
>
> But I'm not familiar with this test.  Would you mind checking to see if the
> changes I made on my branch work for this test on your setup?
>
> Specifically:
> https://github.com/cevich/virt-test/commit/0f7099b131698b41c6d742813f49c2218f393091

As is, the commit won't apply against next, but I have rebased it, and
I can confirm the unittests work and my test sets seem to work fine.



-- 
Lucas

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to