Skip to contentSkip to conversation

qapi: make machine type deprecation a warning

PATCH In review Paolo Bonzini 3 participants 7 messages May 11, 2022 – May 12, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qapi: make machine type deprecation a warning

---
 softmmu/vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
softmmu/vl.c +1 -1
index c2919579fd..fbef0f5c5f 100644
@@ -3723,7 +3723,7 @@ void qemu_init(int argc, char **argv, char **envp)
 
     machine_class = MACHINE_GET_CLASS(current_machine);
     if (!qtest_enabled() && machine_class->deprecation_reason) {
-        error_report("Machine type '%s' is deprecated: %s",
+        warn_report("Machine type '%s' is deprecated: %s",
                      machine_class->name, machine_class->deprecation_reason);
     }
 
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Paolo Bonzini
---
 softmmu/vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
softmmu/vl.c +0 -0
index c2919579fd..fbef0f5c5f 100644

softmmu/vl.c void qemu_init(int argc, char **argv, char **envp) · line 3728

Quoted 7 lines
softmmu/vl.c +1 -1
@@ -3723,7 +3723,7 @@ void qemu_init(int argc, char **argv, char **envp)
 
     machine_class = MACHINE_GET_CLASS(current_machine);
     if (!qtest_enabled() && machine_class->deprecation_reason) {
-        error_report("Machine type '%s' is deprecated: %s",
+        warn_report("Machine type '%s' is deprecated: %s",
                      machine_class->name, machine_class->deprecation_reason);
     }

Anti-pattern: error_report() not followed by "fail function".

The commit only changes the message printed to stderr. The commit message made me expect it would change an actual (fatal?) error into a mere warning. It's too late in my day to come up with a clearer phrasing, so

#2 lore raw
Quoted 13 lines · Markus Armbruster
Quoted 11 lines · Paolo Bonzini
---
  softmmu/vl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
softmmu/vl.c +0 -0
index c2919579fd..fbef0f5c5f 100644
@@ -3723,7 +3723,7 @@ void qemu_init(int argc, char **argv, char **envp)
 
Quoted 8 lines

softmmu/vl.c void qemu_init(int argc, char **argv, char **envp) · line 3728

Quoted 6 lines
softmmu/vl.c +1 -1
      machine_class = MACHINE_GET_CLASS(current_machine);
      if (!qtest_enabled() && machine_class->deprecation_reason) {
-        error_report("Machine type '%s' is deprecated: %s",
+        warn_report("Machine type '%s' is deprecated: %s",
                       machine_class->name, machine_class->deprecation_reason);
      }

Anti-pattern: error_report() not followed by "fail function".

Good point, thanks for writing it down... That's what I couldn't put my fingers on (hence the scant commit message). I'll augment the commit message with the following:

error_report should generally be followed by a failure; if we can proceed anyway, that is just a warning and should be communicated properly to the user with warn_report.

Paolo

Quoted 8 lines

The commit only changes the message printed to stderr. The commit message made me expect it would change an actual (fatal?) error into a mere warning. It's too late in my day to come up with a clearer phrasing, so

#3 lore raw
Quoted 22 lines · Paolo Bonzini
Quoted 7 lines · Markus Armbruster
Quoted 5 lines · Paolo Bonzini
---
  softmmu/vl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

softmmu/vl.c void qemu_init(int argc, char **argv, char **envp) · line 3727

Quoted 11 lines
softmmu/vl.c +1 -1
index c2919579fd..fbef0f5c5f 100644
@@ -3723,7 +3723,7 @@ void qemu_init(int argc, char **argv, char **envp)
        machine_class = MACHINE_GET_CLASS(current_machine);
      if (!qtest_enabled() && machine_class->deprecation_reason) {
-        error_report("Machine type '%s' is deprecated: %s",
+        warn_report("Machine type '%s' is deprecated: %s",
                       machine_class->name, machine_class->deprecation_reason);
      }

Anti-pattern: error_report() not followed by "fail function".

Quoted 7 lines

Good point, thanks for writing it down... That's what I couldn't put my fingers on (hence the scant commit message). I'll augment the commit message with the following:

error_report should generally be followed by a failure; if we can proceed anyway, that is just a warning and should be communicated properly to the user with warn_report.

Good!

[...]

#4 lore raw
In reply to Paolo Bonzini

Commit message nitpick: not sure this is "qapi:". The commit that introduced "Machine type ... is deprecated" (08fe68244eb) used "hw/i386:". We commonly use "vl:", "softmmu:", and "softmmu/vl:" for this file.

#5 lore raw
Quoted 4 lines · Markus Armbruster

Commit message nitpick: not sure this is "qapi:". The commit that introduced "Machine type ... is deprecated" (08fe68244eb) used "hw/i386:". We commonly use "vl:", "softmmu:", and "softmmu/vl:" for this file.

Will do.

I wonder if I should already propose renaming vl.c to climain.c, even if there's no qmpmain.c yet. Emotional/historical attachment is probably not good enough of a reason to keep that name.

I suppose this is already a proposal.

Paolo

#6 lore raw
Quoted 6 lines · Paolo Bonzini
Quoted 4 lines · Markus Armbruster

Commit message nitpick: not sure this is "qapi:". The commit that introduced "Machine type ... is deprecated" (08fe68244eb) used "hw/i386:". We commonly use "vl:", "softmmu:", and "softmmu/vl:" for this file.

Quoted 7 lines

Will do.

I wonder if I should already propose renaming vl.c to climain.c, even if there's no qmpmain.c yet. Emotional/historical attachment is probably not good enough of a reason to keep that name.

I suppose this is already a proposal.

For all the othe tools we just use the filename $TOOL.c, eg qemu-img.c, etc. So what about qemu-system.c

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|