github.com/gophercloud/gophercloud@v1.11.0/openstack/blockstorage/extensions/schedulerhints/doc.go (about)

     1  /*
     2  Package schedulerhints extends the volume create request with the ability to
     3  specify additional parameters which determine where the volume will be
     4  created in the OpenStack cloud.
     5  
     6  Example to Place Volume B on a Different Host than Volume A
     7  
     8  	schedulerHints := schedulerhints.SchedulerHints{
     9  		DifferentHost: []string{
    10  			"volume-a-uuid",
    11  		}
    12  	}
    13  
    14  	volumeCreateOpts := volumes.CreateOpts{
    15  		Name:   "volume_b",
    16  		Size:   10,
    17  	}
    18  
    19  	createOpts := schedulerhints.CreateOptsExt{
    20  		VolumeCreateOptsBuilder: volumeCreateOpts,
    21  		SchedulerHints:    schedulerHints,
    22  	}
    23  
    24  	volume, err := volumes.Create(computeClient, createOpts).Extract()
    25  	if err != nil {
    26  		panic(err)
    27  	}
    28  
    29  Example to Place Volume B on the Same Host as Volume A
    30  
    31  	schedulerHints := schedulerhints.SchedulerHints{
    32  		SameHost: []string{
    33  			"volume-a-uuid",
    34  		}
    35  	}
    36  
    37  	volumeCreateOpts := volumes.CreateOpts{
    38  		Name:   "volume_b",
    39  		Size:   10
    40  	}
    41  
    42  	createOpts := schedulerhints.CreateOptsExt{
    43  		VolumeCreateOptsBuilder: volumeCreateOpts,
    44  		SchedulerHints:    schedulerHints,
    45  	}
    46  
    47  	volume, err := volumes.Create(computeClient, createOpts).Extract()
    48  	if err != nil {
    49  		panic(err)
    50  	}
    51  */
    52  package schedulerhints