lib/sles4sap/crash.pm

SYNOPSIS

Library to manage cloud crash tests

crash_deploy_name

my $name = crash_deploy_name();

Return the deploy name. Azure use it as resource group name

crash_vm_name

my $vm_name = crash_vm_name(provider => 'AZURE');

Returns the VM name for a given cloud provider. This function is designed to be called before VM creation, as it does not require a running VM to determine the name. It is used when composing Azure or GCE CLI commands for VM creation, creating the publiccloud::instance object to populate the instance_id field, and during VM deletion. Note that EC2 does not need or allow specifying a name in this way, so this function is not supported for the EC2 provider.

provider - Cloud provider name (AZURE, GCE)

crash_deploy_azure

Run the Azure deployment for the crash test

region - existing resource group
os - existing Load balancer NAME
address_range - VNet address prefix
subnet_range - Subnet address prefix

crash_deploy_aws

Run the AWS deployment for the crash test Returns the instance ID

region - existing resource group
image_name - OS image name
image_owner - OS image owner
instance_type - Instance type of the VM
ssh_pub_key - ssh public key to be uploaded in the VM
address_range - VPC CIDR
subnet_range - Base Subnet CIDR. Additional subnets for other AZs will be calculated from this.

crash_deploy_gcp

Run the GCP deployment for the crash test

region - GCP region
availability_zone - GCP zone
project - GCP project ID
image_name - image name
image_project - image project name
machine_type - machine type (e.g., 'n1-standard-2')
ssh_pub_key - ssh_key file
subnet_range - Subnet CIDR

crash_pubip

Get the deployment public IP of the VM. Die if an unsupported csp name is provided.

provider - Cloud provider name using same format of PUBLIC_CLOUD_PROVIDER setting
region - deployment region
availability_zone - only required for GCE

crash_get_username

my $username = crash_get_username(provider => 'GCE');

Get the username for SSH login based on cloud provider

provider - Cloud provider name (EC2, AZURE, GCE)

crash_get_instance

my $instance = crash_get_instance(
    provider => 'GCE',
    region => 'us-central1',
    availability_zone => 'b');

Create and return a publiccloud::instance object for the crash test VM

provider - Cloud provider name (EC2, AZURE, GCE)
region - Cloud region
availability_zone - GCP availability zone (optional)

crash_cleanup

crash_cleanup(
    provider => 'GCE',
    region => 'us-central1');

Clean up cloud resources for crash test

provider - Cloud provider name (EC2, AZURE, GCE)
region - Cloud region
availability_zone - only required for GCE

crash_system_ready

Polls C<systemctl is-system-running> via SSH for up to 5 minutes.
If C<reg_code> is provided, registers the system and verifies with C<SUSEConnect -s>.
reg_code Registration code.
ssh_command SSH command for registration.
scc_endpoint The way of doing registration, SUSEConnect or registercloudguest.

crash_softrestart

crash_softrestart(instance => $instance [, timeout => 600]);

Does a soft restart of the given instance by running the command shutdown -r.

instance instance of the PC class.
timeout

crash_wait_back

crash_wait_back(vm_ip => '1.2.3.4');

Wait until SUT is back again polling port 22 on the given IP. Then list for failed services and die if find one.

vm_ip Public IP address of the SUT, can be calculated by crash_pubip
username Username for SSH login, can be calculated by crash_get_username

crash_destroy_azure

Delete the Azure deployment

crash_destroy_aws

Delete the AWS deployment

region region where the deployment has been deployed in AWS

crash_destroy_gcp

Delete the GCP deployment

availability_zone - GCP availability zone where the deployment was created
region - GCP region

crash_patch_system

crash_patch_system(
    provider => 'GCE',
    region => 'us-central1',
    availability_zone => 'b');

Patch the crash system using ssh_fully_patch_system and reboot.

provider - Cloud provider name (EC2, AZURE, GCE)
region - Cloud region
availability_zone - GCP availability zone (optional)

crash_network_peering_create

crash_network_peering_create(
    provider  => 'AZURE',
    ibsm_ip   => '10.1.2.3',
    region    => 'westeurope',
    ibsm_rg   => 'IBSmRg');

crash_network_peering_create(
    provider          => 'GCE',
    ibsm_ip           => '10.1.2.3',
    region            => 'us-central1',
    availability_zone => 'a',
    project           => 'my-project',
    ibsm_ncc_hub      => 'projects/ibsm-project/locations/global/hubs/ibsm-hub');

crash_network_peering_create(
    provider      => 'EC2',
    ibsm_ip       => '10.1.2.3',
    region        => 'us-east-1',
    ibsm_ip_range => '10.0.0.0/8',
    ibsm_prj_tag  => 'my-project-tag');

Create a network peering between the crash test SUT and an IBSm server. Supported providers are AZURE (Azure VNet Peering), GCE (GCP NCC Spoke) and EC2 (AWS Transit Gateway). After peering is established, the IBSm IP is added to /etc/hosts on the SUT and optional incident repos are configured.

provider - Cloud provider: AZURE, GCE or EC2
ibsm_ip - IP address of the IBSm server
region - Cloud region of the SUT deployment
ibsm_rg - Azure Resource Group of the IBSm. Required for AZURE.
ibsm_ncc_hub - Full NCC hub resource URI. Required for GCE.
project - GCP project ID of the SUT. Required for GCE.
availability_zone - GCP availability zone suffix. Required for GCE.
ibsm_ip_range - IP range of the IBSm environment. Required for EC2.
ibsm_prj_tag - Project tag used to identify the Transit Gateway. Used for EC2.
incident_repos - Comma-separated list of incident repo URLs (optional)
repo_host - Hostname to redirect to IBSm.

repos_add_server_to_hosts

repos_add_server_to_hosts(
    ibsm_ip       => '10.0.0.1',
    incident_repos => 'http://repo1,http://repo2',
    ssh_cmd       => 'ssh user@host');

Add the server IP to /etc/hosts and configure incident repos on a single SUT via SSH.

ibsm_ip - IP address of the server
incident_repos - comma-separated list of incident repository URLs (optional)
repo_host - hostname to redirect to server.
ssh_cmd - SSH command prefix used to run commands on the SUT

crash_network_peering_delete

crash_network_peering_delete(
    provider => 'AZURE',
    ibsm_rg  => 'IBSmRg');

crash_network_peering_delete(
    provider => 'GCE');

Delete the network peering between the crash test SUT and the IBSm server. Supported providers are AZURE and GCE.

provider - Cloud provider: AZURE or GCE
ibsm_rg - Azure Resource Group of the IBSm. Required for AZURE.