v2

package
v2.2.1 Latest Latest
Warning

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

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

Documentation

Overview

Package v2 contains common functions for creating compute-based resources for use in acceptance tests. See the `*_test.go` files for example usages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachInterface

func AttachInterface(t *testing.T, client *gophercloud.ServiceClient, serverID string) (*attachinterfaces.Interface, error)

AttachInterface will create and attach an interface on a given server. An error will returned if the interface could not be created.

func CreateAggregate

func CreateAggregate(t *testing.T, client *gophercloud.ServiceClient) (*aggregates.Aggregate, error)

CreateAggregate will create an aggregate with random name and available zone. An error will be returned if the aggregate could not be created.

func CreateBootableVolumeServer

func CreateBootableVolumeServer(t *testing.T, client *gophercloud.ServiceClient, blockDevices []servers.BlockDevice) (*servers.Server, error)

CreateBootableVolumeServer works like CreateServer but is configured with one or more block devices defined by passing in []servers.BlockDevice. An error will be returned if a server was unable to be created.

func CreateFlavor

func CreateFlavor(t *testing.T, client *gophercloud.ServiceClient) (*flavors.Flavor, error)

CreateFlavor will create a flavor with a random name. An error will be returned if the flavor could not be created.

func CreateKeyPair

func CreateKeyPair(t *testing.T, client *gophercloud.ServiceClient) (*keypairs.KeyPair, error)

CreateKeyPair will create a KeyPair with a random name. An error will occur if the keypair failed to be created. An error will be returned if the keypair was unable to be created.

func CreateMicroversionServer

func CreateMicroversionServer(t *testing.T, client *gophercloud.ServiceClient) (*servers.Server, error)

CreateMicroversionServer creates a basic instance compatible with newer microversions with a randomly generated name. The flavor of the instance will be the value of the OS_FLAVOR_ID environment variable. The image will be the value of the OS_IMAGE_ID environment variable. The instance will be launched on the network specified in OS_NETWORK_NAME. An error will be returned if the instance was unable to be created.

func CreateMultiEphemeralServer

func CreateMultiEphemeralServer(t *testing.T, client *gophercloud.ServiceClient, blockDevices []servers.BlockDevice) (*servers.Server, error)

CreateMultiEphemeralServer works like CreateServer but is configured with one or more block devices defined by passing in []servers.BlockDevice. These block devices act like block devices when booting from a volume but are actually local ephemeral disks. An error will be returned if a server was unable to be created.

func CreatePrivateFlavor

func CreatePrivateFlavor(t *testing.T, client *gophercloud.ServiceClient) (*flavors.Flavor, error)

CreatePrivateFlavor will create a private flavor with a random name. An error will be returned if the flavor could not be created.

func CreateRemoteConsole

func CreateRemoteConsole(t *testing.T, client *gophercloud.ServiceClient, serverID string) (*remoteconsoles.RemoteConsole, error)

CreateRemoteConsole will create a remote noVNC console for the specified server.

func CreateSecurityGroup

func CreateSecurityGroup(t *testing.T, client *gophercloud.ServiceClient) (*secgroups.SecurityGroup, error)

CreateSecurityGroup will create a security group with a random name. An error will be returned if one was failed to be created.

func CreateSecurityGroupRule

func CreateSecurityGroupRule(t *testing.T, client *gophercloud.ServiceClient, securityGroupID string) (*secgroups.Rule, error)

CreateSecurityGroupRule will create a security group rule with a random name and a random TCP port range between port 80 and 99. An error will be returned if the rule failed to be created.

func CreateServer

func CreateServer(t *testing.T, client *gophercloud.ServiceClient) (*servers.Server, error)

CreateServer creates a basic instance with a randomly generated name. The flavor of the instance will be the value of the OS_FLAVOR_ID environment variable. The image will be the value of the OS_IMAGE_ID environment variable. The instance will be launched on the network specified in OS_NETWORK_NAME. An error will be returned if the instance was unable to be created.

func CreateServerGroup

func CreateServerGroup(t *testing.T, client *gophercloud.ServiceClient, policy string) (*servergroups.ServerGroup, error)

CreateServerGroup will create a server with a random name. An error will be returned if the server group failed to be created.

func CreateServerGroupMicroversion

func CreateServerGroupMicroversion(t *testing.T, client *gophercloud.ServiceClient) (*servergroups.ServerGroup, error)

CreateServerGroupMicroversion will create a server with a random name using 2.64 microversion. An error will be returned if the server group failed to be created.

func CreateServerInServerGroup

func CreateServerInServerGroup(t *testing.T, client *gophercloud.ServiceClient, serverGroup *servergroups.ServerGroup) (*servers.Server, error)

CreateServerInServerGroup works like CreateServer but places the instance in a specified Server Group.

func CreateServerNoNetwork

func CreateServerNoNetwork(t *testing.T, client *gophercloud.ServiceClient) (*servers.Server, error)

CreateNoNetworkServer creates a basic instance with a randomly generated name. The flavor of the instance will be the value of the OS_FLAVOR_ID environment variable. The image will be the value of the OS_IMAGE_ID environment variable. The instance will be launched without network interfaces attached. An error will be returned if the instance was unable to be created.

func CreateServerWithPublicKey

func CreateServerWithPublicKey(t *testing.T, client *gophercloud.ServiceClient, keyPairName string) (*servers.Server, error)

CreateServerWithPublicKey works the same as CreateServer, but additionally configures the server with a specified Key Pair name.

func CreateServerWithTags

func CreateServerWithTags(t *testing.T, client *gophercloud.ServiceClient, networkID string) (*servers.Server, error)

CreateServerWithTags creates a basic instance with a randomly generated name. The flavor of the instance will be the value of the OS_FLAVOR_ID environment variable. The image will be the value of the OS_IMAGE_ID environment variable. The instance will be launched on the network specified in OS_NETWORK_NAME. Two tags will be assigned to the server. An error will be returned if the instance was unable to be created.

func CreateServerWithoutImageRef

func CreateServerWithoutImageRef(t *testing.T, client *gophercloud.ServiceClient) (*servers.Server, error)

CreateServerWithoutImageRef creates a basic instance with a randomly generated name. The flavor of the instance will be the value of the OS_FLAVOR_ID environment variable. The image is intentionally missing to trigger an error. The instance will be launched on the network specified in OS_NETWORK_NAME. An error will be returned if the instance was unable to be created.

func CreateVolumeAttachment

func CreateVolumeAttachment(t *testing.T, client *gophercloud.ServiceClient, blockClient *gophercloud.ServiceClient, server *servers.Server, volume *volumes.Volume) (*volumeattach.VolumeAttachment, error)

CreateVolumeAttachment will attach a volume to a server. An error will be returned if the volume failed to attach.

func DeleteAggregate

func DeleteAggregate(t *testing.T, client *gophercloud.ServiceClient, aggregate *aggregates.Aggregate)

DeleteAggregate will delete a given host aggregate. A fatal error will occur if the aggregate deleting is failed. This works best when using it as a deferred function.

func DeleteFlavor

func DeleteFlavor(t *testing.T, client *gophercloud.ServiceClient, flavor *flavors.Flavor)

DeleteFlavor will delete a flavor. A fatal error will occur if the flavor could not be deleted. This works best when using it as a deferred function.

func DeleteKeyPair

func DeleteKeyPair(t *testing.T, client *gophercloud.ServiceClient, keyPair *keypairs.KeyPair)

DeleteKeyPair will delete a specified keypair. A fatal error will occur if the keypair failed to be deleted. This works best when used as a deferred function.

func DeleteSecurityGroup

func DeleteSecurityGroup(t *testing.T, client *gophercloud.ServiceClient, securityGroupID string)

DeleteSecurityGroup will delete a security group. A fatal error will occur if the group failed to be deleted. This works best as a deferred function.

func DeleteSecurityGroupRule

func DeleteSecurityGroupRule(t *testing.T, client *gophercloud.ServiceClient, ruleID string)

DeleteSecurityGroupRule will delete a security group rule. A fatal error will occur if the rule failed to be deleted. This works best when used as a deferred function.

func DeleteServer

func DeleteServer(t *testing.T, client *gophercloud.ServiceClient, server *servers.Server)

DeleteServer deletes an instance via its UUID. A fatal error will occur if the instance failed to be destroyed. This works best when using it as a deferred function.

func DeleteServerGroup

func DeleteServerGroup(t *testing.T, client *gophercloud.ServiceClient, serverGroup *servergroups.ServerGroup)

DeleteServerGroup will delete a server group. A fatal error will occur if the server group failed to be deleted. This works best when used as a deferred function.

func DeleteVolumeAttachment

func DeleteVolumeAttachment(t *testing.T, client *gophercloud.ServiceClient, blockClient *gophercloud.ServiceClient, server *servers.Server, volumeAttachment *volumeattach.VolumeAttachment)

DeleteVolumeAttachment will disconnect a volume from an instance. A fatal error will occur if the volume failed to detach. This works best when used as a deferred function.

func DetachInterface

func DetachInterface(t *testing.T, client *gophercloud.ServiceClient, serverID, portID string)

DetachInterface will detach an interface from a server. A fatal error will occur if the interface could not be detached. This works best when used as a deferred function.

func FillUpdateOptsFromQuotaSet

func FillUpdateOptsFromQuotaSet(src quotasets.QuotaSet, dest *quotasets.UpdateOpts)

Convenience method to fill an QuotaSet-UpdateOpts-struct from a QuotaSet-struct

func GetNetworkIDFromNetworks

func GetNetworkIDFromNetworks(t *testing.T, client *gophercloud.ServiceClient, networkName string) (string, error)

GetNetworkIDFromNetworks will return the network UUID for a given network name using the Neutron API. An error will be returned if the network could not be retrieved.

func ImportPublicKey

func ImportPublicKey(t *testing.T, client *gophercloud.ServiceClient, publicKey string) (*keypairs.KeyPair, error)

ImportPublicKey will create a KeyPair with a random name and a specified public key. An error will be returned if the keypair failed to be created.

func RescueServer

func RescueServer(t *testing.T, client *gophercloud.ServiceClient, server *servers.Server) error

RescueServer will place the specified server into rescue mode.

func ResizeServer

func ResizeServer(t *testing.T, client *gophercloud.ServiceClient, server *servers.Server) error

ResizeServer performs a resize action on an instance. An error will be returned if the instance failed to resize. The new flavor that the instance will be resized to is specified in OS_FLAVOR_ID_RESIZE.

func UnrescueServer

func UnrescueServer(t *testing.T, client *gophercloud.ServiceClient, server *servers.Server) error

UnrescueServer will return server from rescue mode.

func WaitForComputeStatus

func WaitForComputeStatus(client *gophercloud.ServiceClient, server *servers.Server, status string) error

WaitForComputeStatus will poll an instance's status until it either matches the specified status or the status becomes ERROR.

Types

This section is empty.

Jump to

Keyboard shortcuts

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