[PATCH] qemu-options.hx: Replace deprecated -M example

dave@treblig.org posted 1 patch 1 week, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251202005740.299524-1-dave@treblig.org
qemu-options.hx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] qemu-options.hx: Replace deprecated -M example
Posted by dave@treblig.org 1 week, 5 days ago
From: "Dr. David Alan Gilbert" <dave@treblig.org>

The -M option was deprecated by -machine in 2011 by 80f52a669
and isn't actually documented in the manpage, but is still used in
one of the examples.  Replace it by -machine.
-M still gets used all over the place in other docs, and I'm
not sure I realised it was deprecated until Julian pointed out it
wasn't actually documented.

Reported-by: Julian Andres Klode <jak@jak-linux.org>
Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
---
 qemu-options.hx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index fca2b7bc74..9cd0b7173c 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -481,7 +481,7 @@ SRST
 
     ::
 
-        -M pc \
+        -machine pc \
         -smp 1,sockets=2,maxcpus=2 \
         -numa node,nodeid=0 -numa node,nodeid=1 \
         -numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1
-- 
2.52.0
Re: [PATCH] qemu-options.hx: Replace deprecated -M example
Posted by Thomas Huth 1 week, 4 days ago
On 02/12/2025 01.57, dave@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <dave@treblig.org>
> 
> The -M option was deprecated by -machine in 2011 by 80f52a669
> and isn't actually documented in the manpage, but is still used in
> one of the examples.  Replace it by -machine.
> -M still gets used all over the place in other docs, and I'm
> not sure I realised it was deprecated until Julian pointed out it
> wasn't actually documented.

-M is not mentioned in docs/about/deprecated.rst, so no, it's not officially 
deprecated. And I think it's a nice short hand feature for an option that is 
used very often, so I also don't think that we should ever remove it. Thus I 
think it would be better to simply add it back to qemu-options.hx instead.

  Thomas
Re: [PATCH] qemu-options.hx: Replace deprecated -M example
Posted by Dr. David Alan Gilbert 1 week, 4 days ago
* Thomas Huth (thuth@redhat.com) wrote:
> On 02/12/2025 01.57, dave@treblig.org wrote:
> > From: "Dr. David Alan Gilbert" <dave@treblig.org>
> > 
> > The -M option was deprecated by -machine in 2011 by 80f52a669
> > and isn't actually documented in the manpage, but is still used in
> > one of the examples.  Replace it by -machine.
> > -M still gets used all over the place in other docs, and I'm
> > not sure I realised it was deprecated until Julian pointed out it
> > wasn't actually documented.
> 
> -M is not mentioned in docs/about/deprecated.rst, so no, it's not officially
> deprecated. And I think it's a nice short hand feature for an option that is
> used very often, so I also don't think that we should ever remove it. Thus I
> think it would be better to simply add it back to qemu-options.hx instead.

Fair enough; I wasn't too sure which way this would go - I'm pretty
sure I'd always used -M, but there again I saw libvirt used -machine
now, and I'd frequently confused -m and -M so it did make some sense
to move away from it.

I'll cut another patch adding -M back.

Dave

>  Thomas
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Re: [PATCH] qemu-options.hx: Replace deprecated -M example
Posted by Paolo Bonzini 1 week, 4 days ago
On 12/2/25 08:14, Thomas Huth wrote:
> On 02/12/2025 01.57, dave@treblig.org wrote:
>> From: "Dr. David Alan Gilbert" <dave@treblig.org>
>>
>> The -M option was deprecated by -machine in 2011 by 80f52a669
>> and isn't actually documented in the manpage, but is still used in
>> one of the examples.  Replace it by -machine.
>> -M still gets used all over the place in other docs, and I'm
>> not sure I realised it was deprecated until Julian pointed out it
>> wasn't actually documented.
> 
> -M is not mentioned in docs/about/deprecated.rst, so no, it's not 
> officially deprecated. And I think it's a nice short hand feature for an 
> option that is used very often, so I also don't think that we should 
> ever remove it. Thus I think it would be better to simply add it back to 
> qemu-options.hx instead.

Yes, its status as a synonym of -machine started only in 2015, in a 
commit that didn't even mention that effect:

     commit 364c3e6b8dd7912e01d19122d791b8c8f6df4f6c
     Author: Marcel Apfelbaum <marcel@redhat.com>
     Date:   Wed Jan 7 14:11:38 2015 +0200

     vl.c: fix regression when reading machine type from config file

     After 'Machine as QOM' series the machine type input triggers
     the creation of the machine class.
     If the machine type is set in the configuration file, the machine
     class is not updated accordingly and remains the default.

     Fixed that by querying the machine options after the configuration
     file is loaded.

     Cc: qemu-stable@nongnu.org
     Reported-by: William Dauchy <william@gandi.net>
     Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
     Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

(I wonder who's the guy that committed it).  But it was a good idea, and 
there's no need to change this.

Paolo