Skip to content

Commit

Permalink
Merge pull request #24 from freesky-edward/support-schedule-hint
Browse files Browse the repository at this point in the history
Add schedule hint support in volume resource
  • Loading branch information
gator1 authored Jan 23, 2018
2 parents 4c91b4a + 712823f commit b003eae
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ func resourceBlockStorageVolumeV2() *schema.Resource {
Type: schema.TypeMap,
Optional: true,
},
"scheduler_hints": &schema.Schema{
Type: schema.TypeMap,
Optional: true,
},
"attachment": &schema.Schema{
Type: schema.TypeSet,
Computed: true,
Expand Down Expand Up @@ -133,6 +137,14 @@ func resourceContainerMetadataV2(d *schema.ResourceData) map[string]string {
return m
}

func resourceSchedulerHints(d *schema.ResourceData) map[string]string {
hint := make(map[string]string)
for key, val := range d.Get("scheduler_hints").(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{}) {
Expand Down Expand Up @@ -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),
SchedulerHints: resourceSchedulerHints(d),
}

log.Printf("[DEBUG] Create Options: %#v", createOpts)
Expand Down

0 comments on commit b003eae

Please sign in to comment.