Compare commits

..

2 Commits

Author SHA1 Message Date
af79f6ab3e 4.11.2 2026-04-23 12:46:24 +03:00
dayterr
156b0a2d0c 4.11.1 2026-02-27 17:24:15 +03:00
46 changed files with 2245 additions and 1845 deletions

View File

@@ -1,210 +1,8 @@
## Version 4.11.0
## Version 4.11.2
### Добавлено
#### audit
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1163 | Вычисляемые поля `resgroup_id`, `account_id`, `compute_id` в datasource `decort_cb_audit` в cloudbroker/audit |
#### bservice
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1137 | Для поля `chipset` изменено значение по умолчанию с `i440fx` на `Q35` в resource `decort_bservice_group` в cloudapi/bservice|
#### disks
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1186 | Опциональное поле `cache` в resources `decort_disk` в cloudapi/disks и в `decort_cb_disk` в cloudbroker/disks |
| BATF-1186 | Вычисляемое поле `cache` в datasources `decort_disk`, `decort_disk_list`, `decort_disk_list_deleted`,`decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk`, `decort_cb_disk_list`, `decort_cb_disk_list_deleted`, `decort_cb_disk_list_unattached` в cloudbroker/disks |
| BATF-1201 | Опциональное поле `blk_discard` в resource `decort_cb_disk` в cloudbroker/disks |
| BATF-1201 | Вычисляемое поле `blk_discard` в datasources `decort_disk`, `decort_disk_list`, `decort_disk_list_deleted` и `decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk`, `decort_cb_disk_list`, `decort_cb_disk_list_deleted` и `decort_cb_disk_list_unattached` в cloudbroker/disks |
#### k8s
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1137 | Для поля `chipset` добавлено значение по умолчанию `Q35` и валидация возможных значений (`i440fx`, `Q35`) в resources `decort_k8s`, `decort_k8s_wg` в cloudapi/k8s и `decort_cb_k8s_cp`, `decort_cb_k8s_wg` в cloudbroker/k8s|
#### kvmvm
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1099 | Возможность миграции диска в другой `SEP` в `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1137 | Для поля `chipset` добавлено значение по умолчанию `Q35` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1139 | Опциональное поле `read_only` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1139 | Вычисляемое поле `read_only` в datasources `decort_cb_kvmvm`, `decort_cb_kvmvm_list` в cloudbroker/kvmvm и в datasources `decort_kvmvm` и `decort_kvmvm_list` в cloudapi/kvmvm |
| BATF-1161 | Вычисляемое поле `sep_id` в блоке `disks` в datasources `decort_cb_kvmvm_list` в cloudbroker/kvmvm и `decort_kvmvm_list` в cloudapi/kvmvm |
| BATF-1187 | Опциональное поле `boot_disk_cache` в resources `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1187 | Вычисляемое поле `cache` в структуру `disks` в datasources `decort_cb_kvmvm` в cloudbroker/kvmvm и `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_kvmvm` в cloudapi/kvmvm |
| BATF-1187 | Опциональное поле `cache` в структуру `disks` в resources `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1160 | Опциональное поле `net_mask` в структуру `network` в resources `decort_kvmvm` в cloudapi/kvmvm и `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1202 | Опциональные поля `boot_disk_blk_discard` и `blk_discard` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1202 | Вычисляемое поле `blk_discard` в datasources `decort_kvmvm` в cloudapi/kvmvm и в `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1202 | Вычисляемое поле `blk_discard` в resource `decort_kvmvm` в cloudapi/kvmvm |
#### node
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1135 | Вычисляемые поля `openvswitch_bridges`, `description`, `sdn_hypervisor_name` в datasource `decort_cb_node` в `cloudbroker/node` |
| BATF-1135 | Вычисляемые поля `flags`, `model_name` в структуру `cpu_info` в datasource `decort_cb_node` в `cloudbroker/node` |
| BATF-1135 | Вычисляемые поля `openvswitch_bridges`, `api_url`, `drivers`, `old_compat_lvm_id`, `cpu_allocation_ratio`, `mem_allocation_ratio`, `packages` в datasource `decort_cb_node_list` в `cloudbroker/node` |
| BATF-1135 | Вычисляемые поля `flags`, `model_name` в структуру `cpu_info` в datasource `decort_cb_node_list` в `cloudbroker/node` |
| BATF-1153 | Вычисляемое поле `usable_cpus` в datasource `decort_cb_node` и в `decort_cb_node_list` в `cloudbroker/node` |
| BATF-1193 | Вычисляемые поле `auto_start, auto_start_count` в datasource `decort_cb_node` и в `decort_cb_node_list` в `cloudbroker/node` |
| BATF-1197 | Вычисляемое поле `mem_allocation_ratio` в datasource `decort_cb_node` в `cloudbroker/node` |
#### sep
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1161 | Опциональное поле `sep_ids` в datasource `decort_cb_sep_list` и в cloudbroker/sep |
#### storage policy
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1164 | Опциональное поле `sep_tech_status` в datasource `decort_storage_policy_list` в `cloudapi/stpolicy` и в datasource `decort_cb_storage_policy_list` в `cloudbroker/stpolicy` |
| BATF-1152 | Вычисляемое поле `sep_tech_status` в datasource `decort_storage_policy_list` в `cloudapi/stpolicy` и в datasource `decort_cb_storage_policy_list` в `cloudbroker/stpolicy` |
#### user
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1154 | Опциональное поле `sort_by` в datasource `decort_cb_user_get_audit` в `cloudbroker/user` |
#### trunk
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1162 | Опциональное поле `mtu` в resource `decort_cb_trunk` в `cloudbroker/trunk` |
| BATF-1162 | Вычисляемое поле `mtu` в datasources `decort_cb_trunk` и `decort_cb_trunk_list` в `cloudbroker/trunk` и в datasources `decort_trunk` и `decort_trunk_list` в `cloudapi/trunk` |
#### zone
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1192 | Опциональное поле `auto_start` в resource `decort_cb_zone` в `cloudbroker/zone` |
| BATF-1192 | Вычисляемое поле `auto_start` в datasources `decort_zone`, `decort_zone_list` в `cloudapi/zone` и в `decort_cb_zone_list`, `decort_cb_zone` в `cloudbroker/zone` |
### Исправлено
#### account
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1061 | Вывод значения поле `storage_policy_ids` в data_sourse`decort_cb_account` в cloudbroker/account |
#### bservice
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в data_source и resource `decort_bservice` в cloudapi/bservice |
| BATF-1194 | Тип поля `driver` с опционального на вычисляемый в `decort_bservice_group` в `cloudbroker/bservice` |
#### disks
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1205 | Ошибка построения и применения плана при использовании состояния, созданного в предыдущих версиях провайдера в resources `decort_disk` в cloudapi/disks и в `decort_cb_disk` cloudbroker/disks |
#### image
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1205 | Ошибка построения и применения плана при использовании состояния, созданного в предыдущих версиях провайдера в resources `decort_image_from_blank_compute`, `decort_image_from_platform_disk`, `decort_virtual_image` в cloudapi/image и в `decort_cb_cdrom_image`, `decort_cb_image`, `decort_cb_image_from_blank_compute`, `decort_cb_image_from_platform_disk`, `decort_cb_virtual_image` в cloudbroker/image |
#### kvmvm
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Опциональные поля `stack_id`, `pin_to_stack` заменены на `node_id`, `pin_to_node` в resources `decort_kvmvm` в cloudapi/kvmvm и `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1134 | Опциональные поля `stack_id`, `stack_name` заменены на `node_id`, `node_name` в data_source `decort_cb_kvmvm_list` в cloudbroker/kvmvm |
| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в data_source `decort_kvmvm_pci_device_list` в cloudapi/kvmvm |
| BATF-1134 | Вычисляемые поля `stack_id`, `stack_name` заменены на `node_id`, `node_name` в data_source `decort_cb_kvmvm`, `decort_cb_kvmvm_list`, `decort_cb_kvmvm_list_deleted` в cloudbroker/kvmvm |
| BATF-1079 | Отображение поля `disks` в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm при импорте |
| BATF-1083 | Отображение поля `boot_disk` в resource `decort_kvmvm` в cloudapi/kvmvm при обновлении поля `image_id` |
| BATF-1092 | Отображение вычисляемых полей `devicename`,`created_by`, `deleted_by`, `updated_time` в блоке `disks` и блока `loader_meta_iso` в resource `decort_kvmvm`, datasource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm`, datasource `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1142 | Остановка виртуальной машины перед удалением в resources `decort_kvmvm` и `decort_cb_kvmvm` в cloudapi/kvmvm и в cloudbroker/kvmvm |
| BATF-1165 | Тип поля `value` с опционального на обязательный в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1190 | Ошибка при старте на некорректной ноде при указании поля `node_id` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
#### lb
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1188 | Тип поля `start` с обязательного на опциональный в `decort_lb` в `cloudapi/lb` и в `decort_cb_lb` в `cloudbroker/lb` |
#### node
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1166 | Отображение datasource `decort_cb_node_list` в `cloudbroker/node` |
| BATF-1197 | Тип поля `cpu_allocation_ratio` с int на float в `decort_cb_node` в `cloudbroker/node` |
#### pcidevice
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Обязательное поле `stack_id` заменено на `node_id` в resource `decort_cb_pcidevice` в cloudbroker/pcidevice |
| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в datasoruces `decort_cb_pcidevice` и `decort_cb_pcidevice_list` в cloudbroker/pcidevice |
#### rg
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1062 | Отображение datasourses `decort_rg_list_deleted` в cloudapi/rg и `decort_cb_rg_list_deleted` в cloudbroker/rg |
#### sep
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1171 | Добавлен валидатор для поля `type` в resource `decort_cb_sep` в cloudbroker/sep |
| BATF-1171 | Заменено значение `ovs` на `ustor` в валидаторе поля `sep_type` в datasource `decort_cb_sep_template` в cloudbroker/sep |
#### user
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1158 | Тип поля `emailaddress` с []string на string в `decort_cb_user` в `cloudbroker/user` |
#### vins
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Вычисляемые поля `stack_id` заменены на `node_id` в datasource `decort_vins` в cloudapi/vins и datasource и resource `decort_cb_vins` в cloudbroker/vins |
### Удалено
#### account
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1136 | Поле `cu_np` во всех resources и datasources |
| BATF-1146 | Поля `exttraffic` и `ext_traffic` во всех resources и datasources |
#### disks
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1207 | Вычисляемое поле `ckey` из datasource `decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk_list_unattached` в cloudbroker/disks |
#### flipgroup
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1195 | Опциональное поле `rg_id` из datasource `decort_flipgroup_list` в cloudapi/flipgroup и `decort_cb_flipgroup_list` в cloudbroker/flipgroup |
| BATF-1195 | Вычисляемые поля `rg_id` и `rg_name` из datasources `decort_flipgroup` и `decort_flipgroup_list` в cloudapi/flipgroup и `decort_cb_flipgroup` и `decort_cb_flipgroup_list` в cloudbroker/flipgroup |
| BATF-1195 | Вычисляемые поля `rg_id` и `rg_name` из resource `decort_flipgroup` в cloudapi/flipgroup и `decort_cb_flipgroup` в cloudbroker/flipgroup |
#### grid
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1146 | Поля `exttraffic` и `ext_traffic` во всех datasources |
#### image
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Datasource `decort_cb_image_List_stacks` в cloudbroker/image |
| BATF-1206 | Вычисляемое поле `ckey` в resource `decort_image` и datasource `decort_image` в cloudapi/image и resources `decort_cb_cdrom_image` и `decort_cb_virtual_image` в cloudbroker/image |
#### node
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Вычисляемое поля `stack_id` в datasources `decort_cb_node` и `decort_cb_node_list` в cloudbroker/node |
#### pcidevice
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Вычисляемые поля `ckey`, `meta` в datasources `decort_cb_pcidevice` и `decort_cb_pcidevice_list` в cloudbroker/pcidevice |
#### stack
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Datasources `decort_stack` и `decort_stack_list` в cloudapi/stack и datasources `decort_cb_stack`, `decort_cb_stack_list` в cloudbroker/stack |
#### rg
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1138 | Опциональное поле `ext_traffic` в resource `decort_resgroup` в cloudbroker/rg |
| BATF-1138 | Поле `cu_np` в resources `decort_resgroup` в cloudapi/rg и в `decort_cb_rg` в cloudbroker/rg |
| BATF-1146 | Поля `exttraffic`, `ext_traffic` и `cu_np` во всех resources и datasources |
| BATF-1270 | Опциональное поле `iotune` в блоке `disks` в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |

View File

@@ -7,7 +7,7 @@ ZIPDIR = ./zip
BINARY=${NAME}
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH}
MAINPATH = ./cmd/decort/
VERSION=4.11.0
VERSION=4.11.2
OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
FILES = ${BINARY}_${VERSION}_darwin_amd64\

View File

@@ -17,7 +17,6 @@ description: |-
### Required
- `auto_start` (Boolean)
- `zone_id` (Number)
### Optional
@@ -27,6 +26,7 @@ description: |-
### Read-Only
- `account_ids` (List of Number)
- `auto_start` (Boolean)
- `bservice_ids` (List of Number)
- `compute_ids` (List of Number)
- `created_time` (Number)

View File

@@ -188,6 +188,7 @@ Optional:
- `desc` (String) Optional description
- `disk_type` (String) The type of disk in terms of its role in compute: 'B=Boot, D=Data'
- `image_id` (Number) Specify image id for create disk from template
- `iotune` (Block List, Max: 1) (see [below for nested schema](#nestedblock--disks--iotune))
- `node_ids` (Set of Number)
- `permanently` (Boolean) Disk deletion status
- `pool` (String) Pool name; by default will be chosen automatically
@@ -208,6 +209,26 @@ Read-Only:
- `to_clean` (Boolean)
- `update_time` (Number)
<a id="nestedblock--disks--iotune"></a>
### Nested Schema for `disks.iotune`
Optional:
- `read_bytes_sec` (Number)
- `read_bytes_sec_max` (Number)
- `read_iops_sec` (Number)
- `read_iops_sec_max` (Number)
- `size_iops_sec` (Number)
- `total_bytes_sec` (Number)
- `total_bytes_sec_max` (Number)
- `total_iops_sec` (Number)
- `total_iops_sec_max` (Number)
- `write_bytes_sec` (Number)
- `write_bytes_sec_max` (Number)
- `write_iops_sec` (Number)
- `write_iops_sec_max` (Number)
<a id="nestedblock--libvirt_settings"></a>
### Nested Schema for `libvirt_settings`

View File

@@ -37,6 +37,7 @@ description: |-
- `account_name` (String) The name of the subscriber '(account') to whom this disk belongs
- `acl` (String)
- `blk_discard` (Boolean) Flag indicating whether blk-discard is enabled for the disk
- `cache` (String)
- `computes` (List of Object) (see [below for nested schema](#nestedatt--computes))
- `created_by` (String)

View File

@@ -179,6 +179,7 @@ Optional:
- `desc` (String) Optional description
- `disk_type` (String) The type of disk in terms of its role in compute: 'B=Boot, D=Data'
- `image_id` (Number) Specify image id for create disk from template
- `iotune` (Block List, Max: 1) (see [below for nested schema](#nestedblock--disks--iotune))
- `permanently` (Boolean) Disk deletion status
- `pool` (String) Pool name; by default will be chosen automatically
- `sep_id` (Number) Storage endpoint provider ID; by default the same with boot disk
@@ -200,6 +201,26 @@ Read-Only:
- `to_clean` (Boolean)
- `updated_time` (Number)
<a id="nestedblock--disks--iotune"></a>
### Nested Schema for `disks.iotune`
Optional:
- `read_bytes_sec` (Number)
- `read_bytes_sec_max` (Number)
- `read_iops_sec` (Number)
- `read_iops_sec_max` (Number)
- `size_iops_sec` (Number)
- `total_bytes_sec` (Number)
- `total_bytes_sec_max` (Number)
- `total_iops_sec` (Number)
- `total_iops_sec_max` (Number)
- `write_bytes_sec` (Number)
- `write_bytes_sec_max` (Number)
- `write_iops_sec` (Number)
- `write_iops_sec_max` (Number)
<a id="nestedblock--network"></a>
### Nested Schema for `network`
@@ -311,6 +332,7 @@ Read-Only:
- `disk_name` (String)
- `disk_type` (String)
- `image_id` (Number)
- `iotune` (List of Object) (see [below for nested schema](#nestedobjatt--boot_disk--iotune))
- `permanently` (Boolean)
- `pool` (String)
- `present_to` (Map of Number)
@@ -323,6 +345,26 @@ Read-Only:
- `to_clean` (Boolean)
- `updated_time` (Number)
<a id="nestedobjatt--boot_disk--iotune"></a>
### Nested Schema for `boot_disk.iotune`
Read-Only:
- `read_bytes_sec` (Number)
- `read_bytes_sec_max` (Number)
- `read_iops_sec` (Number)
- `read_iops_sec_max` (Number)
- `size_iops_sec` (Number)
- `total_bytes_sec` (Number)
- `total_bytes_sec_max` (Number)
- `total_iops_sec` (Number)
- `total_iops_sec_max` (Number)
- `write_bytes_sec` (Number)
- `write_bytes_sec_max` (Number)
- `write_iops_sec` (Number)
- `write_iops_sec_max` (Number)
<a id="nestedatt--interfaces"></a>
### Nested Schema for `interfaces`

2
go.mod
View File

@@ -9,7 +9,7 @@ require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.38.1
github.com/sirupsen/logrus v1.9.0
golang.org/x/net v0.44.0
repository.basistech.ru/BASIS/decort-golang-sdk v1.13.8
repository.basistech.ru/BASIS/decort-golang-sdk v1.13.9
)
require (

4
go.sum
View File

@@ -318,5 +318,5 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
repository.basistech.ru/BASIS/decort-golang-sdk v1.13.8 h1:Uc+GBfbEg1dQPMuFfqNhKZmMO19N7OvdCNHIFnLLkp0=
repository.basistech.ru/BASIS/decort-golang-sdk v1.13.8/go.mod h1:S/f7GxwWcE88eFpORV+I9xqEf8zDW5srQHpG2XQCLZM=
repository.basistech.ru/BASIS/decort-golang-sdk v1.13.9 h1:jrfwiJBuHbt3JlVwD6DWF3E/H9pyDOJOvb8F5sQ/mhM=
repository.basistech.ru/BASIS/decort-golang-sdk v1.13.9/go.mod h1:S/f7GxwWcE88eFpORV+I9xqEf8zDW5srQHpG2XQCLZM=

View File

@@ -802,6 +802,11 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
Type: schema.TypeBool,
Computed: true,
},
"blk_discard": {
Type: schema.TypeBool,
Computed: true,
Description: "Flag indicating whether blk-discard is enabled for the disk",
},
}
return rets

View File

@@ -71,7 +71,7 @@ func resourceDiskSnapshotCreate(ctx context.Context, d *schema.ResourceData, m i
TimeStamp: uint64(d.Get("timestamp").(int)),
}
log.Debugf("resourceDiskCreate: Snapshot rollback with label", label)
log.Debugf("resourceDiskCreate: Snapshot rollback with label %s", label)
_, err := c.CloudAPI().Disks().SnapshotRollback(ctx, req)
if err != nil {
return diag.FromErr(err)

View File

@@ -805,13 +805,13 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
Description: "insert ssl certificate in x509 pem format",
},
"chipset": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
},
"chipset": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
},
"desc": {
Type: schema.TypeString,

View File

@@ -715,13 +715,13 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
),
Description: "Node RAM in MB.",
},
"chipset": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
},
"chipset": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
},
"disk": {
Type: schema.TypeInt,
Optional: true,

View File

@@ -290,13 +290,13 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
Description: "Number of worker nodes to create.",
},
"chipset": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
},
"chipset": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
},
"cpu": {
Type: schema.TypeInt,

View File

@@ -335,6 +335,7 @@ func flattenComputeDisksDemo(disksList compute.ListComputeDisks, disksBlocks, ex
"permanently": pernamentlyValue,
"cache": disk.Cache,
"blk_discard": disk.BLKDiscard,
"iotune": flattenIotune(disk.IOTune),
}
res = append(res, temp)
indexDataDisks++
@@ -476,6 +477,9 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc
d.Set("network_interface_naming", computeRec.NetworkInterfaceNaming)
d.Set("zone_id", computeRec.ZoneID)
d.Set("loader_meta_iso", flattenLoaderMetaIso(computeRec.LoaderMetaIso))
d.Set("cpu_pin", computeRec.CPUPin)
d.Set("numa_affinity", computeRec.NumaAffinity)
d.Set("hp_backed", computeRec.HPBacked)
d.Set("enabled", false)
if computeRec.Status == status.Enabled {

View File

@@ -390,6 +390,12 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
}
}
if _, ok := d.GetOk("disks"); ok {
if err := utilityComputeCreateIOTune(ctx, d, m); err != nil {
warnings.Add(err)
}
}
if !cleanup {
if enabled, ok := d.GetOk("enabled"); ok {
@@ -1124,6 +1130,7 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
resizedDisks := make([]interface{}, 0)
renamedDisks := make([]interface{}, 0)
changeStoragePolicyDisks := make([]interface{}, 0)
iotuneUpdatedDisks := make([]interface{}, 0)
oldDisks, newDisks := d.GetChange("disks")
oldConv := oldDisks.([]interface{})
@@ -1164,6 +1171,9 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
if isChangeStoragePolicy(oldConv, el) {
changeStoragePolicyDisks = append(changeStoragePolicyDisks, el)
}
if isChangeIOTuneDisk(oldConv, el) {
iotuneUpdatedDisks = append(iotuneUpdatedDisks, el)
}
}
if len(deletedDisks) > 0 {
@@ -1216,10 +1226,33 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
if diskConv["image_id"].(int) != 0 {
req.ImageID = uint64(diskConv["image_id"].(int))
}
_, err := c.CloudAPI().Compute().DiskAdd(ctx, req)
diskID, err := c.CloudAPI().Compute().DiskAdd(ctx, req)
if err != nil {
return diag.FromErr(err)
}
if iotuneRaw, ok := diskConv["iotune"].([]interface{}); ok && len(iotuneRaw) > 0 {
iotuneMap := iotuneRaw[0].(map[string]interface{})
limitReq := disks.LimitIORequest{
DiskID: diskID,
ReadBytesSec: uint64(iotuneMap["read_bytes_sec"].(int)),
ReadBytesSecMax: uint64(iotuneMap["read_bytes_sec_max"].(int)),
ReadIOPSSec: uint64(iotuneMap["read_iops_sec"].(int)),
ReadIOPSSecMax: uint64(iotuneMap["read_iops_sec_max"].(int)),
SizeIOPSSec: uint64(iotuneMap["size_iops_sec"].(int)),
TotalBytesSec: uint64(iotuneMap["total_bytes_sec"].(int)),
TotalBytesSecMax: uint64(iotuneMap["total_bytes_sec_max"].(int)),
TotalIOPSSec: uint64(iotuneMap["total_iops_sec"].(int)),
TotalIOPSSecMax: uint64(iotuneMap["total_iops_sec_max"].(int)),
WriteBytesSec: uint64(iotuneMap["write_bytes_sec"].(int)),
WriteBytesSecMax: uint64(iotuneMap["write_bytes_sec_max"].(int)),
WriteIOPSSec: uint64(iotuneMap["write_iops_sec"].(int)),
WriteIOPSSecMax: uint64(iotuneMap["write_iops_sec_max"].(int)),
}
_, err = c.CloudAPI().Disks().LimitIO(ctx, limitReq)
if err != nil {
return diag.FromErr(err)
}
}
}
}
@@ -1273,6 +1306,44 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
}
}
}
if len(iotuneUpdatedDisks) > 0 {
for _, disk := range iotuneUpdatedDisks {
diskConv := disk.(map[string]interface{})
if diskConv["disk_type"].(string) == "B" {
continue
}
diskID := uint64(diskConv["disk_id"].(int))
if diskID == 0 {
continue
}
iotuneRaw, ok := diskConv["iotune"].([]interface{})
if !ok || len(iotuneRaw) == 0 {
continue
}
iotuneMap := iotuneRaw[0].(map[string]interface{})
req := disks.LimitIORequest{
DiskID: diskID,
ReadBytesSec: uint64(iotuneMap["read_bytes_sec"].(int)),
ReadBytesSecMax: uint64(iotuneMap["read_bytes_sec_max"].(int)),
ReadIOPSSec: uint64(iotuneMap["read_iops_sec"].(int)),
ReadIOPSSecMax: uint64(iotuneMap["read_iops_sec_max"].(int)),
SizeIOPSSec: uint64(iotuneMap["size_iops_sec"].(int)),
TotalBytesSec: uint64(iotuneMap["total_bytes_sec"].(int)),
TotalBytesSecMax: uint64(iotuneMap["total_bytes_sec_max"].(int)),
TotalIOPSSec: uint64(iotuneMap["total_iops_sec"].(int)),
TotalIOPSSecMax: uint64(iotuneMap["total_iops_sec_max"].(int)),
WriteBytesSec: uint64(iotuneMap["write_bytes_sec"].(int)),
WriteBytesSecMax: uint64(iotuneMap["write_bytes_sec_max"].(int)),
WriteIOPSSec: uint64(iotuneMap["write_iops_sec"].(int)),
WriteIOPSSecMax: uint64(iotuneMap["write_iops_sec_max"].(int)),
}
_, err := c.CloudAPI().Disks().LimitIO(ctx, req)
if err != nil {
return diag.FromErr(err)
}
}
}
}
if d.HasChange("affinity_label") {
@@ -1862,6 +1933,40 @@ func isChangeStoragePolicy(els []interface{}, el interface{}) bool {
return false
}
func isChangeIOTuneDisk(els []interface{}, el interface{}) bool {
for _, elOld := range els {
elOldConv := elOld.(map[string]interface{})
elConv := el.(map[string]interface{})
if elOldConv["disk_id"].(int) != elConv["disk_id"].(int) {
continue
}
oldIOTune := elOldConv["iotune"].([]interface{})
newIOTune := elConv["iotune"].([]interface{})
if len(oldIOTune) == 0 && len(newIOTune) == 0 {
return false
}
if len(oldIOTune) == 0 || len(newIOTune) == 0 {
return true
}
oldMap := oldIOTune[0].(map[string]interface{})
newMap := newIOTune[0].(map[string]interface{})
return oldMap["read_bytes_sec"].(int) != newMap["read_bytes_sec"].(int) ||
oldMap["read_bytes_sec_max"].(int) != newMap["read_bytes_sec_max"].(int) ||
oldMap["read_iops_sec"].(int) != newMap["read_iops_sec"].(int) ||
oldMap["read_iops_sec_max"].(int) != newMap["read_iops_sec_max"].(int) ||
oldMap["size_iops_sec"].(int) != newMap["size_iops_sec"].(int) ||
oldMap["total_bytes_sec"].(int) != newMap["total_bytes_sec"].(int) ||
oldMap["total_bytes_sec_max"].(int) != newMap["total_bytes_sec_max"].(int) ||
oldMap["total_iops_sec"].(int) != newMap["total_iops_sec"].(int) ||
oldMap["total_iops_sec_max"].(int) != newMap["total_iops_sec_max"].(int) ||
oldMap["write_bytes_sec"].(int) != newMap["write_bytes_sec"].(int) ||
oldMap["write_bytes_sec_max"].(int) != newMap["write_bytes_sec_max"].(int) ||
oldMap["write_iops_sec"].(int) != newMap["write_iops_sec"].(int) ||
oldMap["write_iops_sec_max"].(int) != newMap["write_iops_sec_max"].(int)
}
return false
}
func isContainsDisk(els []interface{}, el interface{}) bool {
for _, elOld := range els {
elOldConv := elOld.(map[string]interface{})
@@ -1967,6 +2072,81 @@ func disksSubresourceSchemaMake() map[string]*schema.Schema {
Optional: true,
Description: "Disk deletion status",
},
"iotune": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"read_bytes_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"read_bytes_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"read_iops_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"read_iops_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"size_iops_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"total_bytes_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"total_bytes_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"total_iops_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"total_iops_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"write_bytes_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"write_bytes_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"write_iops_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"write_iops_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
},
},
},
"disk_id": {
Type: schema.TypeInt,
Computed: true,

View File

@@ -43,6 +43,7 @@ import (
"github.com/hashicorp/go-cty/cty"
log "github.com/sirupsen/logrus"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -628,3 +629,84 @@ func enabledNetwork(rawNetworkConfig cty.Value, netID uint64, netType string) bo
return false
}
func getComputeDiskIDsAPI(disksList compute.ListComputeDisks, disksBlocks, extraDisks []interface{}, bootDiskId uint64) []interface{} {
res := make([]interface{}, 0)
if len(disksBlocks) == 0 {
return res
}
sort.Slice(disksList, func(i, j int) bool {
return disksList[i].ID < disksList[j].ID
})
for _, disk := range disksList {
if disk.ID == bootDiskId || findInExtraDisks(uint(disk.ID), extraDisks) {
continue
}
res = append(res, disk.ID)
}
return res
}
func utilityComputeCreateIOTune(ctx context.Context, d *schema.ResourceData, m interface{}) error {
c := m.(*controller.ControllerCfg)
diskList := d.Get("disks").([]interface{})
iotuneArr := make([]interface{}, 0, len(diskList))
hasAny := false
for _, elem := range diskList {
diskVal := elem.(map[string]interface{})
iotune := diskVal["iotune"].([]interface{})
iotuneArr = append(iotuneArr, iotune)
if len(iotune) > 0 {
hasAny = true
}
}
if !hasAny {
return nil
}
computeRec, err := utilityComputeCheckPresence(ctx, d, m)
if err != nil {
return err
}
bootDisk := findBootDisk(computeRec.Disks)
computeDisksIDs := getComputeDiskIDsAPI(computeRec.Disks, diskList, d.Get("extra_disks").(*schema.Set).List(), bootDisk.ID)
for i, diskID := range computeDisksIDs {
if i >= len(iotuneArr) {
continue
}
iotune, ok := iotuneArr[i].([]interface{})
if !ok || len(iotune) == 0 {
continue
}
iotuneMap := iotune[0].(map[string]interface{})
req := disks.LimitIORequest{
DiskID: diskID.(uint64),
ReadBytesSec: uint64(iotuneMap["read_bytes_sec"].(int)),
ReadBytesSecMax: uint64(iotuneMap["read_bytes_sec_max"].(int)),
ReadIOPSSec: uint64(iotuneMap["read_iops_sec"].(int)),
ReadIOPSSecMax: uint64(iotuneMap["read_iops_sec_max"].(int)),
SizeIOPSSec: uint64(iotuneMap["size_iops_sec"].(int)),
TotalBytesSec: uint64(iotuneMap["total_bytes_sec"].(int)),
TotalBytesSecMax: uint64(iotuneMap["total_bytes_sec_max"].(int)),
TotalIOPSSec: uint64(iotuneMap["total_iops_sec"].(int)),
TotalIOPSSecMax: uint64(iotuneMap["total_iops_sec_max"].(int)),
WriteBytesSec: uint64(iotuneMap["write_bytes_sec"].(int)),
WriteBytesSecMax: uint64(iotuneMap["write_bytes_sec_max"].(int)),
WriteIOPSSec: uint64(iotuneMap["write_iops_sec"].(int)),
WriteIOPSSecMax: uint64(iotuneMap["write_iops_sec_max"].(int)),
}
_, err := c.CloudAPI().Disks().LimitIO(ctx, req)
if err != nil {
return err
}
}
return nil
}

View File

@@ -352,8 +352,8 @@ func flattenRgListComputes(lc *rg.ListComputes) []map[string]interface{} {
"status": compute.Status,
"tech_status": compute.TechStatus,
"total_disks_size": compute.TotalDisksSize,
"updated_by": compute.DeletedBy,
"updated_time": compute.DeletedTime,
"updated_by": compute.UpdatedBy,
"updated_time": compute.UpdatedTime,
"user_managed": compute.UserManaged,
"vins_connected": compute.VINSConnected,
}

View File

@@ -128,8 +128,12 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
}
}
}
if defNetType, ok := d.GetOk("def_net_type"); ok {
req.DefNet = defNetType.(string) // NOTE: in API default network type is set by "def_net" parameter
if _, ok := d.GetOk("def_net"); !ok {
if defNetType, ok := d.GetOk("def_net_type"); ok {
req.DefNet = defNetType.(string) // NOTE: in API default network type is set by "def_net" parameter
}
} else {
req.DefNet = "NONE"
}
if owner, ok := d.GetOk("owner"); ok {

View File

@@ -60,7 +60,7 @@ func dataSourceZoneSchemaMake() map[string]*schema.Schema {
},
"auto_start": {
Type: schema.TypeBool,
Required: true,
Computed: true,
},
"guid": {
Type: schema.TypeInt,

View File

@@ -1466,14 +1466,14 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
Optional: true,
Description: "insert ssl certificate in x509 pem format",
},
"chipset": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
},
"lb_sysctl_params": {
"chipset": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
},
"lb_sysctl_params": {
Type: schema.TypeList,
Optional: true,
Description: "Custom sysctl values for Load Balancer instance. Applied on boot.",
@@ -1810,19 +1810,19 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
),
Description: "Node RAM in MB.",
},
"chipset": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
},
"disk": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.",
},
"chipset": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
},
"disk": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.",
},
"labels": {
Type: schema.TypeList,
Computed: true,

View File

@@ -110,6 +110,9 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, p
d.Set("network_interface_naming", computeRec.NetworkInterfaceNaming)
d.Set("zone_id", computeRec.ZoneID)
d.Set("os_version", computeRec.OSVersion)
d.Set("cpu_pin", computeRec.CPUPin)
d.Set("numa_affinity", computeRec.NumaAffinity)
d.Set("hp_backed", computeRec.HPBacked)
return nil
}
@@ -286,6 +289,7 @@ func flattenComputeDisks(disksList compute.ListDisks, disksBlocks, extraDisks []
"update_time": disk.UpdatedTime,
"cache": disk.Cache,
"blk_discard": disk.BLKDiscard,
"iotune": flattenIOTune(disk.IOTune),
}
res = append(res, temp)
indexDataDisks++

View File

@@ -677,6 +677,9 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
if err != nil {
warnings.Add(err)
}
if err := utilityComputeCreateIOTune(ctx, d, m); err != nil {
warnings.Add(err)
}
}
if readOnly, ok := d.GetOk("read_only"); ok {

View File

@@ -3793,6 +3793,81 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
Optional: true,
Description: "Disk deletion status",
},
"iotune": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"read_bytes_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"read_bytes_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"read_iops_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"read_iops_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"size_iops_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"total_bytes_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"total_bytes_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"total_iops_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"total_iops_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"write_bytes_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"write_bytes_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"write_iops_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"write_iops_sec_max": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
},
},
},
"disk_id": {
Type: schema.TypeInt,
Computed: true,

View File

@@ -262,6 +262,7 @@ func utilityComputeUpdateDisks(ctx context.Context, d *schema.ResourceData, m in
changeStoragePolicyDisks := make([]interface{}, 0)
cacheUpdatedDisks := make([]interface{}, 0)
blkDiscardUpdatedDisks := make([]interface{}, 0)
iotuneUpdatedDisks := make([]interface{}, 0)
migratedDisks := make([]interface{}, 0)
presentNewDisks := make([]interface{}, 0)
presentOldDisks := make([]interface{}, 0)
@@ -320,6 +321,10 @@ func utilityComputeUpdateDisks(ctx context.Context, d *schema.ResourceData, m in
if isChangeBLKDiscardDisk(oldConv, el) {
blkDiscardUpdatedDisks = append(blkDiscardUpdatedDisks, el)
}
if isChangeIOTuneDisk(oldConv, el) {
iotuneUpdatedDisks = append(iotuneUpdatedDisks, el)
}
}
if len(deletedDisks) > 0 {
@@ -393,9 +398,30 @@ func utilityComputeUpdateDisks(ctx context.Context, d *schema.ResourceData, m in
}
}
}
if err != nil {
return err
if iotuneRaw, ok := diskConv["iotune"].([]interface{}); ok && len(iotuneRaw) > 0 {
iotuneMap := iotuneRaw[0].(map[string]interface{})
limitReq := disks.LimitIORequest{
DiskID: diskID,
ReadBytesSec: uint64(iotuneMap["read_bytes_sec"].(int)),
ReadBytesSecMax: uint64(iotuneMap["read_bytes_sec_max"].(int)),
ReadIOPSSec: uint64(iotuneMap["read_iops_sec"].(int)),
ReadIOPSSecMax: uint64(iotuneMap["read_iops_sec_max"].(int)),
SizeIOPSSec: uint64(iotuneMap["size_iops_sec"].(int)),
TotalBytesSec: uint64(iotuneMap["total_bytes_sec"].(int)),
TotalBytesSecMax: uint64(iotuneMap["total_bytes_sec_max"].(int)),
TotalIOPSSec: uint64(iotuneMap["total_iops_sec"].(int)),
TotalIOPSSecMax: uint64(iotuneMap["total_iops_sec_max"].(int)),
WriteBytesSec: uint64(iotuneMap["write_bytes_sec"].(int)),
WriteBytesSecMax: uint64(iotuneMap["write_bytes_sec_max"].(int)),
WriteIOPSSec: uint64(iotuneMap["write_iops_sec"].(int)),
WriteIOPSSecMax: uint64(iotuneMap["write_iops_sec_max"].(int)),
}
_, err := c.CloudBroker().Disks().LimitIO(ctx, limitReq)
if err != nil {
return err
}
}
}
}
@@ -495,6 +521,44 @@ func utilityComputeUpdateDisks(ctx context.Context, d *schema.ResourceData, m in
}
}
if len(iotuneUpdatedDisks) > 0 {
for _, disk := range iotuneUpdatedDisks {
diskConv := disk.(map[string]interface{})
if diskConv["disk_type"].(string) == "B" {
continue
}
diskID := uint64(diskConv["disk_id"].(int))
if diskID == 0 {
continue
}
iotuneRaw, ok := diskConv["iotune"].([]interface{})
if !ok || len(iotuneRaw) == 0 {
continue
}
iotuneMap := iotuneRaw[0].(map[string]interface{})
req := disks.LimitIORequest{
DiskID: diskID,
ReadBytesSec: uint64(iotuneMap["read_bytes_sec"].(int)),
ReadBytesSecMax: uint64(iotuneMap["read_bytes_sec_max"].(int)),
ReadIOPSSec: uint64(iotuneMap["read_iops_sec"].(int)),
ReadIOPSSecMax: uint64(iotuneMap["read_iops_sec_max"].(int)),
SizeIOPSSec: uint64(iotuneMap["size_iops_sec"].(int)),
TotalBytesSec: uint64(iotuneMap["total_bytes_sec"].(int)),
TotalBytesSecMax: uint64(iotuneMap["total_bytes_sec_max"].(int)),
TotalIOPSSec: uint64(iotuneMap["total_iops_sec"].(int)),
TotalIOPSSecMax: uint64(iotuneMap["total_iops_sec_max"].(int)),
WriteBytesSec: uint64(iotuneMap["write_bytes_sec"].(int)),
WriteBytesSecMax: uint64(iotuneMap["write_bytes_sec_max"].(int)),
WriteIOPSSec: uint64(iotuneMap["write_iops_sec"].(int)),
WriteIOPSSecMax: uint64(iotuneMap["write_iops_sec_max"].(int)),
}
_, err := c.CloudBroker().Disks().LimitIO(ctx, req)
if err != nil {
return err
}
}
}
if len(migratedDisks) > 0 {
if err := utilityComputeMigrateDisks(ctx, d, m, migratedDisks, oldConv); err != nil {
return err
@@ -2077,6 +2141,100 @@ func isChangeBLKDiscardDisk(els []interface{}, el interface{}) bool {
return false
}
func isChangeIOTuneDisk(els []interface{}, el interface{}) bool {
for _, elOld := range els {
elOldConv := elOld.(map[string]interface{})
elConv := el.(map[string]interface{})
if elOldConv["disk_id"].(int) != elConv["disk_id"].(int) {
continue
}
oldIOTune := elOldConv["iotune"].([]interface{})
newIOTune := elConv["iotune"].([]interface{})
if len(oldIOTune) == 0 && len(newIOTune) == 0 {
return false
}
if len(oldIOTune) == 0 || len(newIOTune) == 0 {
return true
}
oldMap := oldIOTune[0].(map[string]interface{})
newMap := newIOTune[0].(map[string]interface{})
return oldMap["read_bytes_sec"].(int) != newMap["read_bytes_sec"].(int) ||
oldMap["read_bytes_sec_max"].(int) != newMap["read_bytes_sec_max"].(int) ||
oldMap["read_iops_sec"].(int) != newMap["read_iops_sec"].(int) ||
oldMap["read_iops_sec_max"].(int) != newMap["read_iops_sec_max"].(int) ||
oldMap["size_iops_sec"].(int) != newMap["size_iops_sec"].(int) ||
oldMap["total_bytes_sec"].(int) != newMap["total_bytes_sec"].(int) ||
oldMap["total_bytes_sec_max"].(int) != newMap["total_bytes_sec_max"].(int) ||
oldMap["total_iops_sec"].(int) != newMap["total_iops_sec"].(int) ||
oldMap["total_iops_sec_max"].(int) != newMap["total_iops_sec_max"].(int) ||
oldMap["write_bytes_sec"].(int) != newMap["write_bytes_sec"].(int) ||
oldMap["write_bytes_sec_max"].(int) != newMap["write_bytes_sec_max"].(int) ||
oldMap["write_iops_sec"].(int) != newMap["write_iops_sec"].(int) ||
oldMap["write_iops_sec_max"].(int) != newMap["write_iops_sec_max"].(int)
}
return false
}
func utilityComputeCreateIOTune(ctx context.Context, d *schema.ResourceData, m interface{}) error {
c := m.(*controller.ControllerCfg)
diskList := d.Get("disks").([]interface{})
iotuneArr := make([]interface{}, 0, len(diskList))
hasAny := false
for _, elem := range diskList {
diskVal := elem.(map[string]interface{})
iotune := diskVal["iotune"].([]interface{})
iotuneArr = append(iotuneArr, iotune)
if len(iotune) > 0 {
hasAny = true
}
}
if !hasAny {
return nil
}
computeRec, err := utilityComputeCheckPresence(ctx, d, m)
if err != nil {
return err
}
bootDisk := findBootDisk(computeRec.Disks)
computeDisksIDs := getComputeDiskIDs(computeRec.Disks, diskList, d.Get("extra_disks").(*schema.Set).List(), bootDisk.ID)
for i, diskID := range computeDisksIDs {
if i >= len(iotuneArr) {
continue
}
iotune, ok := iotuneArr[i].([]interface{})
if !ok || len(iotune) == 0 {
continue
}
iotuneMap := iotune[0].(map[string]interface{})
req := disks.LimitIORequest{
DiskID: diskID.(uint64),
ReadBytesSec: uint64(iotuneMap["read_bytes_sec"].(int)),
ReadBytesSecMax: uint64(iotuneMap["read_bytes_sec_max"].(int)),
ReadIOPSSec: uint64(iotuneMap["read_iops_sec"].(int)),
ReadIOPSSecMax: uint64(iotuneMap["read_iops_sec_max"].(int)),
SizeIOPSSec: uint64(iotuneMap["size_iops_sec"].(int)),
TotalBytesSec: uint64(iotuneMap["total_bytes_sec"].(int)),
TotalBytesSecMax: uint64(iotuneMap["total_bytes_sec_max"].(int)),
TotalIOPSSec: uint64(iotuneMap["total_iops_sec"].(int)),
TotalIOPSSecMax: uint64(iotuneMap["total_iops_sec_max"].(int)),
WriteBytesSec: uint64(iotuneMap["write_bytes_sec"].(int)),
WriteBytesSecMax: uint64(iotuneMap["write_bytes_sec_max"].(int)),
WriteIOPSSec: uint64(iotuneMap["write_iops_sec"].(int)),
WriteIOPSSecMax: uint64(iotuneMap["write_iops_sec_max"].(int)),
}
_, err := c.CloudBroker().Disks().LimitIO(ctx, req)
if err != nil {
return err
}
}
return nil
}
func isChangeStoragePolicy(els []interface{}, el interface{}) bool {
for _, elOld := range els {
elOldConv := elOld.(map[string]interface{})

View File

@@ -105,8 +105,12 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
req.Owner = owner.(string)
}
if defNetType, ok := d.GetOk("def_net_type"); ok {
req.DefNet = defNetType.(string)
if _, ok := d.GetOk("def_net"); !ok {
if defNetType, ok := d.GetOk("def_net_type"); ok {
req.DefNet = defNetType.(string)
}
} else {
req.DefNet = "NONE"
}
if description, ok := d.GetOk("description"); ok {

View File

@@ -37,4 +37,3 @@ func DataSourceAccessGroupList() *schema.Resource {
Schema: dataSourceAccessGroupListSchemaMake(),
}
}

View File

@@ -49,4 +49,3 @@ func utilityAccessGroupListCheckPresence(ctx context.Context, d *schema.Resource
return accessGroupList, nil
}

View File

@@ -37,4 +37,3 @@ func DataSourceDefaultSecurityPolicyList() *schema.Resource {
Schema: dataSourceDefaultSecurityPolicyListSchemaMake(),
}
}

View File

@@ -366,4 +366,3 @@ func dataSourceDefaultSecurityPolicyListSchemaMake() map[string]*schema.Schema {
return res
}

View File

@@ -37,4 +37,3 @@ func utilityDefaultSecurityPolicyListCheckPresence(ctx context.Context, d *schem
return defaultSecurityPolicyList, nil
}

View File

@@ -69,15 +69,6 @@ resource "decort_disk" "acl" {
#возможные значенния - "none", "writethrough"
#используется при создании и обновлении
#shareable = false
#установка режима кэширования
#опциональный параметр
#тип - строка
#возможные значенния - "none", "writethrough"
#значение по умолчанию - none
#используется при создании
#cache = "none"
}
output "test" {

View File

@@ -189,6 +189,25 @@ resource "decort_kvmvm" "comp" {
#опциональный параметр
#тип - булев
#permanently = false
#блок для управления IO-лимитами диска
#опциональный параметр
#тип - блок
#iotune {
#read_bytes_sec = 0
#read_bytes_sec_max = 0
#read_iops_sec = 0
#read_iops_sec_max = 0
#size_iops_sec = 0
#total_bytes_sec = 0
#total_bytes_sec_max = 0
#total_iops_sec = 3000
#total_iops_sec_max = 0
#write_bytes_sec = 0
#write_bytes_sec_max = 0
#write_iops_sec = 0
#write_iops_sec_max = 0
#}
#}
#правила affinity

View File

@@ -57,11 +57,6 @@ data "decort_cb_flipgroup_list" "fg" {
#тип - строка
#by_ip = "1.1.1.1.1"
#фильтр по id ресурсной группы
#опциональный параметр
#тип - целое число
#rg_id = 11111
#сортировка по одному из поддерживаемых полей
#опциональный параметр
#тип - строка

View File

@@ -229,6 +229,25 @@ resource "decort_cb_kvmvm" "comp" {
#тип - булев
#по умолчанию - false
#blk_discard = false
#блок для управления IO-лимитами диска
#опциональный параметр
#тип - блок
#iotune {
#read_bytes_sec = 0
#read_bytes_sec_max = 0
#read_iops_sec = 0
#read_iops_sec_max = 0
#size_iops_sec = 0
#total_bytes_sec = 0
#total_bytes_sec_max = 0
#total_iops_sec = 3000
#total_iops_sec_max = 0
#write_bytes_sec = 0
#write_bytes_sec_max = 0
#write_iops_sec = 0
#write_iops_sec_max = 0
#}
#}
#правила affinity