----- Original Message ----- > > Signed-off-by: Qingtang Zhou <qz...@redhat.com> > Signed-off-by: Amos Kong <ak...@redhat.com> > Signed-off-by: Feng Yang <fy...@redhat.com> > --- > 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 > > > +def update_boot_option(vm, args_removed=None, args_added=None, > + need_reboot=True): > + """ > + Update guest default kernel option. > + """ > + if re.findall("win", vm.params.get("guest_name"), re.I): > + # this function is only for linux, if we need to change
Better to decide by 'os_type' in guest-os.cfg.sample: # Windows section - @Windows: os_type = windows > + # 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") > + > + 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