openstack

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OS_AUTH_URL             = "OS_AUTH_URL"
	OS_USERNAME             = "OS_USERNAME"
	OS_PASSWORD             = "OS_PASSWORD"
	OS_CACERT_DATA          = "OS_CACERT_DATA"
	OS_CACERT               = "OS_CACERT" // file path on disk
	OS_REGION_NAME          = "OS_REGION_NAME"
	OS_USER_DOMAIN_NAME     = "OS_USER_DOMAIN_NAME"
	OS_IDENTITY_API_VERSION = "OS_IDENTITY_API_VERSION"
	OS_PROJECT_NAME         = "OS_PROJECT_NAME"
	OS_PROJECT_DOMAIN_NAME  = "OS_PROJECT_DOMAIN_NAME"
)
View Source
const DuplicateResourceFound string = "More than one resource exists"
View Source
const ImageNotFound string = "No Image found"
View Source
const SecgrpDoesNotExist string = "Security group does not exist"
View Source
const SecgrpRuleAlreadyExists string = "Security group rule already exists"
View Source
const StackAlreadyExists string = "already exists"
View Source
const StackNotFound string = "Stack not found"

Variables

View Source
var AccessVarProps = map[string]*edgeproto.PropertyInfo{
	OS_AUTH_URL: {
		Name:        "Openstack auth URL",
		Description: "Openstack auth URL",
		Mandatory:   true,
	},
	OS_USERNAME: {
		Name:        "Openstack user name",
		Description: "Openstack user name",
		Mandatory:   true,
	},
	OS_PASSWORD: {
		Name:        "Openstack user password",
		Description: "Openstack user password",
		Mandatory:   true,
	},
	OS_CACERT_DATA: {
		Name:        "Certificate authority file data",
		Description: "If the Auth URL is using https and the API endpoint's certificate is privately issued, this is the issuing authority's cert that can validate the server's public cert. May be multiple certs in PEM format.",
	},
	OS_PROJECT_NAME: {
		Name:        "Openstack project name",
		Description: "Openstack project name",
	},
	OS_REGION_NAME: {
		Name:        "Openstack region name",
		Description: "Openstack region name",
	},
	OS_USER_DOMAIN_NAME: {
		Name:        "User domain name",
		Description: "User domain name",
		Value:       "default",
	},
	OS_IDENTITY_API_VERSION: {
		Name:        "Openstack server API version",
		Description: "Openstack server API version",
		Value:       "3",
	},
	OS_PROJECT_DOMAIN_NAME: {
		Name:        "Openstack project domain name",
		Description: "Openstack project domain name",
		Value:       "default",
	},
}
View Source
var CloudletSecurityGroupIDMap = make(map[string]string)

CloudletSecurityGroupIDMap is a cache of cloudlet to security group id

View Source
var OpenstackProps = map[string]*edgeproto.PropertyInfo{
	"MEX_CONSOLE_TYPE": {
		Name:        "Openstack console type",
		Description: "Openstack supported console type: novnc, xvpvnc, spice, rdp, serial, mks",
		Value:       "novnc",
	},
}
View Source
var VmGroupTemplate = `` /* 6319-byte string literal not displayed */

Functions

func GetServerNetworkIP

func GetServerNetworkIP(networks map[string][]string, netmatch string) (string, error)

func GetUserDataFromOSResource

func GetUserDataFromOSResource(ctx context.Context, stackTemplate *OSHeatStackTemplate) (map[string]string, error)

func IsUserDataSame

func IsUserDataSame(ctx context.Context, userdata1, userdata2 string) bool

func NewPlatform

func NewPlatform() platform.Platform

Types

type APIStats

type APIStats struct {
	Successful    uint64
	DiscoveryErrs uint64
	OtherErrs     uint64
}

type NeutronErrorDetail

type NeutronErrorDetail struct {
	Message string `json:"message"`
	Type    string `json:"type"`
	Detail  string `json:"detail"`
}

type NeutronErrorType

type NeutronErrorType struct {
	NeutronError NeutronErrorDetail
}

type OSAZone

type OSAZone struct {
	Name   string `json:"zone_name"`
	Status string `json:"zone_status"`
}

type OSAllocationPool

type OSAllocationPool struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type OSConsoleUrl

type OSConsoleUrl struct {
	Url string `json:"url"`
}

type OSExternalGateway

type OSExternalGateway struct {
	NetworkID        string      `json:"network_id"` //subnet of external net
	EnableSNAT       bool        `json:"enable_snat"`
	ExternalFixedIPs []OSFixedIP `json:"external_fixed_ips"` //gateway between extnet and privnet
}

func GetRouterDetailExternalGateway

func GetRouterDetailExternalGateway(rd *OSRouterDetail) (*OSExternalGateway, error)

GetRouterDetailExternalGateway is different than GetExternalGateway. This function gets the gateway interface in the subnet within external network. This is accessible from private networks to route packets to the external network. The GetExternalGateway gets the gateway for the outside network. This is for the packets to be routed out to the external network, i.e. internet.

type OSFixedIP

type OSFixedIP struct {
	SubnetID  string `json:"subnet_id"`
	IPAddress string `json:"ip_address"`
}

type OSFlavor

type OSFlavor struct {
	Name, ID                    string
	RAM, Ephemeral, VCPUs, Disk int
}

type OSFlavorDetail

type OSFlavorDetail struct {
	Name        string                     `json:"name"`
	ID          string                     `json:"id"`
	RAM         int                        `json:"ram"`
	Ephemeral   int                        `json:"OS-FLV-EXT-DATA:ephemeral"`
	VCPUs       int                        `json:"vcpus"`
	Disk        int                        `json:"disk"`
	Public      bool                       `json:"os-flavor-access:is_public"`
	Properties  map[string]string          `json:"properties"`
	Swap        util.EmptyStringJsonNumber `json:"swap"`
	RXTX_Factor util.EmptyStringJsonNumber `json:"rxtx_factor"`
}

type OSFloatingIP

type OSFloatingIP struct {
	ID                string `json:"ID"`
	Project           string `json:"Project"`
	FixedIPAddress    string `json:"Fixed IP Address"`
	Port              string `json:"Port"`
	FloatingNetwork   string `json:"Floating Network"`
	FloatingIPAddress string `json:"Floating IP Address"`
}

type OSHeatStackDetail

type OSHeatStackDetail struct {
	ID                string            `json:"id"`
	Description       string            `json:"description"`
	Parameters        map[string]string `json:"parameters"`
	StackStatusReason string            `json:"stack_status_reason"`
	StackName         string            `json:"stack_name"`
	StackStatus       string            `json:"stack_status"`
}

type OSHeatStackTemplate

type OSHeatStackTemplate struct {
	Resources map[string]OSStackResource `json:"resources" yaml:"resources"`
}

type OSImage

type OSImage struct {
	Status, ID, Name string
}

type OSImageDetail

type OSImageDetail struct {
	Name       string                 `json:"name"`
	Status     string                 `json:"status"`
	ID         string                 `json:"id"`
	UpdatedAt  string                 `json:"updated_at"`
	Checksum   string                 `json:"checksum"`
	Tags       string                 `json:"tags"`
	Properties map[string]interface{} `json:"properties"`
	DiskFormat string                 `json:"disk_format"`
}

type OSLimit

type OSLimit struct {
	Name  string
	Value int
}

type OSMetricMeasurement

type OSMetricMeasurement struct {
	Timestamp   string  `json:"timestamp"`
	Value       float64 `json:"value"`
	Granularity float64 `json:"granularity"`
}

Ceilometer-based tsdb measurements

type OSMetricResource

type OSMetricResource struct {
	StartedAt          string `json:"started_at"`
	UserID             string `json:"user_id"`
	RevisionEnd        string `json:"revision_end"`
	Creator            string `json:"creator"`
	RevisionStart      string `json:"revision_start"`
	InstanceId         string `json:"instance_id"`
	OriginalResourceId string `json:"original_resource_id"`
	EndedAt            string `json:"ended_at"`
	ProjectId          string `json:"project_id"`
	Type               string `json:"type"`
	Id                 string `json:"id"`
	Name               string `json:"name"`
}

instance_network_interface details

type OSNetwork

type OSNetwork struct {
	ID, Name string
	Subnets  []string
}

type OSNetworkDetail

type OSNetworkDetail struct {
	ID                      string   `json:"id"`
	Name                    string   `json:"name"`
	ProviderPhysicalNetwork string   `json:"provider:physical_network"`
	IPv6AddressScope        string   `json:"ipv6_address_scope"`
	DNSDomain               string   `json:"dns_domain"`
	IsVLANTransparent       bool     `json:"is_vlan_transparent"`
	ProviderNetworkType     string   `json:"provider:network_type"`
	External                bool     `json:"router:external"`
	AvailabilityZones       []string `json:"availability_zones"`
	Segments                string   `json:"segments"`
	IPv4AddressScope        string   `json:"ipv4_address_scope"`
	ProjectID               string   `json:"project_id"`
	Status                  string   `json:"status"`
	Subnets                 []string `json:"subnets"`
	Description             string   `json:"description"`
	UpdatedAt               string   `json:"updated_at"`
	ProviderSegmentationID  int      `json:"provider:segmentation_id"`
	QOSPolicyID             string   `json:"qos_policy_id"`
	AdminStateUp            bool     `json:"admin_state_up"`
	CreatedAt               string   `json:"created_at"`
	RevisionNumber          int      `json:"revision_number"`
	MTU                     int      `json:"mtu"`
	PortSecurityEnabled     bool     `json:"port_security_enabled"`
	Shared                  bool     `json:"shared"`
	IsDefault               bool     `json:"is_default"`
}

type OSPort

type OSPort struct {
	ID         string      `json:"ID"`
	Name       string      `json:"Name"`
	Status     string      `json:"Status"`
	MACAddress string      `json:"MAC Address"`
	FixedIPs   []OSFixedIP `json:"Fixed IP Addresses"`
}

type OSPortDetail

type OSPortDetail struct {
	ID         string      `json:"id"`
	Name       string      `json:"name"`
	DeviceID   string      `json:"device_id"`
	Status     string      `json:"status"`
	MACAddress string      `json:"mac_address"`
	FixedIPs   []OSFixedIP `json:"fixed_ips"`
}

type OSProject

type OSProject struct {
	ID   string `json:"ID"`
	Name string `json:"Name"`
}

type OSRouter

type OSRouter struct {
	Name, ID, Status, State, Project string
	HA, Distributed                  bool
}

type OSRouterDetail

type OSRouterDetail struct {
	ID                  string `json:"id"`
	Name                string `json:"name"`
	ExternalGatewayInfo string `json:"external_gateway_info"`
	Status              string `json:"status"`
	Description         string `json:"description"`
	CreatedAt           string `json:"created_at"`
	UpdatedAt           string `json:"updated_at"`
	InterfacesInfo      string `json:"interfaces_info"`
	ProjectID           string `json:"project_id"`
	FlavorID            string `json:"flavor_id"`
	Routes              string `json:"routes"`
	Distributed         bool   `json:"distributed"`
	HA                  bool   `json:"ha"`
	RevisionNumber      int    `json:"revision_number"`
}

type OSRouterInterface

type OSRouterInterface struct {
	SubnetID  string `json:"subnet_id"`  //attached privnet
	IPAddress string `json:"ip_address"` //router for the privnet side on the subnet CIDR, usually X.X.X.1  but should really confirm by reading this
	PortID    string `json:"port_id"`
}

func GetRouterDetailInterfaces

func GetRouterDetailInterfaces(ctx context.Context, rd *OSRouterDetail) ([]OSRouterInterface, error)

GetRouterDetailInterfaces gets the list of interfaces on the router. For example, each private subnet connected to the router will be listed here with own interface definition.

type OSSecurityGroup

type OSSecurityGroup struct {
	ID      string `json:"ID"`
	Project string `json:"Project"`
	Name    string `json:"Name"`
}

type OSSecurityGroupName

type OSSecurityGroupName struct {
	Name string `json:"name"`
}

type OSSecurityGroupRule

type OSSecurityGroupRule struct {
	ID        string `json:"ID"`
	IPRange   string `json:"IP Range"`
	PortRange string `json:"Port Range"`
	Protocol  string `json:"IP Protocol"`
}

type OSServer

type OSServer struct {
	Status   string
	Name     string
	Image    string
	ID       string
	Flavor   string
	Networks map[string][]string // network name to ip list
}

type OSServerDetail

type OSServerDetail struct {
	TaskState        string                 `json:"OS-EXT-STS:task_state"`
	Addresses        map[string][]string    `json:"addresses"`
	Image            string                 `json:"image"`
	VMState          string                 `json:"OS-EXT-STS:vm_state"`
	LaunchedAt       string                 `json:"OS-SRV-USG:launched_at"`
	Flavor           string                 `json:"flavor"`
	ID               string                 `json:"id"`
	SecurityGroups   []OSSecurityGroupName  `json:"security_groups"`
	UserID           string                 `json:"user_id"`
	DiskConfig       string                 `json:"OS-DCF:diskConfig"`
	AccessIPv4       string                 `json:"accessIPv4"`
	AccessIPv6       string                 `json:"accessIPv6"`
	Progress         int                    `json:"progress"`
	PowerState       int                    `json:"OS-EXT-STS:power_state"`
	ProjectID        string                 `json:"project_id"`
	ConfigDrive      string                 `json:"config_drive"`
	Status           string                 `json:"status"`
	Updated          string                 `json:"updated"`
	HostID           string                 `json:"hostId"`
	TerminatedAt     string                 `json:"OS-SRV-USG:terminated_at"`
	KeyName          string                 `json:"key_name"`
	AvailabilityZone string                 `json:"OS-EXT-AZ:availability_zone"`
	Name             string                 `json:"name"`
	Created          string                 `json:"created"`
	Properties       map[string]interface{} `json:"properties"`
}

type OSServerOpt

type OSServerOpt struct {
	AvailabilityZone    string //XXX not used yet
	Name, Image, Flavor string
	UserData            string
	NetIDs              []string
	Properties          []string
}

type OSStackResource

type OSStackResource struct {
	Type       string                 `json:"type" yaml:"type"`
	Properties map[string]interface{} `json:"properties" yaml:"properties"`
}

type OSSubnet

type OSSubnet struct {
	Name, ID, Network, Subnet string
}

type OSSubnetDetail

type OSSubnetDetail struct {
	ID              string             `json:"id"`
	Name            string             `json:"name"`
	Description     string             `json:"description"`
	EnableDHCP      bool               `json:"enable_dhcp"`
	SegmentID       string             `json:"segment_id"`
	NetworkID       string             `json:"network_id"`
	CreatedAt       string             `json:"created_at"`
	DNSNameServers  []string           `json:"dns_nameservers"`
	UpdatedAt       string             `json:"updated_at"`
	IPv6RAMode      string             `json:"ipv6_ra_mode"`
	AllocationPools []OSAllocationPool `json:"allocation_pools"`
	GatewayIP       string             `json:"gateway_ip"`
	RevisionNumber  int                `json:"revision_number"`
	IPv6AddressMode string             `json:"ipv6_address_mode"`
	IPVersion       int                `json:"ip_version"`
	CIDR            string             `json:"cidr"`
	ProjectID       string             `json:"project_id"`
	SubnetPoolID    string             `json:"subnetpool_id"`
}

type OpenstackPlatform

type OpenstackPlatform struct {
	VMProperties *vmlayer.VMProperties
	// contains filtered or unexported fields
}

func (OpenstackPlatform) ActiveChanged

func (o OpenstackPlatform) ActiveChanged(ctx context.Context, platformActive bool) error

func (*OpenstackPlatform) AddImageIfNotPresent

func (o *OpenstackPlatform) AddImageIfNotPresent(ctx context.Context, imageInfo *infracommon.ImageInfo, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) AddRouterSubnet

func (s *OpenstackPlatform) AddRouterSubnet(ctx context.Context, routerName, subnetName string) error

AddRouterSubnet will connect subnet to another network, possibly external, via a router

func (*OpenstackPlatform) AddSecurityRuleCIDR

func (s *OpenstackPlatform) AddSecurityRuleCIDR(ctx context.Context, cidr string, proto string, groupName string, port string) error

func (*OpenstackPlatform) AddSecurityRulesForRemoteGroup

func (o *OpenstackPlatform) AddSecurityRulesForRemoteGroup(ctx context.Context, groupId, remoteGroupId, protocol, direction string) error

func (*OpenstackPlatform) AttachPortToServer

func (s *OpenstackPlatform) AttachPortToServer(ctx context.Context, serverName string, subnetNames vmlayer.SubnetNames, portName string, ips infracommon.IPs, action vmlayer.ActionType) error

AttachPortToServer attaches a port to a server

func (*OpenstackPlatform) AttachSecurityGroupToPort

func (s *OpenstackPlatform) AttachSecurityGroupToPort(ctx context.Context, portID, groupName string) error

func (*OpenstackPlatform) CheckServerReady

func (s *OpenstackPlatform) CheckServerReady(ctx context.Context, client ssh.Client, serverName string) error

func (*OpenstackPlatform) ConfigureCloudletSecurityRules

func (o *OpenstackPlatform) ConfigureCloudletSecurityRules(ctx context.Context, egressRestricted bool, TrustPolicy *edgeproto.TrustPolicy, rootLbClients map[string]platform.RootLBClient, action vmlayer.ActionType, updateCallback edgeproto.CacheUpdateCallback) error

PrepareCloudletSecurityGroup creates the cloudlet group if it does not exist and ensures that the remote-group rules are present to allow platform components to communicate

func (*OpenstackPlatform) ConfigureTrustPolicyExceptionSecurityRules

func (o *OpenstackPlatform) ConfigureTrustPolicyExceptionSecurityRules(ctx context.Context, TrustPolicyException *edgeproto.TrustPolicyException, rootLbClients map[string]platform.RootLBClient, action vmlayer.ActionType, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) CreateHeatStackFromTemplate

func (o *OpenstackPlatform) CreateHeatStackFromTemplate(ctx context.Context, templateData interface{}, stackName, templateString string, updateCallback edgeproto.CacheUpdateCallback) error

CreateHeatStackFromTemplate fills the template from templateData and creates the stack

func (*OpenstackPlatform) CreateImage

func (s *OpenstackPlatform) CreateImage(ctx context.Context, imageName, fileName string) error

CreateImage puts images into glance

func (*OpenstackPlatform) CreateImageFromUrl

func (s *OpenstackPlatform) CreateImageFromUrl(ctx context.Context, imageName, imageUrl, md5Sum string) error

CreateImageFromUrl downloads image from URL and then puts into glance

func (*OpenstackPlatform) CreateNetwork

func (s *OpenstackPlatform) CreateNetwork(ctx context.Context, name, netType, availabilityZone string) error

CreateNetwork creates a network with a name.

func (*OpenstackPlatform) CreateOrUpdateCloudletSecgrpStack

func (o *OpenstackPlatform) CreateOrUpdateCloudletSecgrpStack(ctx context.Context, egressRestricted bool, TrustPolicy *edgeproto.TrustPolicy, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) CreateOrUpdateSecgrpStack

func (o *OpenstackPlatform) CreateOrUpdateSecgrpStack(ctx context.Context, grpName string, egressRestricted bool, rules []edgeproto.SecurityRule, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) CreateOrUpdateTrustPolicyExceptionSecgrpStack

func (o *OpenstackPlatform) CreateOrUpdateTrustPolicyExceptionSecgrpStack(ctx context.Context, egressRestricted bool, TrustPolicyException *edgeproto.TrustPolicyException, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) CreateRouter

func (s *OpenstackPlatform) CreateRouter(ctx context.Context, routerName string) error

CreateRouter creates new router. A router can be attached to network and subnets.

func (*OpenstackPlatform) CreateSecurityGroup

func (s *OpenstackPlatform) CreateSecurityGroup(ctx context.Context, groupName string) error

func (*OpenstackPlatform) CreateServer

func (s *OpenstackPlatform) CreateServer(ctx context.Context, opts *OSServerOpt) error

CreateServer instantiates a new server instance, which is a KVM instance based on a qcow2 image from glance

func (*OpenstackPlatform) CreateServerImage

func (s *OpenstackPlatform) CreateServerImage(ctx context.Context, serverName, imageName string) error

CreateServerImage snapshots running service into a qcow2 image

func (*OpenstackPlatform) CreateSubnet

func (s *OpenstackPlatform) CreateSubnet(ctx context.Context, netRange, networkName, gatewayAddr, subnetName string, dhcpEnable bool) error

CreateSubnet creates a subnet within a network. A subnet is assigned ranges. Optionally DHCP can be enabled.

func (*OpenstackPlatform) CreateVMs

func (o *OpenstackPlatform) CreateVMs(ctx context.Context, vmGroupOrchestrationParams *vmlayer.VMGroupOrchestrationParams, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) DeleteCloudletSecgrpStack

func (o *OpenstackPlatform) DeleteCloudletSecgrpStack(ctx context.Context, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) DeleteImage

func (s *OpenstackPlatform) DeleteImage(ctx context.Context, folder, imageName string) error

DeleteImage deletes the named image from glance. Sometimes backing store is still busy and will refuse to honor the request. Like most things in Openstack, wait for a while and try again.

func (*OpenstackPlatform) DeleteNetwork

func (s *OpenstackPlatform) DeleteNetwork(ctx context.Context, name string) error

DeleteNetwork destroys a named network

Sometimes it will fail. Openstack will refuse if there are resources attached.

func (*OpenstackPlatform) DeleteResources

func (o *OpenstackPlatform) DeleteResources(ctx context.Context, resourceGroupName string) error

func (*OpenstackPlatform) DeleteRouter

func (s *OpenstackPlatform) DeleteRouter(ctx context.Context, routerName string) error

DeleteRouter removes the named router. The router needs to not be in use at the time of deletion.

func (*OpenstackPlatform) DeleteSecurityGroupRule

func (s *OpenstackPlatform) DeleteSecurityGroupRule(ctx context.Context, ruleID string) error

func (*OpenstackPlatform) DeleteServer

func (s *OpenstackPlatform) DeleteServer(ctx context.Context, id string) error

DeleteServer destroys a KVM instance

sometimes it is not possible to destroy. Like most things in Openstack, try again.

func (*OpenstackPlatform) DeleteSubnet

func (s *OpenstackPlatform) DeleteSubnet(ctx context.Context, subnetName string) error

DeleteSubnet deletes the subnet. If this fails, remove any attached resources, like router, and try again.

func (*OpenstackPlatform) DeleteTrustPolicyExceptionSecgrpStack

func (o *OpenstackPlatform) DeleteTrustPolicyExceptionSecgrpStack(ctx context.Context, tpeKey *edgeproto.TrustPolicyExceptionKey, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) DeleteVMs

func (o *OpenstackPlatform) DeleteVMs(ctx context.Context, vmGroupName, ownerID string) error

func (*OpenstackPlatform) DetachPortFromServer

func (s *OpenstackPlatform) DetachPortFromServer(ctx context.Context, serverName string, subnetNames vmlayer.SubnetNames, portName string) error

DetachPortFromServer removes a port from a server

func (*OpenstackPlatform) DetachSecurityGroupFromPort

func (s *OpenstackPlatform) DetachSecurityGroupFromPort(ctx context.Context, portID, groupName string) error

func (*OpenstackPlatform) GatherCloudletInfo

func (o *OpenstackPlatform) GatherCloudletInfo(ctx context.Context, info *edgeproto.CloudletInfo) error

func (*OpenstackPlatform) GetActiveServerDetails

func (s *OpenstackPlatform) GetActiveServerDetails(ctx context.Context, name string) (*OSServerDetail, error)

GetActiveServerDetails returns details of the KVM instance waiting for it to be ACTIVE

func (*OpenstackPlatform) GetApiEndpointAddr

func (o *OpenstackPlatform) GetApiEndpointAddr(ctx context.Context) (string, error)

func (*OpenstackPlatform) GetCloudletImageSuffix

func (o *OpenstackPlatform) GetCloudletImageSuffix(ctx context.Context) string

func (*OpenstackPlatform) GetCloudletInfraResourcesInfo

func (o *OpenstackPlatform) GetCloudletInfraResourcesInfo(ctx context.Context) ([]edgeproto.InfraResource, error)

func (*OpenstackPlatform) GetCloudletManifest

func (o *OpenstackPlatform) GetCloudletManifest(ctx context.Context, name string, cloudletImagePath string, vmgp *vmlayer.VMGroupOrchestrationParams) (string, error)

func (*OpenstackPlatform) GetCloudletProjectName

func (o *OpenstackPlatform) GetCloudletProjectName() string

func (*OpenstackPlatform) GetCloudletSubnets

func (o *OpenstackPlatform) GetCloudletSubnets(ctx context.Context) ([]string, error)

GetCloudletSubnets returns subnets inside MEX Network

func (*OpenstackPlatform) GetClusterAdditionalResourceMetric

func (o *OpenstackPlatform) GetClusterAdditionalResourceMetric(ctx context.Context, cloudlet *edgeproto.Cloudlet, resMetric *edgeproto.Metric, resources []edgeproto.VMResource) error

func (*OpenstackPlatform) GetClusterAdditionalResources

func (o *OpenstackPlatform) GetClusterAdditionalResources(ctx context.Context, cloudlet *edgeproto.Cloudlet, vmResources []edgeproto.VMResource, infraResMap map[string]edgeproto.InfraResource) map[string]edgeproto.InfraResource

called by controller, make sure it doesn't make any calls to infra API

func (*OpenstackPlatform) GetConsoleType

func (o *OpenstackPlatform) GetConsoleType() string

func (*OpenstackPlatform) GetConsoleUrl

func (o *OpenstackPlatform) GetConsoleUrl(ctx context.Context, serverName string) (string, error)

func (*OpenstackPlatform) GetExternalGateway

func (s *OpenstackPlatform) GetExternalGateway(ctx context.Context, extNetName string) (string, error)

GetExternalGateway retrieves Gateway IP from the external network information. It first gets external

network information. Using that it further gets subnet information. Inside that subnet information
there should be gateway IP if the network is set up correctly.

Not to be confused with GetRouterDetailExternalGateway.

func (*OpenstackPlatform) GetFeatures

func (o *OpenstackPlatform) GetFeatures() *edgeproto.PlatformFeatures

func (*OpenstackPlatform) GetFlavorInfo

func (s *OpenstackPlatform) GetFlavorInfo(ctx context.Context) ([]*edgeproto.FlavorInfo, []OSAZone, []OSImage, error)

func (*OpenstackPlatform) GetFlavorList

func (o *OpenstackPlatform) GetFlavorList(ctx context.Context) ([]*edgeproto.FlavorInfo, error)

func (*OpenstackPlatform) GetGPUSetupStage

func (p *OpenstackPlatform) GetGPUSetupStage(ctx context.Context) vmlayer.GPUSetupStage

func (*OpenstackPlatform) GetImageDetail

func (s *OpenstackPlatform) GetImageDetail(ctx context.Context, name string) (*OSImageDetail, error)

GetImageDetail show of a given image from Glance

func (*OpenstackPlatform) GetInternalCIDR

func (s *OpenstackPlatform) GetInternalCIDR(name string, srvs []OSServer) (string, error)

GetInternalCIDR returns CIDR of server

func (*OpenstackPlatform) GetInternalIP

func (s *OpenstackPlatform) GetInternalIP(name string, srvs []OSServer) (string, error)

GetInternalIP returns IP of the server

func (*OpenstackPlatform) GetInternalPortPolicy

func (o *OpenstackPlatform) GetInternalPortPolicy() vmlayer.InternalPortAttachPolicy

func (*OpenstackPlatform) GetNetworkDetail

func (o *OpenstackPlatform) GetNetworkDetail(ctx context.Context, networkName string) (*vmlayer.NetworkDetail, error)

func (*OpenstackPlatform) GetNetworkList

func (o *OpenstackPlatform) GetNetworkList(ctx context.Context) ([]string, error)

func (*OpenstackPlatform) GetNumberOfFloatingIps

func (s *OpenstackPlatform) GetNumberOfFloatingIps(ctx context.Context) (int, int, error)

GetNumberOfFloatingIps returns allocated,used

func (*OpenstackPlatform) GetOSNetworkDetail

func (s *OpenstackPlatform) GetOSNetworkDetail(ctx context.Context, networkName string) (*OSNetworkDetail, error)

GetNetworkDetail returns details about a network. It is used, for example, by GetExternalGateway.

func (*OpenstackPlatform) GetOpenRCVars

func (o *OpenstackPlatform) GetOpenRCVars(ctx context.Context, accessApi platform.AccessApi) error

func (*OpenstackPlatform) GetOpenStackRouterDetail

func (s *OpenstackPlatform) GetOpenStackRouterDetail(ctx context.Context, routerName string) (*OSRouterDetail, error)

GetRouterDetail returns details per router

func (*OpenstackPlatform) GetOpenstackServerDetails

func (s *OpenstackPlatform) GetOpenstackServerDetails(ctx context.Context, name string) (*OSServerDetail, error)

func (*OpenstackPlatform) GetPlatformResourceInfo

func (s *OpenstackPlatform) GetPlatformResourceInfo(ctx context.Context) (*vmlayer.PlatformResources, error)

func (*OpenstackPlatform) GetPortDetails

func (s *OpenstackPlatform) GetPortDetails(ctx context.Context, name string) (*OSPortDetail, error)

GetPortDetails gets details of the specified port

func (*OpenstackPlatform) GetResourceID

func (o *OpenstackPlatform) GetResourceID(ctx context.Context, resourceType vmlayer.ResourceType, resourceName string) (string, error)

func (*OpenstackPlatform) GetRouterDetail

func (o *OpenstackPlatform) GetRouterDetail(ctx context.Context, routerName string) (*vmlayer.RouterDetail, error)

func (*OpenstackPlatform) GetSecurityGroupIDForName

func (s *OpenstackPlatform) GetSecurityGroupIDForName(ctx context.Context, groupName string) (string, error)

GetSecurityGroupIDForName gets the group ID for the given security group name. It handles duplicate names by finding the one for the project.

func (*OpenstackPlatform) GetSecurityGroupIDForProject

func (s *OpenstackPlatform) GetSecurityGroupIDForProject(ctx context.Context, grpname string, projectID string) (string, error)

func (*OpenstackPlatform) GetServerDetail

func (o *OpenstackPlatform) GetServerDetail(ctx context.Context, serverName string) (*vmlayer.ServerDetail, error)

func (*OpenstackPlatform) GetServerExternalIP

func (o *OpenstackPlatform) GetServerExternalIP(networks map[string][]string) (string, error)

func (*OpenstackPlatform) GetServerGroupResources

func (o *OpenstackPlatform) GetServerGroupResources(ctx context.Context, name string) (*edgeproto.InfraResources, error)

func (*OpenstackPlatform) GetServerInternalIP

func (o *OpenstackPlatform) GetServerInternalIP(networks map[string][]string) (string, error)

func (*OpenstackPlatform) GetSubnetDetail

func (s *OpenstackPlatform) GetSubnetDetail(ctx context.Context, subnetName string) (*OSSubnetDetail, error)

GetSubnetDetail returns details for the subnet. This is useful when getting router/gateway

IP for a given subnet.  The gateway info is used for creating a server.
Also useful in general, like other `detail` functions, to get the ID map for the name of subnet.

func (*OpenstackPlatform) GetVMStats

func (s *OpenstackPlatform) GetVMStats(ctx context.Context, appInst *edgeproto.AppInst) (*vmlayer.VMMetrics, error)

func (*OpenstackPlatform) GetVMSubnetDetail

func (o *OpenstackPlatform) GetVMSubnetDetail(ctx context.Context, ossd *OSSubnetDetail) (*vmlayer.SubnetDetail, error)

func (*OpenstackPlatform) HeatCreateVMs

func (o *OpenstackPlatform) HeatCreateVMs(ctx context.Context, VMGroupOrchestrationParams *vmlayer.VMGroupOrchestrationParams, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) HeatDeleteStack

func (o *OpenstackPlatform) HeatDeleteStack(ctx context.Context, stackName string) error

HeatDeleteStack deletes the VM resources

func (*OpenstackPlatform) HeatUpdateVMs

func (o *OpenstackPlatform) HeatUpdateVMs(ctx context.Context, VMGroupOrchestrationParams *vmlayer.VMGroupOrchestrationParams, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) IdSanitize

func (o *OpenstackPlatform) IdSanitize(name string) string

Openstack IdSanitize is the same as NameSanitize

func (*OpenstackPlatform) InitApiAccessProperties

func (o *OpenstackPlatform) InitApiAccessProperties(ctx context.Context, accessApi platform.AccessApi, vars map[string]string) error

func (*OpenstackPlatform) InitData

func (o *OpenstackPlatform) InitData(ctx context.Context, caches *platform.Caches)

func (*OpenstackPlatform) InitOperationContext

func (*OpenstackPlatform) InitProvider

func (o *OpenstackPlatform) InitProvider(ctx context.Context, caches *platform.Caches, stage vmlayer.ProviderInitStage, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) InitResourceReservations

func (o *OpenstackPlatform) InitResourceReservations(ctx context.Context)

func (*OpenstackPlatform) InternalCloudletUpdatedCallback

func (p *OpenstackPlatform) InternalCloudletUpdatedCallback(ctx context.Context, old *edgeproto.CloudletInternal, new *edgeproto.CloudletInternal)

func (*OpenstackPlatform) ListAZones

func (s *OpenstackPlatform) ListAZones(ctx context.Context) ([]OSAZone, error)

func (*OpenstackPlatform) ListFlavors

func (s *OpenstackPlatform) ListFlavors(ctx context.Context) ([]OSFlavorDetail, error)

ListFlavors lists flavors known to the platform. The ones matching the flavorMatchPattern are returned

func (*OpenstackPlatform) ListFloatingIPs

func (s *OpenstackPlatform) ListFloatingIPs(ctx context.Context, network string) ([]OSFloatingIP, error)

func (*OpenstackPlatform) ListImages

func (s *OpenstackPlatform) ListImages(ctx context.Context) ([]OSImage, error)

ListImages lists avilable images in glance

func (*OpenstackPlatform) ListImagesDetail

func (s *OpenstackPlatform) ListImagesDetail(ctx context.Context) ([]OSImageDetail, error)

fetch tags + properties etc of all images for resource mapping

func (*OpenstackPlatform) ListNetworks

func (s *OpenstackPlatform) ListNetworks(ctx context.Context) ([]OSNetwork, error)

ListNetworks lists networks known to the platform. Some created by the operator, some by users.

func (*OpenstackPlatform) ListPorts

func (s *OpenstackPlatform) ListPorts(ctx context.Context) ([]OSPort, error)

ListPorts returns a list of ports

func (*OpenstackPlatform) ListPortsServer

func (s *OpenstackPlatform) ListPortsServer(ctx context.Context, server string) ([]OSPort, error)

ListPortsServerNetwork returns ports for a particular server on any network

func (*OpenstackPlatform) ListPortsServerNetwork

func (s *OpenstackPlatform) ListPortsServerNetwork(ctx context.Context, server, network string) ([]OSPort, error)

ListPortsServerNetwork returns ports for a particular server on a given network

func (*OpenstackPlatform) ListProjects

func (s *OpenstackPlatform) ListProjects(ctx context.Context) ([]OSProject, error)

ListProjects returns a list of projects we can see

func (*OpenstackPlatform) ListRouters

func (s *OpenstackPlatform) ListRouters(ctx context.Context) ([]OSRouter, error)

ListRouters returns a list of routers available

func (*OpenstackPlatform) ListSecurityGroupRules

func (s *OpenstackPlatform) ListSecurityGroupRules(ctx context.Context, secGrp string) ([]OSSecurityGroupRule, error)

ListSecurityGroups returns a list of security groups

func (*OpenstackPlatform) ListSecurityGroups

func (s *OpenstackPlatform) ListSecurityGroups(ctx context.Context) ([]OSSecurityGroup, error)

ListSecurityGroups returns a list of security groups

func (*OpenstackPlatform) ListServers

func (s *OpenstackPlatform) ListServers(ctx context.Context) (map[string]OSServer, error)

ListServers returns a map of servers keyed by name

func (*OpenstackPlatform) ListSubnets

func (s *OpenstackPlatform) ListSubnets(ctx context.Context, netName string) ([]OSSubnet, error)

ListSubnets returns a list of subnets available

func (*OpenstackPlatform) NameSanitize

func (o *OpenstackPlatform) NameSanitize(name string) string

alphanumeric plus -_. first char must be alpha, <= 255 chars.

func (*OpenstackPlatform) OSFindResourceByInstId

func (s *OpenstackPlatform) OSFindResourceByInstId(ctx context.Context, resourceType, instId, name string) (*OSMetricResource, error)

Finds a resource by name by instance id. There are resources that are metered for instance-id, which are resources of their own The examples are instance_network_interface and instance_disk Openstack example call:

<openstack metric resource search --type instance_network_interface instance_id=dc32daa6-0d0a-4512-a9fa-2b989e913014>

We only use the the first found result

func (*OpenstackPlatform) OSGetAllLimits

func (s *OpenstackPlatform) OSGetAllLimits(ctx context.Context) ([]OSLimit, error)

func (*OpenstackPlatform) OSGetConsoleUrl

func (s *OpenstackPlatform) OSGetConsoleUrl(ctx context.Context, serverName string) (*OSConsoleUrl, error)

func (*OpenstackPlatform) OSGetLimits

func (s *OpenstackPlatform) OSGetLimits(ctx context.Context, info *edgeproto.CloudletInfo) error

Get resource limits

func (*OpenstackPlatform) OSGetMetricsRangeForId

func (s *OpenstackPlatform) OSGetMetricsRangeForId(ctx context.Context, resId string, metric string, startTime time.Time) ([]OSMetricMeasurement, error)

Get openstack metrics from ceilometer tsdb Example openstack call:

<openstack metric measures show --resource-id a9bf10cf-a709-5a47-8b69-da920b8f65cd network.incoming.bytes>

This will return a range of measurements from the startTime

func (*OpenstackPlatform) PrepNetwork

func (o *OpenstackPlatform) PrepNetwork(ctx context.Context, updateCallback edgeproto.CacheUpdateCallback) error

PrepNetwork validates and does the work needed to ensure MEX network setup

func (*OpenstackPlatform) PrepareRootLB

func (o *OpenstackPlatform) PrepareRootLB(ctx context.Context, client ssh.Client, rootLBName string, secGrpName string, TrustPolicy *edgeproto.TrustPolicy, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) RemoveDuplicateImages

func (o *OpenstackPlatform) RemoveDuplicateImages(ctx context.Context, imageName string) error

RemoveDuplicateImages is called when more than one image is found with the same name. This can happen in rare situations in which the an app was created twice at the same time on the same cloudlet (no longer possible due as this condition is now checked in PerformOrchestrationForVMApp), or if there are 2 cloudlets using the same openstack tenant (still possible in labs and PoC deployments) Cleanup logic is as follows:

  • The first "active" image found is retained
  • All images not in "active" state are removed. This could result in no images at all being left but at least this is a recoverable situation

func (*OpenstackPlatform) RemoveRouterSubnet

func (s *OpenstackPlatform) RemoveRouterSubnet(ctx context.Context, routerName, subnetName string) error

RemoveRouterSubnet is useful to remove the router from the subnet before deletion. Otherwise subnet cannot

be deleted.

func (*OpenstackPlatform) RemoveWhitelistSecurityRules

func (o *OpenstackPlatform) RemoveWhitelistSecurityRules(ctx context.Context, client ssh.Client, wlParams *infracommon.WhiteListParams) error

func (*OpenstackPlatform) SaveImage

func (s *OpenstackPlatform) SaveImage(ctx context.Context, saveName, imageName string) error

SaveImage takes the image name available in glance, as a result of for example the above create image. It will then save that into a local file. The image transfer happens from glance into your own laptop or whatever. This can take a while, transferring all the data.

func (*OpenstackPlatform) SetPowerState

func (s *OpenstackPlatform) SetPowerState(ctx context.Context, serverName, serverAction string) error

func (*OpenstackPlatform) SetRouter

func (s *OpenstackPlatform) SetRouter(ctx context.Context, routerName, networkName string) error

SetRouter assigns the router to a particular network. The network needs to be attached to a real external network. This is intended only for routing to external network for now. No internal routers. Sometimes, oftentimes, it will fail if the network is not external.

func (*OpenstackPlatform) SetServerProperty

func (s *OpenstackPlatform) SetServerProperty(ctx context.Context, name, property string) error

SetServerProperty sets properties for the server

func (*OpenstackPlatform) SetVMProperties

func (o *OpenstackPlatform) SetVMProperties(vmProperties *vmlayer.VMProperties)

func (*OpenstackPlatform) ShowFlavor

func (s *OpenstackPlatform) ShowFlavor(ctx context.Context, flavor string) (details OSFlavorDetail, err error)

ShowFlavor returns the details of a given flavor.

func (*OpenstackPlatform) TimedOpenStackCommand

func (s *OpenstackPlatform) TimedOpenStackCommand(ctx context.Context, name string, a ...string) ([]byte, error)

func (*OpenstackPlatform) UpdateHeatStackFromTemplate

func (o *OpenstackPlatform) UpdateHeatStackFromTemplate(ctx context.Context, templateData interface{}, stackName, templateString string, updateCallback edgeproto.CacheUpdateCallback) error

UpdateHeatStackFromTemplate fills the template from templateData and creates the stack

func (*OpenstackPlatform) UpdateServerIPs

func (o *OpenstackPlatform) UpdateServerIPs(ctx context.Context, addresses map[string][]string, ports []OSPort, serverDetail *vmlayer.ServerDetail) error

UpdateServerIPs gets the ServerIPs for the given network from the addresses and ports

func (*OpenstackPlatform) UpdateVMs

func (o *OpenstackPlatform) UpdateVMs(ctx context.Context, VMGroupOrchestrationParams *vmlayer.VMGroupOrchestrationParams, updateCallback edgeproto.CacheUpdateCallback) error

func (*OpenstackPlatform) ValidateAdditionalNetworks

func (o *OpenstackPlatform) ValidateAdditionalNetworks(ctx context.Context, additionalNets map[string]vmlayer.NetworkType) error

ValidateAdditionalNetworks ensures that any specified additional networks have just one subnet with no default GW and DHCP must be enabled

func (*OpenstackPlatform) ValidateNetwork

func (o *OpenstackPlatform) ValidateNetwork(ctx context.Context) error

func (*OpenstackPlatform) VerifyVMs

func (s *OpenstackPlatform) VerifyVMs(ctx context.Context, vms []edgeproto.VM) error

func (*OpenstackPlatform) VmAppChangedCallback

func (o *OpenstackPlatform) VmAppChangedCallback(ctx context.Context, appInst *edgeproto.AppInst, newState edgeproto.TrackedState)

func (*OpenstackPlatform) WhitelistSecurityRules

func (o *OpenstackPlatform) WhitelistSecurityRules(ctx context.Context, client ssh.Client, wlParams *infracommon.WhiteListParams) error

type OpenstackResources

type OpenstackResources struct {
	InstancesUsed   uint64
	SecGrpsUsed     uint64
	FloatingIPsUsed uint64
}

type ReservedResources

type ReservedResources struct {
	FloatingIpIds map[string]string
	Subnets       map[string]string
}

Jump to

Keyboard shortcuts

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