Convert flavor properties to resource type properties

... because these are actually measurable.

Change-Id: I8d0c726c51aff7a8ec55e909d5e5f5cadebbed33
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-10-02 18:28:42 +09:00
parent 6c63bb719b
commit fd692c7b43
3 changed files with 11 additions and 11 deletions

View File

@@ -118,7 +118,7 @@ Puppet::Type.type(:nova_flavor).provide(
:disk => attrs[:disk], :disk => attrs[:disk],
:ephemeral => attrs[:ephemeral], :ephemeral => attrs[:ephemeral],
:vcpus => attrs[:vcpus], :vcpus => attrs[:vcpus],
:is_public => attrs[:is_public].downcase.chomp == 'true'? true : false, :is_public => attrs[:is_public].downcase.chomp == 'true'? :true : :false,
:swap => attrs[:swap], :swap => attrs[:swap],
:rxtx_factor => attrs[:rxtx_factor], :rxtx_factor => attrs[:rxtx_factor],
:properties => properties, :properties => properties,

View File

@@ -82,35 +82,35 @@ Puppet::Type.newtype(:nova_flavor) do
end end
end end
newparam(:id) do newproperty(:id) do
desc 'Unique ID (integer or UUID) for the flavor.' desc 'Unique ID (integer or UUID) for the flavor.'
end end
newparam(:ram) do newproperty(:ram) do
desc 'Amount of RAM to use (in megabytes).' desc 'Amount of RAM to use (in megabytes).'
end end
newparam(:disk) do newproperty(:disk) do
desc 'Amount of disk space (in gigabytes) to use for the root (/) partition.' desc 'Amount of disk space (in gigabytes) to use for the root (/) partition.'
end end
newparam(:vcpus) do newproperty(:vcpus) do
desc 'Number of virtual CPUs to use.' desc 'Number of virtual CPUs to use.'
end end
newparam(:ephemeral) do newproperty(:ephemeral) do
desc 'Amount of disk space (in gigabytes) to use for the ephemeral partition.' desc 'Amount of disk space (in gigabytes) to use for the ephemeral partition.'
end end
newparam(:swap) do newproperty(:swap) do
desc 'Amount of swap space (in megabytes) to use.' desc 'Amount of swap space (in megabytes) to use.'
end end
newparam(:rxtx_factor) do newproperty(:rxtx_factor) do
desc 'The slice of bandwidth that the instances with this flavor can use (through the Virtual Interface (vif) creation in the hypervisor)' desc 'The slice of bandwidth that the instances with this flavor can use (through the Virtual Interface (vif) creation in the hypervisor)'
end end
newparam(:is_public) do newproperty(:is_public) do
desc "Whether the flavor is public or not. Default true" desc "Whether the flavor is public or not. Default true"
newvalues(/(y|Y)es/, /(n|N)o/, /(t|T)rue/, /(f|F)alse/, true, false) newvalues(/(y|Y)es/, /(n|N)o/, /(t|T)rue/, /(f|F)alse/, true, false)
defaultto(true) defaultto(true)

View File

@@ -164,7 +164,7 @@ domain_id="domain_one_id"
expect(instances[0].disk).to eq('2') expect(instances[0].disk).to eq('2')
expect(instances[0].ephemeral).to eq('0') expect(instances[0].ephemeral).to eq('0')
expect(instances[0].vcpus).to eq('1') expect(instances[0].vcpus).to eq('1')
expect(instances[0].is_public).to eq(true) expect(instances[0].is_public).to eq(:true)
expect(instances[0].swap).to eq('0') expect(instances[0].swap).to eq('0')
expect(instances[0].rxtx_factor).to eq('1.0') expect(instances[0].rxtx_factor).to eq('1.0')
expect(instances[0].properties).to eq({}) expect(instances[0].properties).to eq({})
@@ -176,7 +176,7 @@ domain_id="domain_one_id"
expect(instances[1].disk).to eq('2') expect(instances[1].disk).to eq('2')
expect(instances[1].ephemeral).to eq('0') expect(instances[1].ephemeral).to eq('0')
expect(instances[1].vcpus).to eq('1') expect(instances[1].vcpus).to eq('1')
expect(instances[1].is_public).to eq(false) expect(instances[1].is_public).to eq(:false)
expect(instances[1].swap).to eq('0') expect(instances[1].swap).to eq('0')
expect(instances[1].rxtx_factor).to eq('1.0') expect(instances[1].rxtx_factor).to eq('1.0')
expect(instances[1].properties).to eq({'key1' => 'val1', 'key2' => 'val2'}) expect(instances[1].properties).to eq({'key1' => 'val1', 'key2' => 'val2'})