Initial stab at fio benchmarking resources

This commit is contained in:
Arif Ali 2024-05-02 11:59:59 +01:00
parent cd4cb5291b
commit 0228574e5c
Signed by: arif
GPG Key ID: 369608FBA1353A70
8 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1 @@
../00-init.tf

View File

@ -0,0 +1,9 @@
variable "volume_type" {
type = string
default = "cinder-t3"
}
variable "image" {
type = string
default = "bionic"
}

View File

@ -0,0 +1,13 @@
resource "openstack_compute_flavor_v2" "canonical_m1_xlarge_fio" {
name = "canonical.m1.xlarge.fio"
ram = "16384"
vcpus = "8"
disk = "160"
is_public = true
extra_specs = {
"hw:cpu_policy" = "dedicated",
"hw:cpu_thread_policy" = "prefer"
"hw:numa_nodes" = "1"
}
}

View File

@ -0,0 +1,24 @@
resource "openstack_networking_secgroup_v2" "server_secgroup_test" {
name = "server_secgroup_test"
description = "Allow ssh and ping"
}
resource "openstack_networking_secgroup_rule_v2" "server_secgroup_test_ping" {
direction = "ingress"
ethertype = "IPv4"
protocol = "icmp"
port_range_min = -1
port_range_max = -1
remote_ip_prefix = "0.0.0.0/0"
security_group_id = openstack_networking_secgroup_v2.server_secgroup_test.id
}
resource "openstack_networking_secgroup_rule_v2" "server_secgroup_test_ssh" {
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 22
port_range_max = 22
remote_ip_prefix = "0.0.0.0/0"
security_group_id = openstack_networking_secgroup_v2.server_secgroup_test.id
}

View File

@ -0,0 +1,24 @@
resource "openstack_networking_network_v2" "network_test" {
name = "network_test"
admin_state_up = "true"
segments {
physical_network = "physnet_sriov1"
segmentation_id = "1498"
network_type = "vlan"
}
}
resource "openstack_networking_subnet_v2" "subnet_test" {
network_id = openstack_networking_network_v2.network_test.id
name = "server_test_sn"
cidr = "10.0.9.0/24"
enable_dhcp = "false"
allocation_pool {
start = "10.0.9.36"
end = "10.0.9.62"
}
}

View File

@ -0,0 +1,55 @@
data "openstack_images_image_v2" "image" {
name = var.image
most_recent = true
}
resource "openstack_blockstorage_volume_v3" "volume_data" {
name = "volume_data"
size = 200
volume_type = var.volume_type
}
resource "openstack_blockstorage_volume_v3" "volume_boot" {
name = "volume_boot"
size = 10
image_id = data.openstack_images_image_v2.image.id
volume_type = var.volume_type
}
resource "openstack_networking_port_v2" "server_port" {
name = "server_eth0"
network_id = openstack_networking_network_v2.network_test.id
admin_state_up = "true"
security_group_ids = [openstack_networking_secgroup_v2.server_secgroup_test.id]
binding {
vnic_type = "direct"
}
}
resource "openstack_compute_instance_v2" "server_test" {
name = "fio_test_server"
image_id = data.openstack_images_image_v2.image.id
flavor_id = openstack_compute_flavor_v2.canonical_m1_xlarge_fio.id
config_drive = "true"
block_device {
uuid = openstack_blockstorage_volume_v3.volume_boot.id
source_type = "volume"
boot_index = 0
destination_type = "volume"
}
block_device {
uuid = openstack_blockstorage_volume_v3.volume_data.id
source_type = "volume"
boot_index = 1
destination_type = "volume"
}
network {
port = openstack_networking_port_v2.server_port.id
}
user_data = file("user-data.yaml")
}

View File

@ -0,0 +1 @@
../arif-home.tfvars

View File

@ -0,0 +1,16 @@
#cloud-config
password: ubuntu
chpasswd: {expire: False}
ssh_pwauth: True
write_files:
- content: |
#!/bin/bash
sudo mkfs.ext4 /dev/vdb
sudo mkdir /mnt/disk
sudo mount /dev/vdb /mnt/disk
owner: root
permissions: '0755'
path: /tmp/mount_disk.sh
runcmd:
- [ sudo, /tmp/mount_disk.sh ]