Browse Source

Merge "Add support for [disk_utils] parameters"

changes/14/824114/1
Zuul 4 months ago committed by Gerrit Code Review
parent
commit
52898fc97e
  1. 61
      manifests/disk_utils.pp
  2. 4
      releasenotes/notes/disk_utils-ff85c8b00595d8b8.yaml
  3. 60
      spec/classes/ironic_disk_utils_spec.rb

61
manifests/disk_utils.pp

@ -0,0 +1,61 @@
# == Class: ironic::disk_utils
#
# Configure the disk_utils parameters
#
# === Parameters
#
# [*efi_system_partition_size*]
# (optional) Size of EFI system partition in MiB when configuring UEFI systems
# for local boot.
# Defaults to $::os_service_default
#
# [*bios_boot_partition_size*]
# (optional) Size of BIOS Boot partition in MiB when configuring GPT
# partitioned systems for local boot in BIOS.
# Defaults to $::os_service_default
#
# [*dd_block_size*]
# (optional) Block size to use when writing to the node disk.
# Defaults to $::os_service_default
#
# [*partition_detection_attempts*]
# (optional) Maximum attempts to detect a newly created partition.
# Defaults to $::os_service_default
#
# [*partprobe_attempts*]
# (optional) Maximum number of attempts to try to read the partition.
# Defaults to $::os_service_default
#
# [*image_convert_memory_limit*]
# (optional) Memory limit for "qemu-img convert" in MiB. Implemented via
# the address space resource limit.
# Defaults to $::os_service_default
#
# [*image_convert_attempts*]
# (optional) Number of attempts to convert an image
# Defaults to $::os_service_default
#
class ironic::disk_utils (
$efi_system_partition_size = $::os_service_default,
$bios_boot_partition_size = $::os_service_default,
$dd_block_size = $::os_service_default,
$partition_detection_attempts = $::os_service_default,
$partprobe_attempts = $::os_service_default,
$image_convert_memory_limit = $::os_service_default,
$image_convert_attempts = $::os_service_default,
) {
include ironic::deps
include ironic::params
ironic_config {
'disk_utils/efi_system_partition_size': value => $efi_system_partition_size;
'disk_utils/bios_boot_partition_size': value => $bios_boot_partition_size;
'disk_utils/dd_block_size': value => $dd_block_size;
'disk_utils/partition_detection_attempts': value => $partition_detection_attempts;
'disk_utils/partprobe_attempts': value => $partprobe_attempts;
'disk_utils/image_convert_memory_limit': value => $image_convert_memory_limit;
'disk_utils/image_convert_attempts': value => $image_convert_attempts;
}
}

4
releasenotes/notes/disk_utils-ff85c8b00595d8b8.yaml

@ -0,0 +1,4 @@
---
features:
- |
The new ``ironic::disk_utils`` class has been added.

60
spec/classes/ironic_disk_utils_spec.rb

@ -0,0 +1,60 @@
require 'spec_helper'
describe 'ironic::disk_utils' do
shared_examples_for 'ironic::disk_utils' do
context 'with default parameters' do
let :params do
{}
end
it 'configures default values' do
is_expected.to contain_ironic_config('disk_utils/efi_system_partition_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('disk_utils/bios_boot_partition_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('disk_utils/dd_block_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('disk_utils/partition_detection_attempts').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('disk_utils/partprobe_attempts').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('disk_utils/image_convert_memory_limit').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('disk_utils/image_convert_attempts').with_value('<SERVICE DEFAULT>')
end
end
context 'with specific parameters' do
let :params do
{
:efi_system_partition_size => 200,
:bios_boot_partition_size => 1,
:dd_block_size => '1M',
:partition_detection_attempts => 3,
:partprobe_attempts => 10,
:image_convert_memory_limit => 2048,
:image_convert_attempts => 3,
}
end
it 'configures specified values' do
is_expected.to contain_ironic_config('disk_utils/efi_system_partition_size').with_value(200)
is_expected.to contain_ironic_config('disk_utils/bios_boot_partition_size').with_value(1)
is_expected.to contain_ironic_config('disk_utils/dd_block_size').with_value('1M')
is_expected.to contain_ironic_config('disk_utils/partition_detection_attempts').with_value(3)
is_expected.to contain_ironic_config('disk_utils/partprobe_attempts').with_value(10)
is_expected.to contain_ironic_config('disk_utils/image_convert_memory_limit').with_value(2048)
is_expected.to contain_ironic_config('disk_utils/image_convert_attempts').with_value(3)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'ironic::disk_utils'
end
end
end
Loading…
Cancel
Save