Re: [Autotest] [PATCH 7/9] KVM test: Introduce the local_login()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/29/2010 02:44 AM, Amos Kong wrote:
> On Wed, Apr 28, 2010 at 03:01:40PM +0300, Michael Goldish wrote:
>> On 04/26/2010 01:04 PM, Jason Wang wrote:
>>> This patch introduces a new method which is used to log into the guest
>>> through the guest serial console. The serial_mode must be set to
>>> "session" in order to make use of this patch.
>>
>> In what cases would we want to use this feature?  The serial console is
>> not supported by all guests and I'm not sure it supports multiple
>> concurrent sessions (does it?), so it's probably not possible to use it
>> reliably as a replacement for the regular remote shell servers, or even
>> as an alternative variant.
> 
> We could not get system log by ssh session when network doesn't work(haven't
> launched, down, unstable, ...) Using serial console can get more useful info.
> Control guest by ssh in some network related testcases isn't credible. It should
> be independent.

Can you provide a usage example?  Which test is going to use this and
how?  Do you think it should be used in existing tests or in new tests only?

>  
> 
>>> Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx>
>>> ---
>>>  client/tests/kvm/kvm_vm.py |   25 +++++++++++++++++++++++++
>>>  1 files changed, 25 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
>>> index 0cdf925..a22893b 100755
>>> --- a/client/tests/kvm/kvm_vm.py
>>> +++ b/client/tests/kvm/kvm_vm.py
>>> @@ -814,7 +814,32 @@ class VM:
>>>                                                              "command", ""))
>>>          return session
>>>  
>>> +    def local_login(self, timeout=240):
>>> +        """
>>> +        Log into the guest via serial console
>>> +        If timeout expires while waiting for output from the guest (e.g. a
>>> +        password prompt or a shell prompt) -- fail.
>>> +        """
>>> +
>>> +        serial_mode = self.params.get("serial_mode")
>>> +        username = self.params.get("username", "")
>>> +        password = self.params.get("password", "")
>>> +        prompt = self.params.get("shell_prompt", "[\#\$]")
>>> +        linesep = eval("'%s'" % self.params.get("shell_linesep", r"\n"))
>>>  
>>> +        if serial_mode != "session":
>>> +            logging.debug("serial_mode is not session")
>>> +            return None
>>> +        else:
>>> +            command = "nc -U %s"  % self.serial_file_name
>>> +            assist = self.params.get("prompt_assist")
>>> +            session = kvm_utils.remote_login(command, password, prompt, linesep,
>>> +                                             timeout, "", username)
>>                                                          ^
>> You probably meant to pass the prompt assist string to remote_login()
>> but instead you're passing "".
>>
>>> +            if session:
>>> +                session.set_status_test_command(self.params.get("status_test_"
>>> +                                                                "command", ""))
>>> +            return session
>>> +            
>>>      def copy_files_to(self, local_path, remote_path, nic_index=0, timeout=300):
>>>          """
>>>          Transfer files to the guest.
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>> _______________________________________________
>> Autotest mailing list
>> Autotest@xxxxxxxxxxxxxxx
>> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux