On Mon, Sep 17, 2012 at 1:25 PM, Chris Evich <[email protected]> wrote:
> On 09/14/2012 12:17 AM, Yiqiao Pu wrote:
>>
>> On 09/14/2012 03:44 AM, Chris Evich wrote:
>>>
>>> On 09/13/2012 01:51 PM, Lucas Meneghel Rodrigues wrote:
>>>>
>>>> From: Yiqiao Pu<[email protected]>
>>>>
>>>> Make kvm_vm create vm following the parameters, not the env,
>>>> otherwise the cases runs in a queue will create vm always
>>>> follow the first case's nic configuration.
>>>>
>>>> Signed-off-by: Yiqiao Pu<[email protected]>
>>>> ---
>>>> client/tests/virt/virttest/kvm_vm.py | 26 +++++++++++++++++++++++---
>>>> 1 file changed, 23 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/client/tests/virt/virttest/kvm_vm.py
>>>> b/client/tests/virt/virttest/kvm_vm.py
>>>> index 98dad8e..18f107c 100644
>>>> --- a/client/tests/virt/virttest/kvm_vm.py
>>>> +++ b/client/tests/virt/virttest/kvm_vm.py
>>>> @@ -904,6 +904,11 @@ class VM(virt_vm.BaseVM):
>>>> # Clone this VM using the new params
>>>> vm = self.clone(name, params, root_dir, copy_state=True)
>>>>
>>>> + # Update the virtnet with params
>>>> + params_virtnet = utils_misc.VirtNet(params, name, self.instance)
>>>> + if vm.virtnet != params_virtnet:
>>>> + vm.virtnet = params_virtnet
>>>> +
>>>> qemu_binary = utils_misc.get_path(os.path.join(root_dir,
>>>> params.get("vm_type")),
>>>> params.get("qemu_binary", "qemu"))
>>>> @@ -1435,6 +1440,10 @@ class VM(virt_vm.BaseVM):
>>>> name = self.name
>>>> params = self.params
>>>> root_dir = self.root_dir
>>>> + # Update the virtnet with params
>>>> + params_virtnet = utils_misc.VirtNet(params, name, self.instance)
>>>> + if self.virtnet != params_virtnet:
>>>> + self.virtnet = params_virtnet
>>>>
>>>> # Verify the md5sum of the ISO images
>>>> for cdrom in params.objects("cdroms"):
>>>> @@ -2619,11 +2628,22 @@ class VM(virt_vm.BaseVM):
>>>> """
>>>> if (self.__make_qemu_command() !=
>>>> self.__make_qemu_command(name, params, basedir)):
>>>> - logging.debug("VM params in env don't match requested, restarting.")
>>>> - return True
>>>> + restart = True
>>>> + else:
>>>> + for i, nic in enumerate(params.objects('nics')):
>>>> + if (self.virtnet[i]['netdst'] !=
>>>> + params.object_params('nic').get('netdst')):
>>>> + restart = True
>>>> + else:
>>>> + restart = False
>>>> +
>>>> + if restart:
>>>> + logging.debug("VM params in env don't match requested, "
>>>> + "restarting.")
>>>> else:
>>>> logging.debug("VM params in env do match requested, continuing.")
>>>> - return False
>>>> +
>>>> + return restart
>>>>
>>>> def pause(self):
>>>> """
>>>
>>>
>>> Talked with lucas on this. We believe this fix will solve the
>>> root-problem:
>>>
>>> https://github.com/kongove/autotest/commit/35bcae3e589a6e5fa6a48e39ea9b58e95ffd32f1#commitcomment-1851180
>>>
>>>
>>> You're patch may work, but in my experience vm.needs_restart() is VERY
>>> sensitive to messing with __init__ behavior. Amos's patch fixes the
>>> core of the problem by forcing virtnet to always initialize from params.
>>>
>>
>> Tried Amos's patch but find some problem as the netdst change will not
>> be catched by that fix. That fix only update the KVMIface related
>> parameters but not include ParamsNet. So It can not find the bridge
>> changed.
>>
>> And another problem I try to fix is after we using tap fd in our command
>> line the command line will shows no different when only netdst changed.
>> This may caused problem when there is a set of cases running without
>> kill vm after test. So any idea about this problem?
>>
>>
>> Thanks a lot for your review.
>>
>> _______________________________________________
>> Autotest-kernel mailing list
>> [email protected]
>> https://www.redhat.com/mailman/listinfo/autotest-kernel
>
>
> Here, this should help make comparing these in vm.needs_restart() much
> easier...
>
> (see attached)
>
> Now you can do "if virtnet1 == virtnet2: ..."
>
> N.B. I didn't commit this to next since I'm not sure if it's still frozen or
> not.

Still not frozen. I'm just back from travel, so tomorrow let's take a
look at this more carefully.

Cheers,

Lucas

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

Reply via email to