On 07/10/2013 03:49 PM, yangdongsheng wrote:
>
> In virttest/env_process.py:
>
> > @@ -105,7 +107,8 @@ def preprocess_vm(test, params, env, name):
> >              if params.get("mac_changeable") == "yes":
> >                  utils_net.update_mac_ip_address(vm, params)
> >      else:
> > -        # Don't start the VM, just update its params
> > +        # Destroy the VM, and update its params
> > +        vm.destroy(gracefully=True, free_mac_addresses=False)
>
> Ok, got your point.
> But sometimes I need to test libvirt guest when it is shutoff. I 
> really prefer to do this work in env_process with some
> params(such as start_vm=no).
>
> In face there is another choice:
> (1). introduce a new param named vm_status=shutoff|paused|running <2>. 
> Add some code to parse this param as the following rules:
> a). if there is vm_status=None. Keep the start_vm and 
> paused_after_start_vm working as before.
> b). if there is a param named vm_status. ignore the start_vm and 
> paused_after_start_vm.
>
> On one hand, we can keep the old config file work well as what they 
> worked.
> On the other hand, we can unify the vm status related params and do 
> some more operations.
>
Yes, we need add a new control to cover this situation .

If start_vm == "kill_vm" or then we call vm.destroy to  make sure VM is 
killed before testing.  ( "kill_vm" is really not a good value, I do not 
like it. just an example)

Then start_vm has three kind of value:
yes: Make sure start vm before testing.
kill_vm:  Make sure kill vm before testing.
no or other value: Do nothing. Just like current code.

You also can add a new parameter.  We just need make the code simple enough.

Thanks for you ideas.


> What's your opinion?
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/autotest/virt-test/pull/617/files#r5109432>.
>