diff mbox series

[1/1] VM tests: account for changes in qemu.utils.get_info_usernet_hostfwd_port()

Message ID 20210601154546.130870-2-crosa@redhat.com (mailing list archive)
State New, archived
Headers show
Series VM tests: account for changes in qemu.utils.get_info_usernet_hostfwd_port() | expand

Commit Message

Cleber Rosa June 1, 2021, 3:45 p.m. UTC
The utility function actually accepts a string, and not the raw
dictionary response from QMP.  Also, it returns (optionally) an
integer, so that must also be accounted for.

Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 tests/vm/basevm.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Willian Rampazzo June 1, 2021, 5:36 p.m. UTC | #1
On Tue, Jun 1, 2021 at 12:46 PM Cleber Rosa <crosa@redhat.com> wrote:
>
> The utility function actually accepts a string, and not the raw
> dictionary response from QMP.  Also, it returns (optionally) an
> integer, so that must also be accounted for.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> ---
>  tests/vm/basevm.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 6f4f0fc95e..0f2e436ed3 100644
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -227,7 +227,7 @@ def _ssh_do(self, user, cmd, check):
>                     "-o", "UserKnownHostsFile=" + os.devnull,
>                     "-o",
>                     "ConnectTimeout={}".format(self._config["ssh_timeout"]),
> -                   "-p", self.ssh_port, "-i", self._ssh_tmp_key_file]
> +                   "-p", str(self.ssh_port), "-i", self._ssh_tmp_key_file]
>          # If not in debug mode, set ssh to quiet mode to
>          # avoid printing the results of commands.
>          if not self.debug:
> @@ -305,7 +305,7 @@ def boot(self, img, extra_args=[]):
>          # Init console so we can start consuming the chars.
>          self.console_init()
>          usernet_info = guest.qmp("human-monitor-command",
> -                                 command_line="info usernet")
> +                                 command_line="info usernet").get("return")
>          self.ssh_port = get_info_usernet_hostfwd_port(usernet_info)

From here, your file differs from the upstream and your patch does not
work. I'm trying on commit 52848929b70dcf92a68aedcfd90207be81ba3274.

>          if not self.ssh_port:
>              raise Exception("Cannot find ssh port from 'info usernet':\n%s" % \
> --
> 2.25.4
>
John Snow June 1, 2021, 5:56 p.m. UTC | #2
On 6/1/21 1:36 PM, Willian Rampazzo wrote:
> On Tue, Jun 1, 2021 at 12:46 PM Cleber Rosa <crosa@redhat.com> wrote:
>>
>> The utility function actually accepts a string, and not the raw
>> dictionary response from QMP.  Also, it returns (optionally) an
>> integer, so that must also be accounted for.
>>
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> Signed-off-by: Cleber Rosa <crosa@redhat.com>
>> ---
>>   tests/vm/basevm.py | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
>> index 6f4f0fc95e..0f2e436ed3 100644
>> --- a/tests/vm/basevm.py
>> +++ b/tests/vm/basevm.py
>> @@ -227,7 +227,7 @@ def _ssh_do(self, user, cmd, check):
>>                      "-o", "UserKnownHostsFile=" + os.devnull,
>>                      "-o",
>>                      "ConnectTimeout={}".format(self._config["ssh_timeout"]),
>> -                   "-p", self.ssh_port, "-i", self._ssh_tmp_key_file]
>> +                   "-p", str(self.ssh_port), "-i", self._ssh_tmp_key_file]
>>           # If not in debug mode, set ssh to quiet mode to
>>           # avoid printing the results of commands.
>>           if not self.debug:
>> @@ -305,7 +305,7 @@ def boot(self, img, extra_args=[]):
>>           # Init console so we can start consuming the chars.
>>           self.console_init()
>>           usernet_info = guest.qmp("human-monitor-command",
>> -                                 command_line="info usernet")
>> +                                 command_line="info usernet").get("return")
>>           self.ssh_port = get_info_usernet_hostfwd_port(usernet_info)
> 
>  From here, your file differs from the upstream and your patch does not
> work. I'm trying on commit 52848929b70dcf92a68aedcfd90207be81ba3274.
> 

Cleber is patching against my pull request -- I'll be squashing it into 
(from PR tree) 0739780d621f8fd4163ce6969a183e59113245aa -- just waiting 
on some tests to finish running before I move ahead with it.

commit 0739780d621f8fd4163ce6969a183e59113245aa
Author: Cleber Rosa <crosa@redhat.com>
Date:   Mon Apr 12 00:46:36 2021 -0400

     Python: add utility function for retrieving port redirection

     Slightly different versions for the same utility code are currently
     present on different locations.  This unifies them all, giving
     preference to the version from virtiofs_submounts.py, because of the
     last tweaks added to it.

     While at it, this adds a "qemu.utils" module to host the utility
     function and a test.

     Signed-off-by: Cleber Rosa <crosa@redhat.com>
     Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
     Reviewed-by: Eric Auger <eric.auger@redhat.com>
     Reviewed-by: Willian Rampazzo <willianr@redhat.com>
     Message-Id: <20210412044644.55083-4-crosa@redhat.com>
     Signed-off-by: John Snow <jsnow@redhat.com>


>>           if not self.ssh_port:
>>               raise Exception("Cannot find ssh port from 'info usernet':\n%s" % \
>> --
>> 2.25.4
>>
> 

thanks,
--js
Willian Rampazzo June 1, 2021, 6:07 p.m. UTC | #3
On Tue, Jun 1, 2021 at 2:36 PM Willian Rampazzo <wrampazz@redhat.com> wrote:
>
> On Tue, Jun 1, 2021 at 12:46 PM Cleber Rosa <crosa@redhat.com> wrote:
> >
> > The utility function actually accepts a string, and not the raw
> > dictionary response from QMP.  Also, it returns (optionally) an
> > integer, so that must also be accounted for.
> >
> > Signed-off-by: John Snow <jsnow@redhat.com>
> > Signed-off-by: Cleber Rosa <crosa@redhat.com>
> > ---
> >  tests/vm/basevm.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> > index 6f4f0fc95e..0f2e436ed3 100644
> > --- a/tests/vm/basevm.py
> > +++ b/tests/vm/basevm.py
> > @@ -227,7 +227,7 @@ def _ssh_do(self, user, cmd, check):
> >                     "-o", "UserKnownHostsFile=" + os.devnull,
> >                     "-o",
> >                     "ConnectTimeout={}".format(self._config["ssh_timeout"]),
> > -                   "-p", self.ssh_port, "-i", self._ssh_tmp_key_file]
> > +                   "-p", str(self.ssh_port), "-i", self._ssh_tmp_key_file]
> >          # If not in debug mode, set ssh to quiet mode to
> >          # avoid printing the results of commands.
> >          if not self.debug:
> > @@ -305,7 +305,7 @@ def boot(self, img, extra_args=[]):
> >          # Init console so we can start consuming the chars.
> >          self.console_init()
> >          usernet_info = guest.qmp("human-monitor-command",
> > -                                 command_line="info usernet")
> > +                                 command_line="info usernet").get("return")
> >          self.ssh_port = get_info_usernet_hostfwd_port(usernet_info)
>
> From here, your file differs from the upstream and your patch does not
> work. I'm trying on commit 52848929b70dcf92a68aedcfd90207be81ba3274.

Talking to Cleber he mentioned he submitted In-reply-to John's PR, but
Gmail did not show it for me.

On top of John's PR
(https://patchew.org/QEMU/20210528023220.417057-1-jsnow@redhat.com/):

Tested-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>

>
> >          if not self.ssh_port:
> >              raise Exception("Cannot find ssh port from 'info usernet':\n%s" % \
> > --
> > 2.25.4
> >
Philippe Mathieu-Daudé June 1, 2021, 6:21 p.m. UTC | #4
On 6/1/21 8:07 PM, Willian Rampazzo wrote:
> On Tue, Jun 1, 2021 at 2:36 PM Willian Rampazzo <wrampazz@redhat.com> wrote:
>>
>> On Tue, Jun 1, 2021 at 12:46 PM Cleber Rosa <crosa@redhat.com> wrote:
>>>
>>> The utility function actually accepts a string, and not the raw
>>> dictionary response from QMP.  Also, it returns (optionally) an
>>> integer, so that must also be accounted for.
>>>
>>> Signed-off-by: John Snow <jsnow@redhat.com>
>>> Signed-off-by: Cleber Rosa <crosa@redhat.com>
>>> ---
>>>  tests/vm/basevm.py | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
>>> index 6f4f0fc95e..0f2e436ed3 100644
>>> --- a/tests/vm/basevm.py
>>> +++ b/tests/vm/basevm.py
>>> @@ -227,7 +227,7 @@ def _ssh_do(self, user, cmd, check):
>>>                     "-o", "UserKnownHostsFile=" + os.devnull,
>>>                     "-o",
>>>                     "ConnectTimeout={}".format(self._config["ssh_timeout"]),
>>> -                   "-p", self.ssh_port, "-i", self._ssh_tmp_key_file]
>>> +                   "-p", str(self.ssh_port), "-i", self._ssh_tmp_key_file]
>>>          # If not in debug mode, set ssh to quiet mode to
>>>          # avoid printing the results of commands.
>>>          if not self.debug:
>>> @@ -305,7 +305,7 @@ def boot(self, img, extra_args=[]):
>>>          # Init console so we can start consuming the chars.
>>>          self.console_init()
>>>          usernet_info = guest.qmp("human-monitor-command",
>>> -                                 command_line="info usernet")
>>> +                                 command_line="info usernet").get("return")
>>>          self.ssh_port = get_info_usernet_hostfwd_port(usernet_info)
>>
>> From here, your file differs from the upstream and your patch does not
>> work. I'm trying on commit 52848929b70dcf92a68aedcfd90207be81ba3274.
> 
> Talking to Cleber he mentioned he submitted In-reply-to

Please don't, as the series end up buried in the other email thread.

> John's PR, but
> Gmail did not show it for me.
> 
> On top of John's PR
> (https://patchew.org/QEMU/20210528023220.417057-1-jsnow@redhat.com/):

The syntax is:

Based-on: 20210528023220.417057-1-jsnow@redhat.com

https://wiki.qemu.org/Contribute/SubmitAPatch#Base_patches_against_current_git_master

> 
> Tested-by: Willian Rampazzo <willianr@redhat.com>
> Reviewed-by: Willian Rampazzo <willianr@redhat.com>
> 
>>
>>>          if not self.ssh_port:
>>>              raise Exception("Cannot find ssh port from 'info usernet':\n%s" % \
>>> --
>>> 2.25.4
>>>
>
diff mbox series

Patch

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 6f4f0fc95e..0f2e436ed3 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -227,7 +227,7 @@  def _ssh_do(self, user, cmd, check):
                    "-o", "UserKnownHostsFile=" + os.devnull,
                    "-o",
                    "ConnectTimeout={}".format(self._config["ssh_timeout"]),
-                   "-p", self.ssh_port, "-i", self._ssh_tmp_key_file]
+                   "-p", str(self.ssh_port), "-i", self._ssh_tmp_key_file]
         # If not in debug mode, set ssh to quiet mode to
         # avoid printing the results of commands.
         if not self.debug:
@@ -305,7 +305,7 @@  def boot(self, img, extra_args=[]):
         # Init console so we can start consuming the chars.
         self.console_init()
         usernet_info = guest.qmp("human-monitor-command",
-                                 command_line="info usernet")
+                                 command_line="info usernet").get("return")
         self.ssh_port = get_info_usernet_hostfwd_port(usernet_info)
         if not self.ssh_port:
             raise Exception("Cannot find ssh port from 'info usernet':\n%s" % \