Skip to content

Commit

Permalink
Add posibility to set system disk size in PublicCloud
Browse files Browse the repository at this point in the history
  • Loading branch information
mimi1vx committed Aug 20, 2024
1 parent d36b292 commit 2d14d5b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
8 changes: 6 additions & 2 deletions data/publiccloud/terraform/azure.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ variable "sku" {
default = "gen2"
}

variable "root-disk-size" {
default = 30
}

variable "extra-disk-size" {
default = "100"
}
Expand Down Expand Up @@ -141,7 +145,7 @@ resource "azurerm_image" "image" {
os_type = "Linux"
os_state = "Generalized"
blob_uri = "https://${var.storage-account}.blob.core.windows.net/sle-images/${var.image_id}"
size_gb = 30
size_gb = var.root-disk-size
}
}

Expand Down Expand Up @@ -175,7 +179,7 @@ resource "azurerm_linux_virtual_machine" "openqa-vm" {
storage_account_type = "Standard_LRS"
# SLE images are 30G by default. Uncomment this line in case we need to increase the disk size
# note: value can not be decreased because 30 GB is minimum allowed by Azure
# disk_size_gb = 30
disk_size_gb = var.root-disk-size
}

source_image_id = var.image_uri != "" ? var.image_uri : (var.image_id != "" ? azurerm_image.image.0.id : null)
Expand Down
6 changes: 5 additions & 1 deletion data/publiccloud/terraform/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ variable "image_id" {
default = ""
}

variable "root-disk-size" {
default = 20
}

variable "extra-disk-size" {
default = "1000"
}
Expand Down Expand Up @@ -111,7 +115,7 @@ resource "aws_instance" "openqa" {

ebs_block_device {
device_name = "/dev/sda1"
volume_size = 20
volume_size = var.root-disk-size
volume_type = "gp3"
}

Expand Down
6 changes: 5 additions & 1 deletion data/publiccloud/terraform/gce.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ variable "project" {
default = "suse-sle-qa"
}

variable "root-disk-size" {
default = 20
}

variable "extra-disk-size" {
default = "1000"
}
Expand Down Expand Up @@ -124,7 +128,7 @@ resource "google_compute_instance" "openqa" {
device_name = "${var.name}-${element(random_id.service.*.hex, count.index)}"
initialize_params {
image = var.image_id
size = 20
size = var.root-disk-size
}
}

Expand Down
8 changes: 6 additions & 2 deletions lib/publiccloud/provider.pm
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ sub terraform_prepare_env {
else {
$file = get_var('PUBLIC_CLOUD_TERRAFORM_FILE', "publiccloud/terraform/$file.tf");
assert_script_run('curl ' . data_url("$file") . ' -o ' . TERRAFORM_DIR . '/plan.tf');
<<<<<<< HEAD
=======
assert_script_run('curl ' . data_url("publiccloud/cloud-init.yaml") . ' -o ' . TERRAFORM_DIR . "/cloud-init.yaml") if (get_var('PUBLIC_CLOUD_CLOUD_INIT'));
>>>>>>> a015ca600 (Add posibility to set system disk size in PublicCloud)
}
$self->terraform_env_prepared(1);
}
Expand Down Expand Up @@ -537,9 +541,9 @@ sub terraform_apply {
$cmd .= "-var 'region=" . $self->provider_client->region . "' ";
$cmd .= "-var 'name=" . $self->resource_name . "' ";
$cmd .= "-var 'project=" . $args{project} . "' " if $args{project};
$cmd .= "-var 'enable_confidential_vm=true' " if ($args{confidential_compute} && is_gce());
$cmd .= "-var 'enable_confidential_vm=enabled' " if ($args{confidential_compute} && is_ec2());
$cmd .= "-var 'vm_create_timeout=" . $terraform_vm_create_timeout . "' " if $terraform_vm_create_timeout;
my $root_size = get_var('PUBLIC_CLOUD_ROOT_DISK_SIZE');
$cmd .= "-var 'root-disk-size=" . $root_size ."' " if ($root_size);
$cmd .= sprintf(q(-var 'tags=%s' ), escape_single_quote($self->terraform_param_tags));
if ($args{use_extra_disk}) {
$cmd .= "-var 'create-extra-disk=true' ";
Expand Down
1 change: 1 addition & 0 deletions variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ PUBLIC_CLOUD_INFRA | boolean | false | Would trigger special flow in [check_regi
PUBLIC_CLOUD_INFRA_RMT_V4 | string | "" | Defines IPv4 registration server in test infra. Must be used together with PUBLIC_CLOUD_INFRA. (DO NOT use the variable if you don't know what is about)
PUBLIC_CLOUD_INFRA_RMT_V6 | string | "" | Defines IPv6 registration server in test infra. Must be used together with PUBLIC_CLOUD_INFRA. (DO NOT use the variable if you don't know what is about)
PUBLIC_CLOUD_GEN_RESOLVER | boolean | 0 | Control use of `--debug-resolver` option during maintenance updates testing . In case option was used also controls uploading of resolver case into the test
PUBLIC_CLOUD_ROOT_DISK_SIZE | int | | Set size of system disk in GiB for public cloud instance. Default size is 30 for Azure and 20 for GCE and EC2


### Wicked testsuite specific variables
Expand Down

0 comments on commit 2d14d5b

Please sign in to comment.