openstack

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2018 License: MPL-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "mitchellh.openstack"

The unique ID for this builder

Variables

This section is empty.

Functions

func CheckFloatingIP added in v1.3.0

func CheckFloatingIP(client *gophercloud.ServiceClient, id string) (*floatingips.FloatingIP, error)

CheckFloatingIP gets a floating IP by its ID and checks if it is already associated with any internal interface. It returns floating IP if it can be used.

func CheckFloatingIPNetwork added in v1.3.0

func CheckFloatingIPNetwork(client *gophercloud.ServiceClient, networkRef string) (string, error)

CheckFloatingIPNetwork checks provided network reference and returns a valid Networking service ID.

func CommHost

func CommHost(
	client *gophercloud.ServiceClient,
	sshinterface string,
	sshipversion string) func(multistep.StateBag) (string, error)

CommHost looks up the host for the communicator.

func FindFreeFloatingIP added in v1.3.0

func FindFreeFloatingIP(client *gophercloud.ServiceClient) (*floatingips.FloatingIP, error)

FindFreeFloatingIP returns free unassociated floating IP. It will return first floating IP if there are many.

func GetFloatingIPNetworkIDByName added in v1.3.0

func GetFloatingIPNetworkIDByName(client *gophercloud.ServiceClient, networkName string) (string, error)

GetFloatingIPNetworkIDByName searches for the external network ID by the provided name.

func GetInstancePortID added in v1.3.0

func GetInstancePortID(client *gophercloud.ServiceClient, id string) (string, error)

GetInstancePortID returns internal port of the instance that can be used for the association of a floating IP. It will return an ID of a first port if there are many.

func GetVolumeSize added in v1.3.0

func GetVolumeSize(imageClient *gophercloud.ServiceClient, imageID string) (int, error)

GetVolumeSize returns volume size in gigabytes based on the image min disk value if it's not empty. Or it calculates needed gigabytes size from the image bytes size.

func GetVolumeStatus added in v1.3.2

func GetVolumeStatus(blockStorageClient *gophercloud.ServiceClient, volumeID string) (string, error)

func WaitForImage

func WaitForImage(client *gophercloud.ServiceClient, imageId string) error

WaitForImage waits for the given Image ID to become ready.

func WaitForState

func WaitForState(conf *StateChangeConf) (i interface{}, err error)

WaitForState watches an object and waits for it to achieve a certain state.

func WaitForVolume added in v1.3.0

func WaitForVolume(blockStorageClient *gophercloud.ServiceClient, volumeID string) error

WaitForVolume waits for the given volume to become available.

Types

type AccessConfig

type AccessConfig struct {
	Username         string `mapstructure:"username"`
	UserID           string `mapstructure:"user_id"`
	Password         string `mapstructure:"password"`
	IdentityEndpoint string `mapstructure:"identity_endpoint"`
	TenantID         string `mapstructure:"tenant_id"`
	TenantName       string `mapstructure:"tenant_name"`
	DomainID         string `mapstructure:"domain_id"`
	DomainName       string `mapstructure:"domain_name"`
	Insecure         bool   `mapstructure:"insecure"`
	Region           string `mapstructure:"region"`
	EndpointType     string `mapstructure:"endpoint_type"`
	CACertFile       string `mapstructure:"cacert"`
	ClientCertFile   string `mapstructure:"cert"`
	ClientKeyFile    string `mapstructure:"key"`
	Token            string `mapstructure:"token"`
	Cloud            string `mapstructure:"cloud"`
	// contains filtered or unexported fields
}

AccessConfig is for common configuration related to openstack access

func (*AccessConfig) Prepare

func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error

type Artifact

type Artifact struct {
	// ImageId of built image
	ImageId string

	// BuilderId is the unique ID for the builder that created this image
	BuilderIdValue string

	// OpenStack connection for performing API stuff.
	Client *gophercloud.ServiceClient
}

Artifact is an artifact implementation that contains built images.

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (*Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State

func (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func (*Builder) Cancel

func (b *Builder) Cancel()

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) ([]string, error)

func (*Builder) Run

func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error)

type Config

type Config struct {
	common.PackerConfig `mapstructure:",squash"`

	AccessConfig `mapstructure:",squash"`
	ImageConfig  `mapstructure:",squash"`
	RunConfig    `mapstructure:",squash"`
	// contains filtered or unexported fields
}

type ExternalNetwork added in v1.3.0

type ExternalNetwork struct {
	networks.Network
	external.NetworkExternalExt
}

ExternalNetwork is a network with external router.

type ImageConfig

type ImageConfig struct {
	ImageName       string                       `mapstructure:"image_name"`
	ImageMetadata   map[string]string            `mapstructure:"metadata"`
	ImageVisibility imageservice.ImageVisibility `mapstructure:"image_visibility"`
	ImageMembers    []string                     `mapstructure:"image_members"`
	ImageDiskFormat string                       `mapstructure:"image_disk_format"`
}

ImageConfig is for common configuration related to creating Images.

func (*ImageConfig) Prepare

func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error

type ImageFilter added in v1.3.0

type ImageFilter struct {
	Filters    ImageFilterOptions `mapstructure:"filters"`
	MostRecent bool               `mapstructure:"most_recent"`
}

type ImageFilterOptions added in v1.3.0

type ImageFilterOptions struct {
	Name       string   `mapstructure:"name"`
	Owner      string   `mapstructure:"owner"`
	Tags       []string `mapstructure:"tags"`
	Visibility string   `mapstructure:"visibility"`
}

func (*ImageFilterOptions) Build added in v1.3.0

func (f *ImageFilterOptions) Build() (*images.ListOpts, error)

func (*ImageFilterOptions) Empty added in v1.3.0

func (f *ImageFilterOptions) Empty() bool

type RunConfig

type RunConfig struct {
	Comm communicator.Config `mapstructure:",squash"`

	SourceImage        string            `mapstructure:"source_image"`
	SourceImageName    string            `mapstructure:"source_image_name"`
	SourceImageFilters ImageFilter       `mapstructure:"source_image_filter"`
	Flavor             string            `mapstructure:"flavor"`
	AvailabilityZone   string            `mapstructure:"availability_zone"`
	RackconnectWait    bool              `mapstructure:"rackconnect_wait"`
	FloatingIPNetwork  string            `mapstructure:"floating_ip_network"`
	FloatingIP         string            `mapstructure:"floating_ip"`
	ReuseIPs           bool              `mapstructure:"reuse_ips"`
	SecurityGroups     []string          `mapstructure:"security_groups"`
	Networks           []string          `mapstructure:"networks"`
	Ports              []string          `mapstructure:"ports"`
	UserData           string            `mapstructure:"user_data"`
	UserDataFile       string            `mapstructure:"user_data_file"`
	InstanceName       string            `mapstructure:"instance_name"`
	InstanceMetadata   map[string]string `mapstructure:"instance_metadata"`

	ConfigDrive bool `mapstructure:"config_drive"`

	// Used for BC, value will be passed to the "floating_ip_network"
	FloatingIPPool string `mapstructure:"floating_ip_pool"`

	UseBlockStorageVolume  bool   `mapstructure:"use_blockstorage_volume"`
	VolumeName             string `mapstructure:"volume_name"`
	VolumeType             string `mapstructure:"volume_type"`
	VolumeAvailabilityZone string `mapstructure:"volume_availability_zone"`

	// Not really used, but here for BC
	OpenstackProvider string `mapstructure:"openstack_provider"`
	UseFloatingIp     bool   `mapstructure:"use_floating_ip"`
	// contains filtered or unexported fields
}

RunConfig contains configuration for running an instance from a source image and details on how to access that launched image.

func (*RunConfig) Prepare

func (c *RunConfig) Prepare(ctx *interpolate.Context) []error

type StateChangeConf

type StateChangeConf struct {
	Pending   []string
	Refresh   StateRefreshFunc
	StepState multistep.StateBag
	Target    []string
}

StateChangeConf is the configuration struct used for `WaitForState`.

type StateRefreshFunc

type StateRefreshFunc func() (result interface{}, state string, progress int, err error)

StateRefreshFunc is a function type used for StateChangeConf that is responsible for refreshing the item being watched for a state change.

It returns three results. `result` is any object that will be returned as the final object after waiting for state change. This allows you to return the final updated object, for example an openstack instance after refreshing it.

`state` is the latest state of that object. And `err` is any error that may have happened while refreshing the state.

func ServerStateRefreshFunc

func ServerStateRefreshFunc(
	client *gophercloud.ServiceClient, s *servers.Server) StateRefreshFunc

ServerStateRefreshFunc returns a StateRefreshFunc that is used to watch an openstack server.

type StepAllocateIp

type StepAllocateIp struct {
	FloatingIPNetwork string
	FloatingIP        string
	ReuseIPs          bool
}

func (*StepAllocateIp) Cleanup

func (s *StepAllocateIp) Cleanup(state multistep.StateBag)

func (*StepAllocateIp) Run

type StepCreateVolume added in v1.3.0

type StepCreateVolume struct {
	UseBlockStorageVolume  bool
	VolumeName             string
	VolumeType             string
	VolumeAvailabilityZone string
	// contains filtered or unexported fields
}

func (*StepCreateVolume) Cleanup added in v1.3.0

func (s *StepCreateVolume) Cleanup(state multistep.StateBag)

func (*StepCreateVolume) Run added in v1.3.0

type StepDetachVolume added in v1.3.0

type StepDetachVolume struct {
	UseBlockStorageVolume bool
}

func (*StepDetachVolume) Cleanup added in v1.3.0

func (s *StepDetachVolume) Cleanup(multistep.StateBag)

func (*StepDetachVolume) Run added in v1.3.0

type StepGetPassword

type StepGetPassword struct {
	Debug bool
	Comm  *communicator.Config
}

StepGetPassword reads the password from a booted OpenStack server and sets it on the WinRM config.

func (*StepGetPassword) Cleanup

func (s *StepGetPassword) Cleanup(multistep.StateBag)

func (*StepGetPassword) Run

type StepKeyPair

type StepKeyPair struct {
	Debug        bool
	Comm         *communicator.Config
	DebugKeyPath string
	// contains filtered or unexported fields
}

func (*StepKeyPair) Cleanup

func (s *StepKeyPair) Cleanup(state multistep.StateBag)

func (*StepKeyPair) Run

type StepLoadFlavor

type StepLoadFlavor struct {
	Flavor string
}

StepLoadFlavor gets the FlavorRef from a Flavor. It first assumes that the Flavor is a ref and verifies it. Otherwise, it tries to find the flavor by name.

func (*StepLoadFlavor) Cleanup

func (s *StepLoadFlavor) Cleanup(state multistep.StateBag)

func (*StepLoadFlavor) Run

type StepRunSourceServer

type StepRunSourceServer struct {
	Name                  string
	SecurityGroups        []string
	Networks              []string
	Ports                 []string
	AvailabilityZone      string
	UserData              string
	UserDataFile          string
	ConfigDrive           bool
	InstanceMetadata      map[string]string
	UseBlockStorageVolume bool
	// contains filtered or unexported fields
}

func (*StepRunSourceServer) Cleanup

func (s *StepRunSourceServer) Cleanup(state multistep.StateBag)

func (*StepRunSourceServer) Run

type StepSourceImageInfo added in v1.3.0

type StepSourceImageInfo struct {
	SourceImage      string
	SourceImageName  string
	SourceImageOpts  images.ListOpts
	SourceMostRecent bool
}

func (*StepSourceImageInfo) Cleanup added in v1.3.0

func (s *StepSourceImageInfo) Cleanup(state multistep.StateBag)

func (*StepSourceImageInfo) Run added in v1.3.0

type StepStopServer

type StepStopServer struct{}

func (*StepStopServer) Cleanup

func (s *StepStopServer) Cleanup(state multistep.StateBag)

func (*StepStopServer) Run

type StepWaitForRackConnect

type StepWaitForRackConnect struct {
	Wait bool
}

func (*StepWaitForRackConnect) Cleanup

func (s *StepWaitForRackConnect) Cleanup(state multistep.StateBag)

func (*StepWaitForRackConnect) Run

Jump to

Keyboard shortcuts

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