On 06/24/2012 10:47 PM, Qingtang Zhou wrote:
> * On 2012-06-23 21:35:37 +0800, Feng Yang (fy...@redhat.com) wrote:
>> Signed-off-by: Qingtang Zhou <qz...@redhat.com>
>> Signed-off-by: Amos Kong <ak...@redhat.com>
>> Signed-off-by: Feng Yang <fy...@redhat.com>
> Oh, glad to see this function is in upstream's list, lol.
>
> But upstream has a boottool script to handle different kinds of
> bootloader, thus can we update this function to use that powerful
> tool?

^ I thought about that too, but since we're dealing with the bootloader 
configuration inside the guest, we'd have to push boottool to the guest. 
I'd love to see that standardized, but I'm not sure it's worth the 
hassle it this point. Comments regarding this are welcome.

>
> And the original version of this patch lacks something, we'd better
> add them before it's in upstream.
>
>> ---
>>   client/virt/virt_test_utils.py |   32 ++++++++++++++++++++++++++++++++
>>   1 files changed, 32 insertions(+), 0 deletions(-)
>>
>> diff --git a/client/virt/virt_test_utils.py b/client/virt/virt_test_utils.py
>> index efcabbb..bc7a759 100644
>> --- a/client/virt/virt_test_utils.py
>> +++ b/client/virt/virt_test_utils.py
>> @@ -148,6 +148,38 @@ def reboot(vm, session, method="shell", 
>> sleep_before_reset=10, nic_index=0,
>>       return session
>>   
>>   
> missing error context mechanism.
>> +def update_boot_option(vm, args_removed=None, args_added=None,
>> +                       need_reboot=True):
>> +    """
>> +    Update guest default kernel option.
> docstring lacks parameters introduction.
>
>> +    """
>> +    if re.findall("win", vm.params.get("guest_name"), re.I):
> upstream's config file doesn't have 'guest_name' parameter, we should
> use 'os_type' instead.
>
>> +        # this function is only for linux, if we need to change
>> +        # windows guest's boot option, we can use a function like:
>> +        # update_win_bootloader(args_removed, args_added, reboot)
>> +        # (this function is not implement.)
>> +        # here we just:
>> +        return
>> +
>> +    login_timeout = int(vm.params.get("login_timeout"))
>> +    session = vm.wait_for_login(timeout=login_timeout)
>> +
>> +    logging.info("Update the kernel cmdline ...")
>> +    cmd = "grubby --update-kernel=`grubby --default-kernel` "
>> +    if args_removed:
>> +        cmd += '--remove-args="%s" ' % args_removed
>> +    if args_added:
>> +        cmd += '--args="%s"' % args_added
>> +    s, o = session.cmd_status_output(cmd)
>> +    if s != 0:
>> +        logging.error(o)
>> +        raise error.TestError("Fail to modify the kernel cmdline")
> I think functions in framework should raise a more specific exception.
> so that we can catch it in test script.
>
> cc'ed lmr, any advice?
>
>> +
>> +    if need_reboot:
>> +        logging.info("Rebooting ...")
>> +        vm.reboot(session=session, timeout=login_timeout)
>> +
>> +
>>   def migrate(vm, env=None, mig_timeout=3600, mig_protocol="tcp",
>>               mig_cancel=False, offline=False, stable_check=False,
>>               clean=False, save_path=None, dest_host='localhost', 
>> mig_port=None):
>> -- 
>> 1.7.7.6
>>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest


_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to