[PATCH v2 09/14] include/hw: temporarily disable deletion of versioned machine types

Daniel P. Berrangé posted 14 patches 5 months, 1 week ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Laurent Vivier <laurent@vivier.eu>, Nicholas Piggin <npiggin@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Harsh Prateek Bora <harshpb@linux.ibm.com>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>
[PATCH v2 09/14] include/hw: temporarily disable deletion of versioned machine types
Posted by Daniel P. Berrangé 5 months, 1 week ago
The new deprecation and deletion policy for versioned machine types is
being introduced in QEMU 9.1.0.

Under the new policy a number of old machine types (any prior to 2.12)
would be liable for immediate deletion which would be a violation of our
historical deprecation and removal policy

Thus automatic deletions (by skipping QOM registration) are temporarily
gated on existance of the env variable "QEMU_DELETE_MACHINES" / QEMU
version number >= 10.1.0. This allows opt-in testing of the automatic
deletion logic, while activating it fully in QEMU >= 10.1.0.

This whole commit should be reverted in the 10.1.0 dev cycle or shortly
thereafter.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 include/hw/boards.h | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/include/hw/boards.h b/include/hw/boards.h
index 187ed76646..ef6f18f2c1 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -686,11 +686,28 @@ struct MachineState {
  * suitable period of time has passed, it will cause
  * execution of the method to return, avoiding registration
  * of the machine
+ *
+ * The new deprecation and deletion policy for versioned
+ * machine types was introduced in QEMU 9.1.0.
+ *
+ * Under the new policy a number of old machine types (any
+ * prior to 2.12) would be liable for immediate deletion
+ * which would be a violation of our historical deprecation
+ * and removal policy
+ *
+ * Thus deletions are temporarily gated on existance of
+ * the env variable "QEMU_DELETE_MACHINES" / QEMU version
+ * number >= 10.1.0. This gate can be deleted in the 10.1.0
+ * dev cycle
  */
 #define MACHINE_VER_DELETION(...) \
     do { \
         if (MACHINE_VER_SHOULD_DELETE(__VA_ARGS__)) { \
-            return; \
+            if (getenv("QEMU_DELETE_MACHINES") || \
+                QEMU_VERSION_MAJOR > 10 || (QEMU_VERSION_MAJOR == 10 && \
+                                            QEMU_VERSION_MINOR >= 1)) { \
+                return; \
+            } \
         } \
     } while (0)
 
-- 
2.43.0


Re: [PATCH v2 09/14] include/hw: temporarily disable deletion of versioned machine types
Posted by Thomas Huth 5 months, 1 week ago
On 20/06/2024 18.57, Daniel P. Berrangé wrote:
> The new deprecation and deletion policy for versioned machine types is
> being introduced in QEMU 9.1.0.
> 
> Under the new policy a number of old machine types (any prior to 2.12)
> would be liable for immediate deletion which would be a violation of our
> historical deprecation and removal policy
> 
> Thus automatic deletions (by skipping QOM registration) are temporarily
> gated on existance of the env variable "QEMU_DELETE_MACHINES" / QEMU
> version number >= 10.1.0. This allows opt-in testing of the automatic
> deletion logic, while activating it fully in QEMU >= 10.1.0.
> 
> This whole commit should be reverted in the 10.1.0 dev cycle or shortly
> thereafter.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   include/hw/boards.h | 19 ++++++++++++++++++-
>   1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 187ed76646..ef6f18f2c1 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -686,11 +686,28 @@ struct MachineState {
>    * suitable period of time has passed, it will cause
>    * execution of the method to return, avoiding registration
>    * of the machine
> + *
> + * The new deprecation and deletion policy for versioned
> + * machine types was introduced in QEMU 9.1.0.
> + *
> + * Under the new policy a number of old machine types (any
> + * prior to 2.12) would be liable for immediate deletion
> + * which would be a violation of our historical deprecation
> + * and removal policy
> + *
> + * Thus deletions are temporarily gated on existance of
> + * the env variable "QEMU_DELETE_MACHINES" / QEMU version
> + * number >= 10.1.0. This gate can be deleted in the 10.1.0
> + * dev cycle
>    */
>   #define MACHINE_VER_DELETION(...) \
>       do { \
>           if (MACHINE_VER_SHOULD_DELETE(__VA_ARGS__)) { \
> -            return; \
> +            if (getenv("QEMU_DELETE_MACHINES") || \
> +                QEMU_VERSION_MAJOR > 10 || (QEMU_VERSION_MAJOR == 10 && \
> +                                            QEMU_VERSION_MINOR >= 1)) { \
> +                return; \
> +            } \
>           } \
>       } while (0)
>   

Reviewed-by: Thomas Huth <thuth@redhat.com>