Open Dentrax opened 2 years ago
Hello @Dentrax .
From a relatively quick check i can see that we do not support it. Moreover it's not supported upstream by gophercloud from what i can see here. So it should first be implemented upstream and then in the provider as well.
From reading the api docs it also seems that getting a flavor also returns this attribute. so we probably should/could update the resource
as well and not just the data_source
.
What i wasn't able to find at all on an api level or on cli is a way to change this attribute or even set it on creation time. So im a bit curious how its actually being used. What is your use-case if i may ask.
I think we are able to set that atrribute by issuing:
$ openstack flavor set <FLAVOR> --property OS-FLV-DISABLED:disabled=true
What is your use-case if i may ask.
I recently noticed this attribute and was thinking about how the terraform provider handles this case if OpenStack admin disables the Flavor for further usage. I think it will read as no change since provider does not support that field, but actually it's a change, right?
I think we are able to set that atrribute by issuing:
$ openstack flavor set
--property OS-FLV-DISABLED:disabled=true
I just tested this cause i am a bit curious myself:
blah@bluh:~$ openstack flavor create --id 1234 --ram 512 --vcpus 1 --disk 10 test-flavor
+----------------------------+-------------+
| Field | Value |
+----------------------------+-------------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| description | None |
| disk | 10 |
| id | 1234 |
| name | test-flavor |
| os-flavor-access:is_public | True |
| properties | |
| ram | 512 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+-------------+
blah@bluh:~$ openstack flavor set --property OS-FLV-DISABLED:disabled=true 1234
blah@bluh:~$ openstack flavor show 1234
+----------------------------+---------------------------------+
| Field | Value |
+----------------------------+---------------------------------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| access_project_ids | None |
| description | None |
| disk | 10 |
| id | 1234 |
| name | test-flavor |
| os-flavor-access:is_public | True |
| properties | OS-FLV-DISABLED:disabled='true' |
| ram | 512 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+---------------------------------+
So what i see is that the actual OS-FLV-DISABLED:disabled
is not updated, but a new property is added under properties
. This is in-line with the openstack nova api, which basically allows you to only update the description of a flavor as shown here and the extra_specs of it as shown here. But it doesnt allow you to update anything else.
So i'm still wondering how this attribute is actually used in openstack and whether/how you can actually set/change it.
I recently noticed this attribute and was thinking about how the terraform provider handles this case if OpenStack admin disables the Flavor for further usage.
At this point im not even sure if an admin can actually disable a flavor.
I think it will read as no change since provider does not support that field, but actually it's a change, right?
I think you are right, but you should probably test it just in case.
Currently on an api level, nova returns this attribute for every flavor (either in a list command or a get etc), but i havent found a way to set/change it. We could work on gophercloud to have it set this attribute as well and then update the provider. I can see some cases where a user wants to ensure that the flavor from the data_source is not disabled so having the provider setting this attribute could be useful. But if the attribute can never be changed then... not sure what the use cases would be(im just thinking out loud here).
@Dentrax do you still need to fix this issue?
I think I don't need this anymore. But FWIW, provider should respect the flavor's disabled status and should not initiate the creation process by default. (Breaking change)
Just noticed OpenStack API returns a key called
OS-FLV-DISABLED:disabled
during fetching flavors. I think provider currently does not handledisabled
cases AFAICS here: https://github.com/terraform-provider-openstack/terraform-provider-openstack/blob/main/openstack/data_source_openstack_compute_flavor_v2.goCan you please verify me on this? Should it be?