@@ -4,10 +4,10 @@ def reconfigurable?
44 end
55
66 def max_total_vcpus
7- # This is based on CurrentMaximumVirtualProcessorsPerAIXOrLinuxPartition and
8- # CurrentMaximumVirtualProcessorsPerVirtualIOServerPartition settings for CECs .
7+ # 64 is based on the CEC's CurrentMaximumVirtualProcessorsPerAIXOrLinuxPartition and
8+ # CurrentMaximumVirtualProcessorsPerVirtualIOServerPartition settings.
99 # This can be further reduced by the partition's MaximumVirtualProcessors setting.
10- 64
10+ host && processor_share_type == "dedicated" ? host . cpu_total_cores : 64
1111 end
1212
1313 def max_vcpus
@@ -27,9 +27,6 @@ def build_config_spec(options)
2727
2828 lpar = ext_management_system . with_provider_connection { |connection | provider_object ( connection ) }
2929
30- # We do not support partitions with dedicated CPUs yet (would require changes to the SDK).
31- raise MiqException ::MiqVmError , "Cannot change number of dedicated CPUs" if lpar . dedicated == "true" && options . key? ( :number_of_cpus )
32-
3330 # Dynamic Reconfiguration requires RMC to be active.
3431 raise MiqException ::MiqVmError , "RMC is not active on target" if lpar . state == "running" && lpar . rmc_state != "active"
3532
@@ -39,7 +36,8 @@ def build_config_spec(options)
3936
4037 spec = { }
4138 build_memory_config_spec ( lpar , spec , options ) if options . key? ( :vm_memory )
42- build_vproc_config_spec ( lpar , spec , options ) if options . key? ( :number_of_cpus )
39+ build_proc_config_spec ( lpar , spec , options ) if options . key? ( :number_of_cpus ) && lpar . dedicated == "true"
40+ build_vproc_config_spec ( lpar , spec , options ) if options . key? ( :number_of_cpus ) && lpar . dedicated != "true"
4341 build_netadap_create_config_spec ( spec , options ) if options . key? ( :network_adapter_add )
4442 build_netadap_delete_config_spec ( spec , options ) if options . key? ( :network_adapter_remove )
4543
@@ -55,6 +53,15 @@ def build_memory_config_spec(lpar, spec, options)
5553 spec [ :desired_memory ] = desired_memory
5654 end
5755
56+ def build_proc_config_spec ( lpar , spec , options )
57+ desired_procs = options [ :number_of_cpus ] . to_i
58+
59+ raise MiqException ::MiqVmError , "Processor count cannot be lower than #{ lpar . minimum_procs } " if desired_procs < lpar . minimum_procs . to_i
60+ raise MiqException ::MiqVmError , "Processor count cannot be greater than #{ lpar . maximum_procs } " if desired_procs > lpar . maximum_procs . to_i
61+
62+ spec [ :desired_procs ] = desired_procs
63+ end
64+
5865 def build_vproc_config_spec ( lpar , spec , options )
5966 desired_vprocs = options [ :number_of_cpus ] . to_i
6067
@@ -92,7 +99,7 @@ def raw_reconfigure(spec)
9299 $ibm_power_hmc_log. debug ( "reconfiguring with spec=#{ spec } " )
93100
94101 ext_management_system . with_provider_connection do |connection |
95- attrs = spec . slice ( :desired_memory , :desired_vprocs )
102+ attrs = spec . slice ( :desired_memory , :desired_procs , : desired_vprocs)
96103 modify_attrs ( connection , attrs ) unless attrs . empty?
97104
98105 spec [ :netadap_delete ] . try ( :each ) do |uuid |
0 commit comments