diff mbox series

[5/6] net: Silence 'has no peer' messages in testing mode

Message ID 1534258018-22859-6-git-send-email-thuth@redhat.com
State New
Headers show
Series Various qtest-related patches and a mc146818rtc fix | expand

Commit Message

Thomas Huth Aug. 14, 2018, 2:46 p.m. UTC
When running qtests with -nodefaults, we are not interested in
these 'XYZ has no peer' messages.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 vl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Paolo Bonzini Aug. 14, 2018, 3:33 p.m. UTC | #1
On 14/08/2018 16:46, Thomas Huth wrote:
> When running qtests with -nodefaults, we are not interested in
> these 'XYZ has no peer' messages.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  vl.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index 16b913f..7055df3 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4559,11 +4559,10 @@ int main(int argc, char **argv, char **envp)
>       * (2) CONFIG_SLIRP not set, in which case the implicit "-net nic"
>       * sets up a nic that isn't connected to anything.
>       */
> -    if (!default_net) {
> +    if (!default_net && (!qtest_enabled() || has_defaults)) {
>          net_check_clients();
>      }
>  

Why does it have no peer?  Not a nack, just curiosity.

Paolo
Thomas Huth Aug. 14, 2018, 3:43 p.m. UTC | #2
On 08/14/2018 05:33 PM, Paolo Bonzini wrote:
> On 14/08/2018 16:46, Thomas Huth wrote:
>> When running qtests with -nodefaults, we are not interested in
>> these 'XYZ has no peer' messages.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>  vl.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/vl.c b/vl.c
>> index 16b913f..7055df3 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -4559,11 +4559,10 @@ int main(int argc, char **argv, char **envp)
>>       * (2) CONFIG_SLIRP not set, in which case the implicit "-net nic"
>>       * sets up a nic that isn't connected to anything.
>>       */
>> -    if (!default_net) {
>> +    if (!default_net && (!qtest_enabled() || has_defaults)) {
>>          net_check_clients();
>>      }
>>  
> 
> Why does it have no peer?  Not a nack, just curiosity.

The machines which emulate an embedded system often always create a NIC
(since it is hard-wired on the board, not optional). But since there is
no back-end on the host side with "-nodefaults", the net_check_clients()
function complains in this case.

For example:

$ microblaze-softmmu/qemu-system-microblaze -nodefaults -S
qemu-system-microblaze: warning: nic xlnx.xps-ethernetlite.0 has no peer

 Thomas
Paolo Bonzini Aug. 14, 2018, 3:57 p.m. UTC | #3
On 14/08/2018 17:43, Thomas Huth wrote:
> On 08/14/2018 05:33 PM, Paolo Bonzini wrote:
>> On 14/08/2018 16:46, Thomas Huth wrote:
>>> When running qtests with -nodefaults, we are not interested in
>>> these 'XYZ has no peer' messages.
>>>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>>  vl.c | 3 +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/vl.c b/vl.c
>>> index 16b913f..7055df3 100644
>>> --- a/vl.c
>>> +++ b/vl.c
>>> @@ -4559,11 +4559,10 @@ int main(int argc, char **argv, char **envp)
>>>       * (2) CONFIG_SLIRP not set, in which case the implicit "-net nic"
>>>       * sets up a nic that isn't connected to anything.
>>>       */
>>> -    if (!default_net) {
>>> +    if (!default_net && (!qtest_enabled() || has_defaults)) {
>>>          net_check_clients();
>>>      }
>>>  
>>
>> Why does it have no peer?  Not a nack, just curiosity.
> 
> The machines which emulate an embedded system often always create a NIC
> (since it is hard-wired on the board, not optional). But since there is
> no back-end on the host side with "-nodefaults", the net_check_clients()
> function complains in this case.

Ok, the has_defaults test then makes sense.  Is the qtest_enabled() part
still needed, or is the message unnecessary even in normal operation?

Paolo
Thomas Huth Aug. 14, 2018, 4:01 p.m. UTC | #4
On 08/14/2018 05:57 PM, Paolo Bonzini wrote:
> On 14/08/2018 17:43, Thomas Huth wrote:
>> On 08/14/2018 05:33 PM, Paolo Bonzini wrote:
>>> On 14/08/2018 16:46, Thomas Huth wrote:
>>>> When running qtests with -nodefaults, we are not interested in
>>>> these 'XYZ has no peer' messages.
>>>>
>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>> ---
>>>>  vl.c | 3 +--
>>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>>
>>>> diff --git a/vl.c b/vl.c
>>>> index 16b913f..7055df3 100644
>>>> --- a/vl.c
>>>> +++ b/vl.c
>>>> @@ -4559,11 +4559,10 @@ int main(int argc, char **argv, char **envp)
>>>>       * (2) CONFIG_SLIRP not set, in which case the implicit "-net nic"
>>>>       * sets up a nic that isn't connected to anything.
>>>>       */
>>>> -    if (!default_net) {
>>>> +    if (!default_net && (!qtest_enabled() || has_defaults)) {
>>>>          net_check_clients();
>>>>      }
>>>>  
>>>
>>> Why does it have no peer?  Not a nack, just curiosity.
>>
>> The machines which emulate an embedded system often always create a NIC
>> (since it is hard-wired on the board, not optional). But since there is
>> no back-end on the host side with "-nodefaults", the net_check_clients()
>> function complains in this case.
> 
> Ok, the has_defaults test then makes sense.  Is the qtest_enabled() part
> still needed, or is the message unnecessary even in normal operation?

I think it is still needed, since you could also screw up your command
line parameters after specifying -nodefaults (e.g. "-nodefaults -net
nic" without giving an additional "-net user" or something similar).

 Thomas
Paolo Bonzini Aug. 14, 2018, 4:03 p.m. UTC | #5
On 14/08/2018 18:01, Thomas Huth wrote:
> On 08/14/2018 05:57 PM, Paolo Bonzini wrote:
>> On 14/08/2018 17:43, Thomas Huth wrote:
>>> On 08/14/2018 05:33 PM, Paolo Bonzini wrote:
>>>> On 14/08/2018 16:46, Thomas Huth wrote:
>>>>> When running qtests with -nodefaults, we are not interested in
>>>>> these 'XYZ has no peer' messages.
>>>>>
>>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>>> ---
>>>>>  vl.c | 3 +--
>>>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/vl.c b/vl.c
>>>>> index 16b913f..7055df3 100644
>>>>> --- a/vl.c
>>>>> +++ b/vl.c
>>>>> @@ -4559,11 +4559,10 @@ int main(int argc, char **argv, char **envp)
>>>>>       * (2) CONFIG_SLIRP not set, in which case the implicit "-net nic"
>>>>>       * sets up a nic that isn't connected to anything.
>>>>>       */
>>>>> -    if (!default_net) {
>>>>> +    if (!default_net && (!qtest_enabled() || has_defaults)) {
>>>>>          net_check_clients();
>>>>>      }
>>>>>  
>>>>
>>>> Why does it have no peer?  Not a nack, just curiosity.
>>>
>>> The machines which emulate an embedded system often always create a NIC
>>> (since it is hard-wired on the board, not optional). But since there is
>>> no back-end on the host side with "-nodefaults", the net_check_clients()
>>> function complains in this case.
>>
>> Ok, the has_defaults test then makes sense.  Is the qtest_enabled() part
>> still needed, or is the message unnecessary even in normal operation?
> 
> I think it is still needed, since you could also screw up your command
> line parameters after specifying -nodefaults (e.g. "-nodefaults -net
> nic" without giving an additional "-net user" or something similar).

True.  Though it cannot happen with -nic, so another possibility is to
give it only if -net was used?

Paolo

Paolo
Thomas Huth Aug. 14, 2018, 4:11 p.m. UTC | #6
On 08/14/2018 06:03 PM, Paolo Bonzini wrote:
> On 14/08/2018 18:01, Thomas Huth wrote:
>> On 08/14/2018 05:57 PM, Paolo Bonzini wrote:
>>> On 14/08/2018 17:43, Thomas Huth wrote:
>>>> On 08/14/2018 05:33 PM, Paolo Bonzini wrote:
>>>>> On 14/08/2018 16:46, Thomas Huth wrote:
>>>>>> When running qtests with -nodefaults, we are not interested in
>>>>>> these 'XYZ has no peer' messages.
>>>>>>
>>>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>>>> ---
>>>>>>  vl.c | 3 +--
>>>>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/vl.c b/vl.c
>>>>>> index 16b913f..7055df3 100644
>>>>>> --- a/vl.c
>>>>>> +++ b/vl.c
>>>>>> @@ -4559,11 +4559,10 @@ int main(int argc, char **argv, char **envp)
>>>>>>       * (2) CONFIG_SLIRP not set, in which case the implicit "-net nic"
>>>>>>       * sets up a nic that isn't connected to anything.
>>>>>>       */
>>>>>> -    if (!default_net) {
>>>>>> +    if (!default_net && (!qtest_enabled() || has_defaults)) {
>>>>>>          net_check_clients();
>>>>>>      }
>>>>>>  
>>>>>
>>>>> Why does it have no peer?  Not a nack, just curiosity.
>>>>
>>>> The machines which emulate an embedded system often always create a NIC
>>>> (since it is hard-wired on the board, not optional). But since there is
>>>> no back-end on the host side with "-nodefaults", the net_check_clients()
>>>> function complains in this case.
>>>
>>> Ok, the has_defaults test then makes sense.  Is the qtest_enabled() part
>>> still needed, or is the message unnecessary even in normal operation?
>>
>> I think it is still needed, since you could also screw up your command
>> line parameters after specifying -nodefaults (e.g. "-nodefaults -net
>> nic" without giving an additional "-net user" or something similar).
> 
> True.  Though it cannot happen with -nic, so another possibility is to
> give it only if -net was used?

Sorry, I don't quite get you ... this is a generic check in vl.c, how
should this code know whether the NICs have been specified with -nic or
-net?

 Thomas
Paolo Bonzini Aug. 14, 2018, 5:10 p.m. UTC | #7
On 14/08/2018 18:11, Thomas Huth wrote:
> On 08/14/2018 06:03 PM, Paolo Bonzini wrote:
>> On 14/08/2018 18:01, Thomas Huth wrote:
>>> On 08/14/2018 05:57 PM, Paolo Bonzini wrote:
>>>> On 14/08/2018 17:43, Thomas Huth wrote:
>>>>> The machines which emulate an embedded system often always create a NIC
>>>>> (since it is hard-wired on the board, not optional). But since there is
>>>>> no back-end on the host side with "-nodefaults", the net_check_clients()
>>>>> function complains in this case.
>>>>
>>>> [...] is the message unnecessary even in normal operation?
>>>
>>> I think it is still needed, since you could also screw up your command
>>> line parameters after specifying -nodefaults (e.g. "-nodefaults -net
>>> nic" without giving an additional "-net user" or something similar).
>>
>> True.  Though it cannot happen with -nic, so another possibility is to
>> give it only if -net was used?
> 
> Sorry, I don't quite get you ... this is a generic check in vl.c, how
> should this code know whether the NICs have been specified with -nic or
> -net?

	case QEMU_OPTION_net:
	    had_net = true;
	    ...

	if (!default_net && had_net) {
	    net_check_clients();
	}

:)

Paolo
Thomas Huth Aug. 15, 2018, 6:06 a.m. UTC | #8
On 08/14/2018 07:10 PM, Paolo Bonzini wrote:
> On 14/08/2018 18:11, Thomas Huth wrote:
>> On 08/14/2018 06:03 PM, Paolo Bonzini wrote:
>>> On 14/08/2018 18:01, Thomas Huth wrote:
>>>> On 08/14/2018 05:57 PM, Paolo Bonzini wrote:
>>>>> On 14/08/2018 17:43, Thomas Huth wrote:
>>>>>> The machines which emulate an embedded system often always create a NIC
>>>>>> (since it is hard-wired on the board, not optional). But since there is
>>>>>> no back-end on the host side with "-nodefaults", the net_check_clients()
>>>>>> function complains in this case.
>>>>>
>>>>> [...] is the message unnecessary even in normal operation?
>>>>
>>>> I think it is still needed, since you could also screw up your command
>>>> line parameters after specifying -nodefaults (e.g. "-nodefaults -net
>>>> nic" without giving an additional "-net user" or something similar).
>>>
>>> True.  Though it cannot happen with -nic, so another possibility is to
>>> give it only if -net was used?
>>
>> Sorry, I don't quite get you ... this is a generic check in vl.c, how
>> should this code know whether the NICs have been specified with -nic or
>> -net?
> 
> 	case QEMU_OPTION_net:
> 	    had_net = true;
> 	    ...
> 
> 	if (!default_net && had_net) {
> 	    net_check_clients();
> 	}
> 
> :)

Ah, ok, thanks, I somehow only had that nd_table stuff in mind... That
change looks reasonable to me, I'll give it a try!

 Thomas
Thomas Huth Aug. 16, 2018, 8:59 a.m. UTC | #9
On 08/14/2018 07:10 PM, Paolo Bonzini wrote:
> On 14/08/2018 18:11, Thomas Huth wrote:
>> On 08/14/2018 06:03 PM, Paolo Bonzini wrote:
>>> On 14/08/2018 18:01, Thomas Huth wrote:
>>>> On 08/14/2018 05:57 PM, Paolo Bonzini wrote:
>>>>> On 14/08/2018 17:43, Thomas Huth wrote:
>>>>>> The machines which emulate an embedded system often always create a NIC
>>>>>> (since it is hard-wired on the board, not optional). But since there is
>>>>>> no back-end on the host side with "-nodefaults", the net_check_clients()
>>>>>> function complains in this case.
>>>>>
>>>>> [...] is the message unnecessary even in normal operation?
>>>>
>>>> I think it is still needed, since you could also screw up your command
>>>> line parameters after specifying -nodefaults (e.g. "-nodefaults -net
>>>> nic" without giving an additional "-net user" or something similar).
>>>
>>> True.  Though it cannot happen with -nic, so another possibility is to
>>> give it only if -net was used?
>>
>> Sorry, I don't quite get you ... this is a generic check in vl.c, how
>> should this code know whether the NICs have been specified with -nic or
>> -net?
> 
> 	case QEMU_OPTION_net:
> 	    had_net = true;
> 	    ...
> 
> 	if (!default_net && had_net) {
> 	    net_check_clients();
> 	}

Looking at net_check_clients(), I think we're also checking -netdev
devices there, so we likely should call net_check_clients()
independently of whether -net has been specified by the user or not... I
think I'll best keep the patch in its current shape.

 Thomas
diff mbox series

Patch

diff --git a/vl.c b/vl.c
index 16b913f..7055df3 100644
--- a/vl.c
+++ b/vl.c
@@ -4559,11 +4559,10 @@  int main(int argc, char **argv, char **envp)
      * (2) CONFIG_SLIRP not set, in which case the implicit "-net nic"
      * sets up a nic that isn't connected to anything.
      */
-    if (!default_net) {
+    if (!default_net && (!qtest_enabled() || has_defaults)) {
         net_check_clients();
     }
 
-
     if (boot_once) {
         qemu_boot_set(boot_once, &error_fatal);
         qemu_register_reset(restore_boot_order, g_strdup(boot_order));