From 21b70f6b9b04b2684d155abd302943f5c8d3ed45 Mon Sep 17 00:00:00 2001 From: Sven Anders Date: Wed, 29 Sep 2021 17:07:54 +0200 Subject: [PATCH] Flavor properties are not deleted on changes and id will stay Fixing a bug on compute_falvor that causes that extra_specs are deleted and the id is changing when a property of the falvor is changed. Changing the id will cause that a server which is using the falvor is afterwards not assigned to the falvor anymore. Story: 2009260 Change-Id: If7cbce107ce99de79749359e257933e4247e3634 --- plugins/modules/compute_flavor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/modules/compute_flavor.py b/plugins/modules/compute_flavor.py index 59287cbe..8a993ca5 100644 --- a/plugins/modules/compute_flavor.py +++ b/plugins/modules/compute_flavor.py @@ -220,9 +220,12 @@ class ComputeFlavorModule(OpenStackModule): if self.params[param_key] != flavor[param_key]: require_update = True break - + flavorid = self.params['flavorid'] if flavor and require_update: self.conn.delete_flavor(name) + old_extra_specs = {} + if flavorid == 'auto': + flavorid = flavor['id'] flavor = None if not flavor: @@ -231,7 +234,7 @@ class ComputeFlavorModule(OpenStackModule): ram=self.params['ram'], vcpus=self.params['vcpus'], disk=self.params['disk'], - flavorid=self.params['flavorid'], + flavorid=flavorid, ephemeral=self.params['ephemeral'], swap=self.params['swap'], rxtx_factor=self.params['rxtx_factor'],