Skip to contentSkip to conversation

qmp: marking qmp_cpu as deprecated

PATCH Superseded Daniel Henrique Barboza 3 participants 5 messages Dec 18, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qmp: marking qmp_cpu as deprecated

qmp_cpu is a nop that was created a while ago in commit 755f196898 ("qapi: Convert the cpu command") for the sake of compatibility, due to the existence of hmp_cpu.

Today, there is no need or requirement to keep it as is. QMP is meant to be as stateless as possible, thus any QMP command that needs a specific monitor CPU setup should provide it in its arguments, instead of relying in the current QMP monitor state.

This patch flags qmp_cpu as deprecated in qemu-doc.texi and changes qmp_cpu body to show a deprecation message if used.

---
Although I've changed the behavior of qmp_cpu to return an error instead of doing nothing, no errors were found in the Travis build of the patch. Code inspection confirms that qmp_cpu isn't being used in QEMU.

A quick inspection in Libvirt code shows that there is no reference to 'qmp_cpu' there either, but to be sure I've CCed Daniel here so he can comment/confirm if Libvirt does not care for this change.

 qemu-doc.texi | 6 ++++++
 qmp.c         | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
qemu-doc.texi +6 -0
index f7317dfc66..2b63f9a325 100644
@@ -2516,6 +2516,12 @@ subsystem image.
 The ``convert -s snapshot_id_or_name'' argument is obsoleted
 by the ``convert -l snapshot_param'' argument instead.
 
+@section System emulator machine protocol commands
+
+@subsection qmp_cpu (since 2.12.0)
+
+The ``qmp_cpu'' command is deprecated. Do not use this command.
+
 @section System emulator human monitor commands
 
 @subsection host_net_add (since 2.10.0)
qmp.c +1 -1
index e8c303116a..d8543d713d 100644
@@ -115,7 +115,7 @@ void qmp_system_powerdown(Error **erp)
 
 void qmp_cpu(int64_t index, Error **errp)
 {
-    /* Just do nothing */
+    error_setg(errp, "qmp_cpu is deprecated, do not use this command");
 }
 
 void qmp_cpu_add(int64_t id, Error **errp)
Signature · 1 line
2.13.6
#1 lore raw
Quoted 32 lines · Daniel Henrique Barboza

qmp_cpu is a nop that was created a while ago in commit 755f196898 ("qapi: Convert the cpu command") for the sake of compatibility, due to the existence of hmp_cpu.

Today, there is no need or requirement to keep it as is. QMP is meant to be as stateless as possible, thus any QMP command that needs a specific monitor CPU setup should provide it in its arguments, instead of relying in the current QMP monitor state.

This patch flags qmp_cpu as deprecated in qemu-doc.texi and changes qmp_cpu body to show a deprecation message if used.

---
Although I've changed the behavior of qmp_cpu to return an error instead of doing nothing, no errors were found in the Travis build of the patch. Code inspection confirms that qmp_cpu isn't being used in QEMU.

A quick inspection in Libvirt code shows that there is no reference to 'qmp_cpu' there either, but to be sure I've CCed Daniel here so he can comment/confirm if Libvirt does not care for this change.

 qemu-doc.texi | 6 ++++++
 qmp.c         | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
qemu-doc.texi +0 -0
index f7317dfc66..2b63f9a325 100644

qemu-doc.texi subsystem image. · line 2523

Quoted 8 lines
qemu-doc.texi +5 -0
@@ -2516,6 +2516,12 @@ subsystem image.
 The ``convert -s snapshot_id_or_name'' argument is obsoleted
 by the ``convert -l snapshot_param'' argument instead.
 
+@section System emulator machine protocol commands
+
+@subsection qmp_cpu (since 2.12.0)
+
+The ``qmp_cpu'' command is deprecated. Do not use this command.

Just saying it is deprecated doesn't add any useful info, rather explain why it is deprecated & what (if anything) to use instead. e.g.

The ``qmp_cpu'' command is a functional no-op. There is no reason to invoke this command and it will be removed with no replacement.

Quoted 6 lines
qemu-doc.texi +0 -0
 @subsection host_net_add (since 2.10.0)
qmp.c +0 -0
index e8c303116a..d8543d713d 100644

qmp.c void qmp_system_powerdown(Error **erp) · line 121

Quoted 8 lines
qmp.c +1 -1
@@ -115,7 +115,7 @@ void qmp_system_powerdown(Error **erp)
 
 void qmp_cpu(int64_t index, Error **errp)
 {
-    /* Just do nothing */
+    error_setg(errp, "qmp_cpu is deprecated, do not use this command");
 }
 
 void qmp_cpu_add(int64_t id, Error **errp)

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 :|
#2 lore raw
Quoted 45 lines · Daniel P. Berrange
Quoted 32 lines · Daniel Henrique Barboza

qmp_cpu is a nop that was created a while ago in commit 755f196898 ("qapi: Convert the cpu command") for the sake of compatibility, due to the existence of hmp_cpu.

Today, there is no need or requirement to keep it as is. QMP is meant to be as stateless as possible, thus any QMP command that needs a specific monitor CPU setup should provide it in its arguments, instead of relying in the current QMP monitor state.

This patch flags qmp_cpu as deprecated in qemu-doc.texi and changes qmp_cpu body to show a deprecation message if used.

---
Although I've changed the behavior of qmp_cpu to return an error instead of doing nothing, no errors were found in the Travis build of the patch. Code inspection confirms that qmp_cpu isn't being used in QEMU.

A quick inspection in Libvirt code shows that there is no reference to 'qmp_cpu' there either, but to be sure I've CCed Daniel here so he can comment/confirm if Libvirt does not care for this change.

  qemu-doc.texi | 6 ++++++
  qmp.c         | 2 +-
  2 files changed, 7 insertions(+), 1 deletion(-)
qemu-doc.texi +0 -0
index f7317dfc66..2b63f9a325 100644

qemu-doc.texi subsystem image. · line 2523

Quoted 8 lines
qemu-doc.texi +5 -0
@@ -2516,6 +2516,12 @@ subsystem image.
  The ``convert -s snapshot_id_or_name'' argument is obsoleted
  by the ``convert -l snapshot_param'' argument instead.
 
+@section System emulator machine protocol commands
+
+@subsection qmp_cpu (since 2.12.0)
+
+The ``qmp_cpu'' command is deprecated. Do not use this command.

Just saying it is deprecated doesn't add any useful info, rather explain why it is deprecated & what (if anything) to use instead. e.g.

Quoted 2 lines

The ``qmp_cpu'' command is a functional no-op. There is no reason to invoke this command and it will be removed with no replacement.

Thanks, I'll add more info in qemu-doc.texi in the next version.

Also, just checked that I didn't touch qapi-schema.json. This is how it reads about qmp_cpu:

# This command is a nop that is only provided for the purposes of compatibility. #
# Since: 0.14.0
#
# Notes: Do not use this command.

Should we change it to mention that the command is deprecated, something like:

# Notes: Do not use this command - it is deprecated and will disappear in the future.

Or just adding the deprecation note in qemu-doc.texi is enough?

Quoted 17 lines
Quoted 7 lines
qemu-doc.texi +0 -0
  @subsection host_net_add (since 2.10.0)
qmp.c +0 -0
index e8c303116a..d8543d713d 100644

qmp.c void qmp_system_powerdown(Error **erp) · line 121

Quoted 8 lines
qmp.c +1 -1
@@ -115,7 +115,7 @@ void qmp_system_powerdown(Error **erp)
 
  void qmp_cpu(int64_t index, Error **errp)
  {
-    /* Just do nothing */
+    error_setg(errp, "qmp_cpu is deprecated, do not use this command");
  }
 
  void qmp_cpu_add(int64_t id, Error **errp)

Regards,
Daniel

#3 lore raw
Quoted 63 lines · Daniel Henrique Barboza
Quoted 44 lines · Daniel P. Berrange
Quoted 32 lines · Daniel Henrique Barboza

qmp_cpu is a nop that was created a while ago in commit 755f196898 ("qapi: Convert the cpu command") for the sake of compatibility, due to the existence of hmp_cpu.

Today, there is no need or requirement to keep it as is. QMP is meant to be as stateless as possible, thus any QMP command that needs a specific monitor CPU setup should provide it in its arguments, instead of relying in the current QMP monitor state.

This patch flags qmp_cpu as deprecated in qemu-doc.texi and changes qmp_cpu body to show a deprecation message if used.

---
Although I've changed the behavior of qmp_cpu to return an error instead of doing nothing, no errors were found in the Travis build of the patch. Code inspection confirms that qmp_cpu isn't being used in QEMU.

A quick inspection in Libvirt code shows that there is no reference to 'qmp_cpu' there either, but to be sure I've CCed Daniel here so he can comment/confirm if Libvirt does not care for this change.

  qemu-doc.texi | 6 ++++++
  qmp.c         | 2 +-
  2 files changed, 7 insertions(+), 1 deletion(-)
qemu-doc.texi +0 -0
index f7317dfc66..2b63f9a325 100644

qemu-doc.texi subsystem image. · line 2522

Quoted 7 lines
qemu-doc.texi +5 -0
@@ -2516,6 +2516,12 @@ subsystem image.
  The ``convert -s snapshot_id_or_name'' argument is obsoleted
  by the ``convert -l snapshot_param'' argument instead.
+@section System emulator machine protocol commands
+
+@subsection qmp_cpu (since 2.12.0)
+
+The ``qmp_cpu'' command is deprecated. Do not use this command.

Just saying it is deprecated doesn't add any useful info, rather explain why it is deprecated & what (if anything) to use instead. e.g.

Quoted 2 lines

The ``qmp_cpu'' command is a functional no-op. There is no reason to invoke this command and it will be removed with no replacement.

Thanks, I'll add more info in qemu-doc.texi in the next version.

Also, just checked that I didn't touch qapi-schema.json. This is how it reads about qmp_cpu:

# This command is a nop that is only provided for the purposes of compatibility.
#
# Since: 0.14.0
#
# Notes: Do not use this command.

Quoted 8 lines

Should we change it to mention that the command is deprecated, something like:

# Notes: Do not use this command - it is deprecated and will disappear in the future.

Or just adding the deprecation note in qemu-doc.texi is enough?

Lets modify the QAPI file too, since you never know what users will read first !

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 :|
#4 lore raw
Quoted 67 lines · Daniel P. Berrange
Quoted 66 lines · Daniel Henrique Barboza
Quoted 44 lines · Daniel P. Berrange
Quoted 32 lines · Daniel Henrique Barboza

qmp_cpu is a nop that was created a while ago in commit 755f196898 ("qapi: Convert the cpu command") for the sake of compatibility, due to the existence of hmp_cpu.

Today, there is no need or requirement to keep it as is. QMP is meant to be as stateless as possible, thus any QMP command that needs a specific monitor CPU setup should provide it in its arguments, instead of relying in the current QMP monitor state.

This patch flags qmp_cpu as deprecated in qemu-doc.texi and changes qmp_cpu body to show a deprecation message if used.

---
Although I've changed the behavior of qmp_cpu to return an error instead of doing nothing, no errors were found in the Travis build of the patch. Code inspection confirms that qmp_cpu isn't being used in QEMU.

A quick inspection in Libvirt code shows that there is no reference to 'qmp_cpu' there either, but to be sure I've CCed Daniel here so he can comment/confirm if Libvirt does not care for this change.

  qemu-doc.texi | 6 ++++++
  qmp.c         | 2 +-
  2 files changed, 7 insertions(+), 1 deletion(-)
qemu-doc.texi +0 -0
index f7317dfc66..2b63f9a325 100644

qemu-doc.texi subsystem image. · line 2522

Quoted 7 lines
qemu-doc.texi +5 -0
@@ -2516,6 +2516,12 @@ subsystem image.
  The ``convert -s snapshot_id_or_name'' argument is obsoleted
  by the ``convert -l snapshot_param'' argument instead.
+@section System emulator machine protocol commands
+
+@subsection qmp_cpu (since 2.12.0)
+
+The ``qmp_cpu'' command is deprecated. Do not use this command.

Just saying it is deprecated doesn't add any useful info, rather explain why it is deprecated & what (if anything) to use instead. e.g.

Quoted 2 lines

The ``qmp_cpu'' command is a functional no-op. There is no reason to invoke this command and it will be removed with no replacement.

Thanks, I'll add more info in qemu-doc.texi in the next version.

Also, just checked that I didn't touch qapi-schema.json. This is how it reads about qmp_cpu:

# This command is a nop that is only provided for the purposes of compatibility.
#
# Since: 0.14.0
#
# Notes: Do not use this command.

Should we change it to mention that the command is deprecated, something like:

Quoted 8 lines
Quoted 5 lines

# Notes: Do not use this command - it is deprecated and will disappear in the future.

Or just adding the deprecation note in qemu-doc.texi is enough?

Lets modify the QAPI file too, since you never know what users will read first !

+1

Regards,
-Satheesh.

Quoted 8 lines

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 :|