diskconfig

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package diskconfig provides information and interaction with the Disk Config extension that works with the OpenStack Compute service.

Example of Obtaining the Disk Config of a Server

type ServerWithDiskConfig {
	servers.Server
	diskconfig.ServerDiskConfigExt
}

var allServers []ServerWithDiskConfig

allPages, err := servers.List(client, nil).AllPages()
if err != nil {
	panic("Unable to retrieve servers: %s", err)
}

err = servers.ExtractServersInto(allPages, &allServers)
if err != nil {
	panic("Unable to extract servers: %s", err)
}

for _, server := range allServers {
	fmt.Println(server.DiskConfig)
}

Example of Creating a Server with Disk Config

serverCreateOpts := servers.CreateOpts{
	Name:      "server_name",
	ImageRef:  "image-uuid",
	FlavorRef: "flavor-uuid",
}

createOpts := diskconfig.CreateOptsExt{
	CreateOptsBuilder: serverCreateOpts,
	DiskConfig:        diskconfig.Manual,
}

server, err := servers.Create(computeClient, createOpts).Extract()
if err != nil {
	panic("Unable to create server: %s", err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOptsExt

type CreateOptsExt struct {
	servers.CreateOptsBuilder

	// DiskConfig [optional] controls how the created server's disk is partitioned.
	DiskConfig DiskConfig `json:"OS-DCF:diskConfig,omitempty"`
}

CreateOptsExt adds a DiskConfig option to the base CreateOpts.

func (CreateOptsExt) ToServerCreateMap

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

ToServerCreateMap adds the diskconfig option to the base server creation options.

type DiskConfig

type DiskConfig string

DiskConfig represents one of the two possible settings for the DiskConfig option when creating, rebuilding, or resizing servers: Auto or Manual.

const (
	// Auto builds a server with a single partition the size of the target flavor
	// disk and automatically adjusts the filesystem to fit the entire partition.
	// Auto may only be used with images and servers that use a single EXT3
	// partition.
	Auto DiskConfig = "AUTO"

	// Manual builds a server using whatever partition scheme and filesystem are
	// present in the source image. If the target flavor disk is larger, the
	// remaining space is left unpartitioned. This enables images to have non-EXT3
	// filesystems, multiple partitions, and so on, and enables you to manage the
	// disk configuration. It also results in slightly shorter boot times.
	Manual DiskConfig = "MANUAL"
)

type RebuildOptsExt

type RebuildOptsExt struct {
	servers.RebuildOptsBuilder

	// DiskConfig controls how the rebuilt server's disk is partitioned.
	DiskConfig DiskConfig `json:"OS-DCF:diskConfig,omitempty"`
}

RebuildOptsExt adds a DiskConfig option to the base RebuildOpts.

func (RebuildOptsExt) ToServerRebuildMap

func (opts RebuildOptsExt) ToServerRebuildMap() (map[string]interface{}, error)

ToServerRebuildMap adds the diskconfig option to the base server rebuild options.

type ResizeOptsExt

type ResizeOptsExt struct {
	servers.ResizeOptsBuilder

	// DiskConfig [optional] controls how the resized server's disk is partitioned.
	DiskConfig DiskConfig
}

ResizeOptsExt adds a DiskConfig option to the base server resize options.

func (ResizeOptsExt) ToServerResizeMap

func (opts ResizeOptsExt) ToServerResizeMap() (map[string]interface{}, error)

ToServerResizeMap adds the diskconfig option to the base server creation options.

type ServerDiskConfigExt

type ServerDiskConfigExt struct {
	// DiskConfig is the disk configuration of the server.
	DiskConfig DiskConfig `json:"OS-DCF:diskConfig"`
}

Directories

Path Synopsis
diskconfig unit tests
diskconfig unit tests

Jump to

Keyboard shortcuts

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