schedulerhints

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 2 Imported by: 5

Documentation

Overview

Package schedulerhints extends the volume create request with the ability to specify additional parameters which determine where the volume will be created in the OpenStack cloud.

Example to Place Volume B on a Different Host than Volume A

schedulerHints := schedulerhints.SchedulerHints{
	DifferentHost: []string{
		"volume-a-uuid",
	}
}

volumeCreateOpts := volumes.CreateOpts{
	Name:   "volume_b",
	Size:   10,
}

createOpts := schedulerhints.CreateOptsExt{
	VolumeCreateOptsBuilder: volumeCreateOpts,
	SchedulerHints:    schedulerHints,
}

volume, err := volumes.Create(computeClient, createOpts).Extract()
if err != nil {
	panic(err)
}

Example to Place Volume B on the Same Host as Volume A

schedulerHints := schedulerhints.SchedulerHints{
	SameHost: []string{
		"volume-a-uuid",
	}
}

volumeCreateOpts := volumes.CreateOpts{
	Name:   "volume_b",
	Size:   10
}

createOpts := schedulerhints.CreateOptsExt{
	VolumeCreateOptsBuilder: volumeCreateOpts,
	SchedulerHints:    schedulerHints,
}

volume, err := volumes.Create(computeClient, createOpts).Extract()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToVolumeSchedulerHintsCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder builds the scheduler hints into a serializable format.

type CreateOptsExt

type CreateOptsExt struct {
	VolumeCreateOptsBuilder

	// SchedulerHints provides a set of hints to the scheduler.
	SchedulerHints CreateOptsBuilder
}

CreateOptsExt adds a SchedulerHints option to the base CreateOpts.

func (CreateOptsExt) ToVolumeCreateMap

func (opts CreateOptsExt) ToVolumeCreateMap() (map[string]interface{}, error)

ToVolumeCreateMap adds the SchedulerHints option to the base volume creation options.

type SchedulerHints

type SchedulerHints struct {
	// DifferentHost will place the volume on a different back-end that does not
	// host the given volumes.
	DifferentHost []string

	// SameHost will place the volume on a back-end that hosts the given volumes.
	SameHost []string

	// LocalToInstance will place volume on same host on a given instance
	LocalToInstance string

	// Query is a conditional statement that results in back-ends able to
	// host the volume.
	Query string

	// AdditionalProperies are arbitrary key/values that are not validated by nova.
	AdditionalProperties map[string]interface{}
}

SchedulerHints represents a set of scheduling hints that are passed to the OpenStack scheduler.

func (SchedulerHints) ToVolumeSchedulerHintsCreateMap

func (opts SchedulerHints) ToVolumeSchedulerHintsCreateMap() (map[string]interface{}, error)

ToVolumeSchedulerHintsMap builds the scheduler hints into a serializable format.

type VolumeCreateOptsBuilder

type VolumeCreateOptsBuilder interface {
	ToVolumeCreateMap() (map[string]interface{}, error)
}

VolumeCreateOptsBuilder allows extensions to add additional parameters to the Create request.

Directories

Path Synopsis
schedulerhints unit tests
schedulerhints unit tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL