From ce7a5258be0be4b01d33573875ec159637098acb Mon Sep 17 00:00:00 2001 From: Edward Date: Mon, 22 Jan 2018 16:20:55 +0800 Subject: [PATCH 1/2] Add schedule hint support in volume resource --- ...ource_opentelekomcloud_blockstorage_volume_v2.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/opentelekomcloud/resource_opentelekomcloud_blockstorage_volume_v2.go b/opentelekomcloud/resource_opentelekomcloud_blockstorage_volume_v2.go index 734a7b933..d32b18f5c 100644 --- a/opentelekomcloud/resource_opentelekomcloud_blockstorage_volume_v2.go +++ b/opentelekomcloud/resource_opentelekomcloud_blockstorage_volume_v2.go @@ -100,6 +100,10 @@ func resourceBlockStorageVolumeV2() *schema.Resource { Type: schema.TypeMap, Optional: true, }, + "schedule_hint": &schema.Schema{ + Type: schema.TypeMap, + Optional: true, + }, "attachment": &schema.Schema{ Type: schema.TypeSet, Computed: true, @@ -133,6 +137,14 @@ func resourceContainerMetadataV2(d *schema.ResourceData) map[string]string { return m } +func resourceScheduleHint(d *schema.ResourceData) map[string]string { + hint := make(map[string]string) + for key, val := range d.Get("schedule_hint").(map[string]interface{}) { + hint[key] = val.(string) + } + return hint +} + func resourceContainerTags(d *schema.ResourceData) map[string]string { m := make(map[string]string) for key, val := range d.Get("tags").(map[string]interface{}) { @@ -175,6 +187,7 @@ func resourceBlockStorageVolumeV2Create(d *schema.ResourceData, meta interface{} SourceReplica: d.Get("source_replica").(string), SourceVolID: d.Get("source_vol_id").(string), VolumeType: d.Get("volume_type").(string), + ScheduleHint: resourceScheduleHint(d), } log.Printf("[DEBUG] Create Options: %#v", createOpts) From 712823f356bb3a83fc7ef59cfafdfef55528ffd0 Mon Sep 17 00:00:00 2001 From: Edward Date: Mon, 22 Jan 2018 20:21:56 +0800 Subject: [PATCH 2/2] Change the name of configuration to scheduler_hints --- .../resource_opentelekomcloud_blockstorage_volume_v2.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opentelekomcloud/resource_opentelekomcloud_blockstorage_volume_v2.go b/opentelekomcloud/resource_opentelekomcloud_blockstorage_volume_v2.go index d32b18f5c..45667d83a 100644 --- a/opentelekomcloud/resource_opentelekomcloud_blockstorage_volume_v2.go +++ b/opentelekomcloud/resource_opentelekomcloud_blockstorage_volume_v2.go @@ -100,7 +100,7 @@ func resourceBlockStorageVolumeV2() *schema.Resource { Type: schema.TypeMap, Optional: true, }, - "schedule_hint": &schema.Schema{ + "scheduler_hints": &schema.Schema{ Type: schema.TypeMap, Optional: true, }, @@ -137,9 +137,9 @@ func resourceContainerMetadataV2(d *schema.ResourceData) map[string]string { return m } -func resourceScheduleHint(d *schema.ResourceData) map[string]string { +func resourceSchedulerHints(d *schema.ResourceData) map[string]string { hint := make(map[string]string) - for key, val := range d.Get("schedule_hint").(map[string]interface{}) { + for key, val := range d.Get("scheduler_hints").(map[string]interface{}) { hint[key] = val.(string) } return hint @@ -187,7 +187,7 @@ func resourceBlockStorageVolumeV2Create(d *schema.ResourceData, meta interface{} SourceReplica: d.Get("source_replica").(string), SourceVolID: d.Get("source_vol_id").(string), VolumeType: d.Get("volume_type").(string), - ScheduleHint: resourceScheduleHint(d), + SchedulerHints: resourceSchedulerHints(d), } log.Printf("[DEBUG] Create Options: %#v", createOpts)