Skip to content

Commit

Permalink
Finished testing Storage Policies
Browse files Browse the repository at this point in the history
  • Loading branch information
scotttyso committed Sep 15, 2021
1 parent ac2ef4c commit 4fd717a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 37 deletions.
23 changes: 12 additions & 11 deletions modules/storage_drive_group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ resource "intersight_storage_drive_group" "drive_group" {
for_each = var.automatic_drive_group
content {
class_id = "storage.ManualDriveGroup"
drive_type = automatic_drive_group.value.drive_type
drives_per_span = automatic_drive_group.value.drives_per_span
drive_type = automatic_drive_group.value.drive_type
minimum_drive_size = automatic_drive_group.value.minimum_drive_size
num_dedicated_hot_spares = automatic_drive_group.value.num_dedicated_hot_spares != null ? automatic_drive_group.value.num_dedicated_hot_spares : 0
number_of_spans = automatic_drive_group.value.number_of_spans
Expand All @@ -25,19 +25,12 @@ resource "intersight_storage_drive_group" "drive_group" {
}
}
dynamic "manual_drive_group" {
for_each = var.manual_drive_selection
for_each = var.manual_drive_group
content {
class_id = "storage.ManualDriveGroup"
dedicated_hot_spares = manual_drive_group.value.dedicated_hot_spares != null ? manual_drive_group.value.dedicated_hot_spares : ""
object_type = "storage.ManualDriveGroup"
span_groups = [
{
additional_properties = ""
class_id = "storage.SpanDrives"
object_type = "storage.SpanDrives"
slots = manual_drive_group.value.slots
}
]
span_groups = manual_drive_group.value.drive_array_spans
}
}
dynamic "tags" {
Expand Down Expand Up @@ -65,7 +58,15 @@ resource "intersight_storage_drive_group" "drive_group" {
drive_cache = virtual_drives.value.disk_cache
object_type = "storage.VirtualDrivePolicy"
read_policy = virtual_drives.value.read_policy
strip_size = virtual_drives.value.strip_size
strip_size = length(
regexall("128KiB", virtual_drives.value.strip_size)
) > 0 ? 128 : length(
regexall("256KiB", virtual_drives.value.strip_size)
) > 0 ? 256 : length(
regexall("512KiB", virtual_drives.value.strip_size)
) > 0 ? 512 : length(
regexall("1MiB", virtual_drives.value.strip_size)
) > 0 ? 1024 : 64
write_policy = virtual_drives.value.write_policy
}
]
Expand Down
32 changes: 16 additions & 16 deletions modules/storage_drive_group/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ variable "automatic_drive_group" {
default = {}
description = <<-EOT
This drive group is created using automatic drive selection. This complex property has following sub-properties:
* drives_per_span - Number of drives within this span group. The minimum number of disks needed in a span group varies based on RAID level. RAID0 requires at least one disk. RAID1 and RAID10 requires at least 2 and in multiples of . RAID5 and RAID50 require at least 3 disks in a span group. RAID6 and RAID60 require atleast 4 disks in a span.
* drive_type - Type of drive that should be used for this RAID group.
- Any - Any type of drive can be used for virtual drive creation.
- HDD - Hard disk drives should be used for virtual drive creation.
- SSD - Solid state drives should be used for virtual drive creation.
* drives_per_span - Number of drives within this span group. The minimum number of disks needed in a span group varies based on RAID level. RAID0 requires at least one disk. RAID1 and RAID10 requires at least 2 and in multiples of . RAID5 and RAID50 require at least 3 disks in a span group. RAID6 and RAID60 require atleast 4 disks in a span.
* minimum_drive_size - Minimum size of the drive to be used for creating this RAID group.
* num_dedicated_hot_spares - Number of dedicated hot spare disks for this RAID group. Allowed value is a comma or hyphen separated number range.
* number_of_spans - Number of span groups to be created for this RAID group. Non-nested RAID levels have a single span.
Expand All @@ -33,7 +33,7 @@ variable "automatic_drive_group" {
))
}

variable "manual_drive_selection" {
variable "manual_drive_group" {
default = {}
description = <<-EOT
This drive group is created by specifying the drive slots to be used. This complex property has following sub-properties:
Expand All @@ -46,7 +46,7 @@ variable "manual_drive_selection" {
type = map(object(
{
dedicated_hot_spares = optional(string)
slots = string
drive_array_spans = any
}
))
}
Expand Down Expand Up @@ -93,29 +93,29 @@ variable "virtual_drives" {
* size:(int) Virtual drive size in MebiBytes. Size is mandatory field except when the Expand to Available option is enabled.
* access_policy:(string) Access policy that host has on this virtual drive.
- Default - Use platform default access mode.
- ReadWrite - Enables host to perform read-write on the VD.
- ReadOnly - Host can only read from the VD.
- Blocked - Host can neither read nor write to the VD.
- ReadOnly - Host can only read from the VD.
- ReadWrite - Enables host to perform read-write on the VD.
* disk_cache:(string) Disk cache policy for the virtual drive.
- Default - Use platform default drive cache mode.
- NoChange - Drive cache policy is unchanged.
- Enable - Enables IO caching on the drive.
- Disable - Disables IO caching on the drive.
- Enable - Enables IO caching on the drive.
- NoChange - Drive cache policy is unchanged.
* read_policy:(string) Read ahead mode to be used to read data from this virtual drive.
- Default - Use platform default read ahead mode.
- ReadAhead - Use read ahead mode for the policy.
- NoReadAhead - Do not use read ahead mode for the policy.
* strip_size:(int) Desired strip size - Allowed values are 64KiB, 128KiB, 256KiB, 512KiB, 1024KiB.
- 64 - Number of bytes in a strip is 64 Kibibytes.
- 128 - Number of bytes in a strip is 128 Kibibytes.
- 256 - Number of bytes in a strip is 256 Kibibytes.
- 512 - Number of bytes in a strip is 512 Kibibytes.
- 1024 - Number of bytes in a strip is 1024 Kibibytes or 1 Mebibyte.
- ReadAhead - Use read ahead mode for the policy.
* strip_size:(string) Desired strip size - Allowed values are 64KiB, 128KiB, 256KiB, 512KiB, 1024KiB.
* 64 - Number of bytes in a strip is 64 Kibibytes.
* 128 - Number of bytes in a strip is 128 Kibibytes.
* 256 - Number of bytes in a strip is 256 Kibibytes.
* 512 - Number of bytes in a strip is 512 Kibibytes.
* 1024 - Number of bytes in a strip is 1024 Kibibytes or 1 Mebibyte.
* write_policy:(string) Write mode to be used to write data to this virtual drive.
- Default - Use platform default write mode.
- WriteThrough - Data is written through the cache and to the physical drives. Performance is improved, because subsequent reads of that data can be satisfied from the cache.
- WriteBackGoodBbu - Data is stored in the cache, and is only written to the physical drives when space in the cache is needed. Virtual drives requesting this policy fall back to Write Through caching when the battery backup unit (BBU) cannot guarantee the safety of the cache in the event of a power failure.
- AlwaysWriteBack - With this policy, write caching remains Write Back even if the battery backup unit is defective or discharged.
- WriteBackGoodBbu - Data is stored in the cache, and is only written to the physical drives when space in the cache is needed. Virtual drives requesting this policy fall back to Write Through caching when the battery backup unit (BBU) cannot guarantee the safety of the cache in the event of a power failure.
- WriteThrough - Data is written through the cache and to the physical drives. Performance is improved, because subsequent reads of that data can be satisfied from the cache.
EOT
type = map(object(
{
Expand Down
11 changes: 9 additions & 2 deletions modules/storage_policies/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,15 @@ resource "intersight_storage_storage_policy" "storage" {
drive_cache = raid0_drive.value.drive_cache
object_type = "storage.VirtualDriveConfig"
read_policy = raid0_drive.value.read_policy
strip_size = raid0_drive.value.strip_size
write_policy = raid0_drive.value.write_policy
strip_size = length(
regexall("128KiB", raid0_drive.value.strip_size)
) > 0 ? 128 : length(
regexall("256KiB", raid0_drive.value.strip_size)
) > 0 ? 256 : length(
regexall("512KiB", raid0_drive.value.strip_size)
) > 0 ? 512 : length(
regexall("1MiB", raid0_drive.value.strip_size)
) > 0 ? 1024 : 64
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions modules/storage_policies/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ variable "raid0_drive" {
This complex property has following sub-properties:
* access_policy - Access policy that host has on this virtual drive.
- Default - Use platform default access mode.
- ReadWrite - Enables host to perform read-write on the VD.
- ReadOnly - Host can only read from the VD.
- Blocked - Host can neither read nor write to the VD.
- ReadOnly - Host can only read from the VD.
- ReadWrite - Enables host to perform read-write on the VD.
* drive_cache - Disk cache policy for the virtual drive.
- Default - Use platform default drive cache mode.
- NoChange - Drive cache policy is unchanged.
- Enable - Enables IO caching on the drive.
- Disable - Disables IO caching on the drive.
- Enable - Enables IO caching on the drive.
- NoChange - Drive cache policy is unchanged.
* drive_slots - The set of drive slots where RAID0 virtual drives must be created.
* enable - If enabled, this will create a RAID0 virtual drive per disk and encompassing the whole disk.
* read_policy - Read ahead mode to be used to read data from this virtual drive.
- Default - Use platform default read ahead mode.
- ReadAhead - Use read ahead mode for the policy.
- NoReadAhead - Do not use read ahead mode for the policy.
- ReadAhead - Use read ahead mode for the policy.
* strip_size - Desired strip size - Allowed values are 64KiB, 128KiB, 256KiB, 512KiB, 1024KiB.
- 64 - Number of bytes in a strip is 64 Kibibytes.
- 128 - Number of bytes in a strip is 128 Kibibytes.
Expand All @@ -89,9 +89,9 @@ variable "raid0_drive" {
- 1024 - Number of bytes in a strip is 1024 Kibibytes or 1 Mebibyte.
* write_policy:(string) Write mode to be used to write data to this virtual drive.
- Default - Use platform default write mode.
- WriteThrough - Data is written through the cache and to the physical drives. Performance is improved, because subsequent reads of that data can be satisfied from the cache.
- WriteBackGoodBbu - Data is stored in the cache, and is only written to the physical drives when space in the cache is needed. Virtual drives requesting this policy fall back to Write Through caching when the battery backup unit (BBU) cannot guarantee the safety of the cache in the event of a power failure.
- AlwaysWriteBack - With this policy, write caching remains Write Back even if the battery backup unit is defective or discharged.
- WriteBackGoodBbu - Data is stored in the cache, and is only written to the physical drives when space in the cache is needed. Virtual drives requesting this policy fall back to Write Through caching when the battery backup unit (BBU) cannot guarantee the safety of the cache in the event of a power failure.
- WriteThrough - Data is written through the cache and to the physical drives. Performance is improved, because subsequent reads of that data can be satisfied from the cache.
EOT
type = map(object(
{
Expand All @@ -116,9 +116,9 @@ variable "unused_disks_state" {
default = "NoChange"
description = <<-EOT
State to which disks, not used in this policy, are to be moved.
* Jbod - JBOD state where the disks start showing up to Host OS.
* NoChange - (Default) Drive state will not be modified by Storage Policy.
* UnconfiguredGood - Unconfigured good state -ready to be added in a RAID group.
* Jbod - JBOD state where the disks start showing up to Host OS.
EOT
type = string
}
Expand Down

0 comments on commit 4fd717a

Please sign in to comment.