vcd

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: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VCD_USER                    = "VCD_USER"
	VCD_PASSWORD                = "VCD_PASSWORD"
	VCD_ORG                     = "VCD_ORG"
	VCD_URL                     = "VCD_URL"
	VDC_NAME                    = "VDC_NAME"
	VCD_OAUTH_SGW_URL           = "VCD_OAUTH_SGW_URL"
	VCD_OAUTH_AGW_URL           = "VCD_OAUTH_AGW_URL"
	VCD_OAUTH_CLIENT_ID         = "VCD_OAUTH_CLIENT_ID"
	VCD_OAUTH_CLIENT_SECRET     = "VCD_OAUTH_CLIENT_SECRET"
	VCD_CLIENT_TLS_CERT         = "VCD_CLIENT_TLS_CERT"
	VCD_CLIENT_TLS_KEY          = "VCD_CLIENT_TLS_KEY"
	VCD_CLIENT_REFRESH_INTERVAL = "VCD_CLIENT_REFRESH_INTERVAL"
	VCD_INSECURE                = "VCD_INSECURE"
)
View Source
const ClientId = "client_id"
View Source
const ClientSecret = "client_secret"
View Source
const ContentFormUrlEncoded = "application/x-www-form-urlencoded"
View Source
const CurrentVmMetrics string = "application/vnd.vmware.vcloud.metrics.currentUsageSpec+xml"
View Source
const GrantType = "grant_type"
View Source
const GrantTypeCert = "CERT"
View Source
const InternalNetMax = 100
View Source
const InternalVappDedicatedSubnet = "10.101.1.1"
View Source
const MaxSubnetsPerSharedLB = 254
View Source
const NSXT = "NSX-T"
View Source
const NSXV = "NSX-V"
View Source
const Scope = "scope"
View Source
const ScopeOpenId = "openid"
View Source
const TemplateNotFoundError string = "entity not found"
View Source
const UsedCommonIpRangeTag = "UsedCommonIpRange"

UsedCommonIpRangeTag is a range within the common shared LB IP network

View Source
const UsedLegacyPerClusterIsoNetTag = "UsedLegacyPerClusterIsoNet"

UsedLegacyPerClusterIsoNetTag is a per-cluster isolated network which was used prior to 3.1

View Source
const VappNetIpAllocationDhcp = "dhcp"
View Source
const VappNetIpAllocationStatic = "static"
View Source
const VappResourceXmlType = "application/vnd.vmware.vcloud.vApp+xml"

Variables

View Source
var AccessVarProps = map[string]*edgeproto.PropertyInfo{
	VCD_USER: {
		Name:      "VCD user name",
		Mandatory: true,
	},
	VCD_PASSWORD: {
		Name:      "VCD user password",
		Mandatory: true,
	},
	VCD_ORG: {
		Name:      "VCD organization name",
		Mandatory: true,
	},
	VCD_URL: {
		Name:      "VCD API URL",
		Mandatory: true,
	},
	VDC_NAME: {
		Name:      "VDC name",
		Mandatory: true,
	},
	VCD_OAUTH_SGW_URL: {
		Name:        "VCD oauth session gateway URL",
		Description: "VCD oauth session gateway URL. Also requires setting VCD_OAUTH_AGW_URL, VCD_OAUTH_CLIENT_ID, and VCD_OAUTH_CLIENT_SECRET.",
	},
	VCD_OAUTH_AGW_URL: {
		Name: "VCD oauth API gateway URL",
	},
	VCD_OAUTH_CLIENT_ID: {
		Name:        "VCD oauth client id",
		Description: "Oauth client id if using client credentials flow",
	},
	VCD_OAUTH_CLIENT_SECRET: {
		Name:        "VCD oauth client secret",
		Description: "Oauth client secret if using client credentials flow",
	},
	VCD_CLIENT_TLS_CERT: {
		Name:        "VCD client public TLS certificate data",
		Description: "Public TLS certificate to use to authenticate with VCD",
	},
	VCD_CLIENT_TLS_KEY: {
		Name:        "VCD client private TLS certificate data",
		Description: "Private TLS certificate to use to authenticate with VCD",
	},
	VCD_CLIENT_REFRESH_INTERVAL: {
		Name: "VCD client token refresh interval",
	},
	VCD_INSECURE: {
		Name:        "VCD insecure mode",
		Description: "Defaults to true, set to \"false\" and configure TLS certificates if needed to authenticate API server certificate",
	},
}
View Source
var DefaultClientRefreshInterval uint64 = 7 * 60 * 60 // 7 hours
View Source
var InternalSharedCommonSubnetMask = "255.255.0.0"
View Source
var NoVCDClientInContext = "No VCD Client in Context"
View Source
var OvfTemplate = `` /* 5779-byte string literal not displayed */
View Source
var ResolvedStateMaxWait = 4 * 60 // 4 mins
View Source
var ResolvedStateTickTime time.Duration = time.Second * 3
View Source
var VCDClientCtxKey = "VCDClientCtxKey"
View Source
var VCDOrgCtxKey = "VCDOrgCtxKey"
View Source
var VCDVdcCtxKey = "VCDVdcCtxKey"
View Source
var VcdProps = map[string]*edgeproto.PropertyInfo{

	"MEX_CATALOG": {
		Mandatory:   true,
		Description: "VCD Org Catalog Name",
	},

	"MEX_EXTERNAL_NETWORK_EDGEGATEWAY": {
		Description: "currently unused",
	},
	"MEX_ENABLE_VCD_DISK_RESIZE": {
		Description: "VM disks cloned from the VDC template will be resized based on flavor if set to \"true\" or \"yes\".  Set to \"false\" if fast provisioning is enabled in the VDC or VM creation will fail.",
		Value:       "true",
	},
	"VCDVerbose": {
		Description: "Verbose logging for VCD",
		Internal:    true,
	},

	"VCD_OVERRIDE_LEASE_DISABLE": {
		Description: "Accept Org runtime lease values for VCD if unable to disable",
		Internal:    true,
	},
	"VCD_OVERRIDE_VCPU_SPEED": {
		Description: "Set value for vCPU Speed if unable to read from admin VCD",
		Internal:    true,
	},
	"VCD_NSX_TYPE": {
		Description: "NSX-T or NSX-V",
		Mandatory:   true,
	},
	"VCD_CLEANUP_ORPHAN_NETS": {
		Description: "Indicates Isolated Org VDC networks with no VApps to be deleted on startup",
		Value:       "false",
		Internal:    true,
	},
	"VCD_VM_APP_STATS_MAX_VDC_CACHE_TIME": {
		Description: "How long to cache VDC objects for VM App stat collection, in seconds",
		Internal:    true,
		Value:       "3600",
	},
	"VCD_VM_APP_INTERNAL_DHCP_SERVER": {
		Description: "If \"true\" or \"yes\" sets up an internal DHCP server for VM Apps, otherwise uses VCD server",
		Value:       "true",
		Internal:    true,
	},
	"VCD_TEMPLATE_ARTIFACTORY_IMPORT_ENABLED": {
		Description: "If \"true\" or \"yes\" VCD templates are stored in Artifactory and imported to VCD.  Otherwise, templates must already exist in the catalog",
		Value:       "true",
	},
	"VCD_VM_HREF_CACHE_ENABLED": {
		Description: "If \"true\" or \"yes\" caching of VCD VM HREFs is enabled",
		Value:       "true",
		Internal:    true,
	},
}

This is now an edgeproto object

View Source
var VmHardwareVersion = 14

VmHardwareVersion of 14 means vsphere 6.7

Functions

func DecrIP

func DecrIP(ctx context.Context, a string, delta int) (string, error)

func DecryptToken

func DecryptToken(ctx context.Context, encTokenB64 string, cloudletKey *edgeproto.CloudletKey) (string, error)

func EncryptToken

func EncryptToken(ctx context.Context, token string, cloudletKey *edgeproto.CloudletKey) (string, error)

EncryptToken encrypts a token via AES using the cloudlet name. Because we store the token in the cloudlet via notify, it is visible in a lot of logs. Perform simple encryption of the token using the cloudlet key to at least provide some level of protection if the logs are seen.

func GetNextAvailConIdx

func GetNextAvailConIdx(ctx context.Context, ncs *types.NetworkConnectionSection) (int, error)

func IncrIP

func IncrIP(ctx context.Context, a string, delta int) (string, error)

func MaskToCidr

func MaskToCidr(addr string) (string, error)

func NewPlatform

func NewPlatform() platform.Platform

func Octet

func Octet(ctx context.Context, a string, n int) (int, error)

func ReplaceLastOctet

func ReplaceLastOctet(ctx context.Context, addr string, o uint32) (string, error)

func TakeBoolPointer

func TakeBoolPointer(value bool) *bool

convenience routines for SDK objects

func TakeFloatAddress

func TakeFloatAddress(x float64) *float64

takeFloatAddress is a helper that returns the address of an `float64`

func TakeIntAddress

func TakeIntAddress(x int) *int

takeIntAddress is a helper that returns the address of an `int`

func TakeIntPointer

func TakeIntPointer(x int) *int

func TakeStringPointer

func TakeStringPointer(x string) *string

takeStringPointer is a helper that returns the address of a `string`

func TakeUint64Pointer

func TakeUint64Pointer(x uint64) *uint64

Types

type GovcdMetric

type GovcdMetric struct {
	Name  string `xml:"name,attr,omitempty"`
	Unit  string `xml:"unit,attr,omitempty"`
	Value string `xml:"value,attr,omitempty"`
}

type GovcdMetricList

type GovcdMetricList []*GovcdMetric

type GovcdMetricsResponse

type GovcdMetricsResponse struct {
	Link   types.LinkList  `xml:"Link,omitempty"`
	Metric GovcdMetricList `xml:"Metric,omitempty"`
}

type NetMap

type NetMap map[string]*govcd.OrgVDCNetwork

type NetworkMetadataType

type NetworkMetadataType string
const NetworkMetadataCommonIsoNet NetworkMetadataType = "common ISO network metadata"
const NetworkMetadataLegacyPerClusterIsoNet NetworkMetadataType = "per cluster legacy ISO network metadata"
const NetworkMetadataNone NetworkMetadataType = "no network metadata "

type OvfParams

type OvfParams struct {
	ImageBaseFileName string
	DiskSizeInBytes   string
	OSType            string
}

type Refresh

type Refresh bool
var DoRefresh Refresh = true
var NoRefresh Refresh = false

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
	Scope        string `json:"scope"`
	IdToken      string `json:"id_token"`
}

type VAppMap

type VAppMap map[string]*govcd.VApp

type VMMap

type VMMap map[string]*govcd.VM

type VappNetIpAllocationType

type VappNetIpAllocationType string

type VcdConfigParams

type VcdConfigParams struct {
	User                  string
	Password              string
	Org                   string
	VcdApiUrl             string
	VDC                   string
	Insecure              bool
	OauthSgwUrl           string
	OauthAgwUrl           string
	OauthClientId         string
	OauthClientSecret     string
	ClientTlsKey          string
	ClientTlsCert         string
	ClientRefreshInterval uint64
	TestToken             string
}

type VcdPlatform

type VcdPlatform struct {
	Creds    *VcdConfigParams
	TestMode bool
	Verbose  bool

	VmNameToHref map[string]string
	// contains filtered or unexported fields
}

func (*VcdPlatform) ActiveChanged

func (v *VcdPlatform) ActiveChanged(ctx context.Context, platformActive bool) error

func (*VcdPlatform) AddCommonSharedNetToVapp

func (v *VcdPlatform) AddCommonSharedNetToVapp(ctx context.Context, vapp *govcd.VApp, vcdClient *govcd.VCDClient, netName string) error

func (*VcdPlatform) AddImageIfNotPresent

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

AddImageIfNotPresent works as follows: 1) if the template is already in the VCD catalog, quit as there is nothing to do 2) if the VMDK is not in Artifactory, the qcow2 is downloaded and VMDK generated and uploaded back to Artifactory 3) regardless as to whether the VMDK had to be generated, the OVF is always regenerated in case something changed for VM images. This is very fast 4) A token is generated and used to direct the VCD to import the OVF and corresponding VMDK from Artifactory

func (*VcdPlatform) AddMetadataToVM

func (v *VcdPlatform) AddMetadataToVM(ctx context.Context, vm *govcd.VM, vmparams *vmlayer.VMOrchestrationParams) error

Store attrs of vm for crmrestarts and resource fetching

func (*VcdPlatform) AddPortsToVapp

func (v *VcdPlatform) AddPortsToVapp(ctx context.Context, vapp *govcd.VApp, vmgp *vmlayer.VMGroupOrchestrationParams, updateCallback edgeproto.CacheUpdateCallback, vcdClient *govcd.VCDClient, vdc *govcd.Vdc) error

AddPortsToVapp returns netinfo map

func (*VcdPlatform) AddVMsToExistingVApp

func (v *VcdPlatform) AddVMsToExistingVApp(ctx context.Context, vapp *govcd.VApp, vmgp *vmlayer.VMGroupOrchestrationParams, vcdClient *govcd.VCDClient, vdc *govcd.Vdc) (VMMap, error)

func (*VcdPlatform) AddVMsToVApp

func (v *VcdPlatform) AddVMsToVApp(ctx context.Context, vapp *govcd.VApp, vmgp *vmlayer.VMGroupOrchestrationParams, baseImgTmpl *govcd.VAppTemplate, netMap map[string]networkInfo, vdc *govcd.Vdc, vcdClient *govcd.VCDClient, updateCallback edgeproto.CacheUpdateCallback) (VMMap, error)

For each vm spec defined in vmgp, add a new VM to vapp with those applicable attributes. Returns a map of VMs which should be powered on and customized

func (*VcdPlatform) AddVappNetwork

func (v *VcdPlatform) AddVappNetwork(ctx context.Context, vapp *govcd.VApp, vcdClient *govcd.VCDClient, netName string) (*types.NetworkConfigSection, error)

func (*VcdPlatform) AddVmHrefToCache

func (v *VcdPlatform) AddVmHrefToCache(ctx context.Context, vmName, href string)

func (*VcdPlatform) AttachPortToServer

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

AttachPortToServer

func (*VcdPlatform) BlockWhileStatusWithTickTime

func (v *VcdPlatform) BlockWhileStatusWithTickTime(ctx context.Context, vapp *govcd.VApp, unwantedStatus string, timeOutAfterSeconds int, tickTime time.Duration) error

BlockWhileStatusWithTickTime is the same as the govcd version vapp.BlockWhileStatus. The only difference is that it allows a variable tickTime instead of every 200msec so that the number of API calls can be reduced

func (*VcdPlatform) CheckServerReady

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

check server ready without cloudlets

CheckServerReady

func (*VcdPlatform) ClearVmHrefCache

func (v *VcdPlatform) ClearVmHrefCache(ctx context.Context)

func (*VcdPlatform) ConfigureCloudletSecurityRules

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

func (*VcdPlatform) ConfigureTrustPolicyExceptionSecurityRules

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

func (*VcdPlatform) CreateImageFromUrl

func (v *VcdPlatform) CreateImageFromUrl(ctx context.Context, imageName, imageUrl, md5Sum string) (string, error)

func (*VcdPlatform) CreateInternalNetworkForNewVm

func (v *VcdPlatform) CreateInternalNetworkForNewVm(ctx context.Context, vapp *govcd.VApp, serverName, netName string, cidr string, dnsServers []string, ipAllocation VappNetIpAllocationType) (string, error)

func (*VcdPlatform) CreateVApp

func (v *VcdPlatform) CreateVApp(ctx context.Context, vappTmpl *govcd.VAppTemplate, vmgp *vmlayer.VMGroupOrchestrationParams, description string, vcdClient *govcd.VCDClient, vdc *govcd.Vdc, updateCallback edgeproto.CacheUpdateCallback) (*govcd.VApp, error)

Compose a new vapp from the given template, using vmgrp orch params Creates one or more vms.

func (*VcdPlatform) CreateVMs

func (*VcdPlatform) DeleteImage

func (v *VcdPlatform) DeleteImage(ctx context.Context, folder, image string) error

func (*VcdPlatform) DeleteMetadataForInternalSubnet

func (v *VcdPlatform) DeleteMetadataForInternalSubnet(ctx context.Context, subnetName string, vcdClient *govcd.VCDClient, vdc *govcd.Vdc) error

func (*VcdPlatform) DeleteTemplate

func (v *VcdPlatform) DeleteTemplate(ctx context.Context, name string, vcdClient *govcd.VCDClient) error

func (*VcdPlatform) DeleteVM

func (v *VcdPlatform) DeleteVM(ctx context.Context, vm *govcd.VM) error

func (*VcdPlatform) DeleteVMs

func (v *VcdPlatform) DeleteVMs(ctx context.Context, vmGroupName, ownerID string) error

Delete All VMs in the resolution of vmGroupName

func (*VcdPlatform) DeleteVapp

func (v *VcdPlatform) DeleteVapp(ctx context.Context, vapp *govcd.VApp, vcdClient *govcd.VCDClient) error

func (*VcdPlatform) DeleteVmHrefFromCache

func (v *VcdPlatform) DeleteVmHrefFromCache(ctx context.Context, vmName string)

DeleteVmHrefFromCache delete the VM->href mapping in the cache if present, does nothing otherwise

func (*VcdPlatform) DetachPortFromServer

func (v *VcdPlatform) DetachPortFromServer(ctx context.Context, serverName string, subnetNames vmlayer.SubnetNames, xportName string) error

func (*VcdPlatform) DisableOrgRuntimeLease

func (v *VcdPlatform) DisableOrgRuntimeLease(ctx context.Context, override bool) error

func (*VcdPlatform) DumpVapps

func (v *VcdPlatform) DumpVapps(ctx context.Context, matchPattern string) (string, error)

func (*VcdPlatform) DumpVmHrefCache

func (v *VcdPlatform) DumpVmHrefCache(ctx context.Context) string

func (*VcdPlatform) FindTemplate

func (v *VcdPlatform) FindTemplate(ctx context.Context, tmplName string, vcdClient *govcd.VCDClient) (*govcd.VAppTemplate, error)

Return requested vdc template

func (*VcdPlatform) FindVApp

func (v *VcdPlatform) FindVApp(ctx context.Context, vappName string, vcdClient *govcd.VCDClient, vdc *govcd.Vdc) (*govcd.VApp, error)

func (*VcdPlatform) FindVMByHrefCache

func (v *VcdPlatform) FindVMByHrefCache(ctx context.Context, vmName string, vcdClient *govcd.VCDClient) *govcd.VM

FindVMByHrefCache returns nil if the cache is not enabled or the vm not found

func (*VcdPlatform) FindVMByName

func (v *VcdPlatform) FindVMByName(ctx context.Context, serverName string, vcdClient *govcd.VCDClient, vdc *govcd.Vdc) (*govcd.VM, error)

If all you have is the serverName (vmName)

func (*VcdPlatform) FindVMInVApp

func (v *VcdPlatform) FindVMInVApp(ctx context.Context, serverName string, vapp govcd.VApp) (*govcd.VM, error)

Have vapp obj in hand use this one.

func (*VcdPlatform) GatherCloudletInfo

func (v *VcdPlatform) GatherCloudletInfo(ctx context.Context, info *edgeproto.CloudletInfo) error

func (*VcdPlatform) GetAddrOfVM

func (v *VcdPlatform) GetAddrOfVM(ctx context.Context, vm *govcd.VM, netName string) (string, error)

Get the address VM is using on the given Network

func (*VcdPlatform) GetAddrOfVapp

func (v *VcdPlatform) GetAddrOfVapp(ctx context.Context, vapp *govcd.VApp, netName string) (string, error)

Consider a GetAllSubnetsInVapp() []string err for shared lbs... XXX Returns the first addr on the given network.

func (*VcdPlatform) GetAllVMsInVApp

func (v *VcdPlatform) GetAllVMsInVApp(ctx context.Context, vapp *govcd.VApp) (VMMap, error)

Given a groupName / vappName, return all of its vm membership as a VMMap

func (*VcdPlatform) GetApiEndpointAddr

func (v *VcdPlatform) GetApiEndpointAddr(ctx context.Context) (string, error)

func (*VcdPlatform) GetCatalog

func (v *VcdPlatform) GetCatalog(ctx context.Context, catName string, vcdClient *govcd.VCDClient) (*govcd.Catalog, error)

func (*VcdPlatform) GetCatalogName

func (v *VcdPlatform) GetCatalogName() string

func (*VcdPlatform) GetCleanupOrphanedNetworks

func (v *VcdPlatform) GetCleanupOrphanedNetworks() bool

the normal methods of querying this seem sometimes unreliable e.g. vdc.IsNsxv()

func (*VcdPlatform) GetClient

func (v *VcdPlatform) GetClient(ctx context.Context, creds *VcdConfigParams) (client *govcd.VCDClient, err error)

GetClient gets a new client object. Copies are made of the global client object, which instantiates a new http client but shares the access token

func (*VcdPlatform) GetCloudletImageSuffix

func (v *VcdPlatform) GetCloudletImageSuffix(ctx context.Context) string

VCD does not yet actually support download/upload of images, but the common image suffix is provided here so it can be validated when this is implemented

func (*VcdPlatform) GetCloudletInfraResourcesInfo

func (v *VcdPlatform) GetCloudletInfraResourcesInfo(ctx context.Context) ([]edgeproto.InfraResource, error)

func (*VcdPlatform) GetCloudletManifest

func (v *VcdPlatform) GetCloudletManifest(ctx context.Context, name, cloudletImagePath string, VMGroupOrchestrationParams *vmlayer.VMGroupOrchestrationParams) (string, error)

func (*VcdPlatform) GetCloudletTrustPolicy

func (v *VcdPlatform) GetCloudletTrustPolicy(ctx context.Context) (*edgeproto.TrustPolicy, error)

func (*VcdPlatform) GetClusterAdditionalResourceMetric

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

func (*VcdPlatform) GetClusterAdditionalResources

func (v *VcdPlatform) 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 (*VcdPlatform) GetConsoleUrl

func (v *VcdPlatform) GetConsoleUrl(ctx context.Context, serverName string) (string, error)

func (*VcdPlatform) GetEnableVcdDiskResize

func (v *VcdPlatform) GetEnableVcdDiskResize() bool

func (*VcdPlatform) GetExtAddrOfVM

func (v *VcdPlatform) GetExtAddrOfVM(ctx context.Context, vm *govcd.VM, netName string) (string, error)

func (*VcdPlatform) GetExtNetwork

func (v *VcdPlatform) GetExtNetwork(ctx context.Context, vcdClient *govcd.VCDClient, netName string) (*govcd.OrgVDCNetwork, error)

fetch the OrgVDCNetwork

func (*VcdPlatform) GetExternalGateway

func (v *VcdPlatform) GetExternalGateway(ctx context.Context, extNetname string) (string, error)

GetExternalGateway Gateway, Always operates on MEX_EXT_NETWORK Return the IP address of the external Gateway

func (*VcdPlatform) GetFeatures

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

func (*VcdPlatform) GetFlavor

func (v *VcdPlatform) GetFlavor(ctx context.Context, flavorName string) (*edgeproto.FlavorInfo, error)

func (*VcdPlatform) GetFlavorList

func (v *VcdPlatform) GetFlavorList(ctx context.Context) ([]*edgeproto.FlavorInfo, error)

func (*VcdPlatform) GetFreeSharedCommonIpRange

func (v *VcdPlatform) GetFreeSharedCommonIpRange(ctx context.Context, subnetName, ownerID string, vcdClient *govcd.VCDClient, vdc *govcd.Vdc) (string, error)

func (*VcdPlatform) GetGPUSetupStage

func (v *VcdPlatform) GetGPUSetupStage(ctx context.Context) vmlayer.GPUSetupStage

func (*VcdPlatform) GetGatewayForOrgVDCNetwork

func (v *VcdPlatform) GetGatewayForOrgVDCNetwork(ctx context.Context, network *types.OrgVDCNetwork) (string, error)

func (*VcdPlatform) GetHrefCacheEnabled

func (v *VcdPlatform) GetHrefCacheEnabled() bool

func (*VcdPlatform) GetIntAddrsOfVM

func (v *VcdPlatform) GetIntAddrsOfVM(ctx context.Context, vm *govcd.VM) ([]string, error)

return a list of internal nets, a shared LB may have several

func (*VcdPlatform) GetInternalPortPolicy

func (v *VcdPlatform) GetInternalPortPolicy() vmlayer.InternalPortAttachPolicy

func (*VcdPlatform) GetLeaseOverride

func (v *VcdPlatform) GetLeaseOverride() bool

func (*VcdPlatform) GetNetworkDetail

func (v *VcdPlatform) GetNetworkDetail(ctx context.Context, networkName string) (*vmlayer.NetworkDetail, error)

func (*VcdPlatform) GetNetworkList

func (v *VcdPlatform) GetNetworkList(ctx context.Context) ([]string, error)

func (*VcdPlatform) GetNetworkMetadataForInternalSubnet

func (v *VcdPlatform) GetNetworkMetadataForInternalSubnet(ctx context.Context, subnetName string, vcdClient *govcd.VCDClient, vdc *govcd.Vdc) (NetworkMetadataType, string, error)

func (*VcdPlatform) GetNsxType

func (v *VcdPlatform) GetNsxType() string

the normal methods of querying this seem sometimes unreliable e.g. vdc.IsNsxv()

func (*VcdPlatform) GetOrg

func (v *VcdPlatform) GetOrg(ctx context.Context, vcdClient *govcd.VCDClient) (*govcd.Org, error)

Retrieve our top level Org object. Tries to retrieve the org from context first, if the org is not in context then uses the APIs to retrieve it

func (*VcdPlatform) GetPlatformResourceInfo

func (v *VcdPlatform) GetPlatformResourceInfo(ctx context.Context) (*vmlayer.PlatformResources, error)

func (*VcdPlatform) GetResourceID

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

func (*VcdPlatform) GetRouterDetail

func (v *VcdPlatform) GetRouterDetail(ctx context.Context, routerName string) (*vmlayer.RouterDetail, error)

No Router

func (*VcdPlatform) GetServerDetail

func (v *VcdPlatform) GetServerDetail(ctx context.Context, serverName string) (*vmlayer.ServerDetail, error)

func (*VcdPlatform) GetServerDetailWithVdc

func (v *VcdPlatform) GetServerDetailWithVdc(ctx context.Context, serverName string, vdc *govcd.Vdc, vcdClient *govcd.VCDClient) (*vmlayer.ServerDetail, error)

func (*VcdPlatform) GetServerGroupResources

func (v *VcdPlatform) GetServerGroupResources(ctx context.Context, name string) (*edgeproto.InfraResources, error)

Should always be a vapp/cluster/group name

func (*VcdPlatform) GetSubnetFromLegacyIsoMetadata

func (v *VcdPlatform) GetSubnetFromLegacyIsoMetadata(ctx context.Context, isonetName string, vcdClient *govcd.VCDClient, vdc *govcd.Vdc) (string, error)

GetSubnetFromLegacyIsoMetadata is used only in rare cases where we need to get the subnet name back from the iso net name

func (*VcdPlatform) GetTemplateArtifactoryImportEnabled

func (v *VcdPlatform) GetTemplateArtifactoryImportEnabled() bool

func (*VcdPlatform) GetVCDORG

func (v *VcdPlatform) GetVCDORG() string

func (*VcdPlatform) GetVCDPassword

func (v *VcdPlatform) GetVCDPassword() string

func (*VcdPlatform) GetVCDURL

func (v *VcdPlatform) GetVCDURL() string

func (*VcdPlatform) GetVCDUser

func (v *VcdPlatform) GetVCDUser() string

func (*VcdPlatform) GetVDCName

func (v *VcdPlatform) GetVDCName() string

func (*VcdPlatform) GetVMAddresses

func (v *VcdPlatform) GetVMAddresses(ctx context.Context, vm *govcd.VM, vcdClient *govcd.VCDClient, vdc *govcd.Vdc) ([]vmlayer.ServerIP, map[string]*vmlayer.NetworkDetail, error)

func (*VcdPlatform) GetVMFromVAppByIdx

func (v *VcdPlatform) GetVMFromVAppByIdx(ctx context.Context, vapp *govcd.VApp, idx int) (*govcd.VM, error)

func (*VcdPlatform) GetVMStats

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

func (*VcdPlatform) GetVappServerSuffix

func (v *VcdPlatform) GetVappServerSuffix() string

func (*VcdPlatform) GetVcdClientFromContext

func (v *VcdPlatform) GetVcdClientFromContext(ctx context.Context) *govcd.VCDClient

GetVcdClientFromContext returns a client object if one exists, otherwise nil

func (*VcdPlatform) GetVcdClientRefreshInterval

func (v *VcdPlatform) GetVcdClientRefreshInterval(ctx context.Context) uint64

func (*VcdPlatform) GetVcdClientTlsCert

func (v *VcdPlatform) GetVcdClientTlsCert() string

func (*VcdPlatform) GetVcdClientTlsKey

func (v *VcdPlatform) GetVcdClientTlsKey() string

func (*VcdPlatform) GetVcdInsecure

func (v *VcdPlatform) GetVcdInsecure() bool

GetVcdInsecure defaults to true unless explicitly set to false

func (*VcdPlatform) GetVcdOauthAgwUrl

func (v *VcdPlatform) GetVcdOauthAgwUrl() string

func (*VcdPlatform) GetVcdOauthClientId

func (v *VcdPlatform) GetVcdOauthClientId() string

func (*VcdPlatform) GetVcdOauthClientSecret

func (v *VcdPlatform) GetVcdOauthClientSecret() string

func (*VcdPlatform) GetVcdOauthSgwUrl

func (v *VcdPlatform) GetVcdOauthSgwUrl() string

func (*VcdPlatform) GetVcdOrgName

func (v *VcdPlatform) GetVcdOrgName() string

func (*VcdPlatform) GetVcdPassword

func (v *VcdPlatform) GetVcdPassword() string

func (*VcdPlatform) GetVcdUrl

func (v *VcdPlatform) GetVcdUrl() string

func (*VcdPlatform) GetVcdUser

func (v *VcdPlatform) GetVcdUser() string

func (*VcdPlatform) GetVcdVars

func (v *VcdPlatform) GetVcdVars(ctx context.Context, accessApi platform.AccessApi) error

func (*VcdPlatform) GetVcdVdcName

func (v *VcdPlatform) GetVcdVdcName() string

func (*VcdPlatform) GetVcdVerbose

func (v *VcdPlatform) GetVcdVerbose() bool

properties from envvars

func (*VcdPlatform) GetVcpuSpeedOverride

func (v *VcdPlatform) GetVcpuSpeedOverride(ctx context.Context) int64

func (*VcdPlatform) GetVdc

func (v *VcdPlatform) GetVdc(ctx context.Context, vcdClient *govcd.VCDClient) (*govcd.Vdc, error)

Retrieve our refreshed vdc object via APIs

func (*VcdPlatform) GetVdcFromContext

func (v *VcdPlatform) GetVdcFromContext(ctx context.Context, vcdClient *govcd.VCDClient) (*govcd.Vdc, error)

GetVdcFromContext gets tries to get the VDC from context, otherwise it calls GetVdc to get via APIs

func (*VcdPlatform) GetVmAppInternalDhcpServer

func (v *VcdPlatform) GetVmAppInternalDhcpServer() bool

func (*VcdPlatform) GetVmAppStatsVdcMaxCacheTime

func (v *VcdPlatform) GetVmAppStatsVdcMaxCacheTime() (uint64, error)

func (*VcdPlatform) GetVmHrefFromCache

func (v *VcdPlatform) GetVmHrefFromCache(ctx context.Context, vmName string) string

GetVmHrefFromCache returns an href if the VM is cached, blank string otherwise

func (*VcdPlatform) GetVmStatus

func (v *VcdPlatform) GetVmStatus(ctx context.Context, vm *govcd.VM, refresh Refresh) (string, error)

func (*VcdPlatform) IdSanitize

func (v *VcdPlatform) IdSanitize(name string) string

VCD names conform to XML format and may be strings including spaces and various characters.

func (*VcdPlatform) ImportImage

func (v *VcdPlatform) ImportImage(ctx context.Context, folder, imageFile string) error

func (*VcdPlatform) ImportTemplateFromUrl

func (v *VcdPlatform) ImportTemplateFromUrl(ctx context.Context, name, templUrl string, catalog *govcd.Catalog) error

func (*VcdPlatform) IncrCidr

func (v *VcdPlatform) IncrCidr(a string, delta int) (string, error)

func (*VcdPlatform) InitApiAccessProperties

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

start fetching access bits from vault

func (*VcdPlatform) InitData

func (v *VcdPlatform) InitData(ctx context.Context, caches *platform.Caches)

func (*VcdPlatform) InitOperationContext

func (v *VcdPlatform) InitOperationContext(ctx context.Context, operationStage vmlayer.OperationInitStage) (context.Context, vmlayer.OperationInitResult, error)

func (*VcdPlatform) InitProvider

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

func (*VcdPlatform) InsertConnectionIntoNcs

func (v *VcdPlatform) InsertConnectionIntoNcs(ctx context.Context, ncs *types.NetworkConnectionSection, newConn *types.NetworkConnection, conIdx int) *types.NetworkConnectionSection

InsertConnectionIntoNcs replaces the network connection if the conIdx exists, otherwise appends it

func (*VcdPlatform) InternalCloudletUpdatedCallback

func (v *VcdPlatform) InternalCloudletUpdatedCallback(ctx context.Context, old *edgeproto.CloudletInternal, new *edgeproto.CloudletInternal)

func (*VcdPlatform) IsDhcpEnabled

func (v *VcdPlatform) IsDhcpEnabled(ctx context.Context, net *govcd.OrgVDCNetwork) bool

func (*VcdPlatform) LogVappVMsStatus

func (v *VcdPlatform) LogVappVMsStatus(ctx context.Context, vapp *govcd.VApp)

func (*VcdPlatform) NameSanitize

func (v *VcdPlatform) NameSanitize(name string) string

Assuming Vcd is more similar to Vsphere rather than vmPool or OpenStack alphanumeric plus -_. first char must be alpha, <= 255 chars.

func (*VcdPlatform) PopulateCredsForSimulator

func (v *VcdPlatform) PopulateCredsForSimulator(ctx context.Context, region, orgName, physName, vaultAddr string) error

func (*VcdPlatform) PopulateOrgLoginCredsFromEnv

func (v *VcdPlatform) PopulateOrgLoginCredsFromEnv(ctx context.Context) error

physicalname (vault key) not needed when using insure env vars.

func (*VcdPlatform) PopulateOrgLoginCredsFromVcdVars

func (v *VcdPlatform) PopulateOrgLoginCredsFromVcdVars(ctx context.Context) error

func (*VcdPlatform) PrepareRootLB

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

func (*VcdPlatform) RefreshOauthTokenPeriodic

func (v *VcdPlatform) RefreshOauthTokenPeriodic(ctx context.Context, creds *VcdConfigParams)

func (*VcdPlatform) RemoveWhitelistSecurityRules

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

func (*VcdPlatform) RetrieveTemplate

func (v *VcdPlatform) RetrieveTemplate(ctx context.Context, tmplName string, vcdClient *govcd.VCDClient) (*govcd.VAppTemplate, error)

func (*VcdPlatform) SetPowerState

func (v *VcdPlatform) SetPowerState(ctx context.Context, serverName, serverAction string) error

always sync.

func (*VcdPlatform) SetVMProperties

func (v *VcdPlatform) SetVMProperties(vmProperties *vmlayer.VMProperties)

func (*VcdPlatform) TimedVcdCliCommand

func (v *VcdPlatform) TimedVcdCliCommand(ctx context.Context, name string, a ...string) ([]byte, error)

example usage, login, and show vapp info: mcctl --addr https://console-qa.mobiledgex.net:443 debug rundebug cmd=govcdcmd region=US cloudlet=qa2-cld1 args="/usr/bin/env LC_ALL=C.UTF-8 LANG=C.UTF-8 /home/ubuntu/venv/bin/vcd login $HOST $ORG $USER -w -i -p $PASSWD"

mcctl --addr https://console-qa.mobiledgex.net:443 --output-format=json debug rundebug  cmd=govcdcmd region=US cloudlet=qa2-cld1 args="/usr/bin/env LC_ALL=C.UTF-8 LANG=C.UTF-8 /home/ubuntu/venv/bin/vcd vapp info qa2-cld1-packet-pf-vapp" | jq -r '.[0].output'

func (*VcdPlatform) UpdateOauthToken

func (v *VcdPlatform) UpdateOauthToken(ctx context.Context, creds *VcdConfigParams) error

func (*VcdPlatform) UpdateVMs

Add/remove VM from our VApp (group)

func (*VcdPlatform) UploadOvaFile

func (v *VcdPlatform) UploadOvaFile(ctx context.Context, fileName, itemName, descr string, vcdClient *govcd.VCDClient) error

UploadOvaFile uploads either an OVF or OVA

func (*VcdPlatform) ValidateAdditionalNetworks

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

func (*VcdPlatform) VerifyVMs

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

func (*VcdPlatform) VmAppChangedCallback

func (v *VcdPlatform) VmAppChangedCallback(ctx context.Context, appInst *edgeproto.AppInst, newState edgeproto.TrackedState)

func (*VcdPlatform) WaitForOauthTokenViaNotify

func (v *VcdPlatform) WaitForOauthTokenViaNotify(ctx context.Context, ckey *edgeproto.CloudletKey) error

func (*VcdPlatform) WhitelistSecurityRules

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

type VcdResources

type VcdResources struct {
	VmsUsed uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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