@@ -3033,7 +3033,7 @@ def _vm_serial_port_spec(port_index:int=None, port_type:str='null', **kwargs):
3033
3033
3034
3034
return serial_port
3035
3035
3036
- def create (self , name :str , vcpus :int , memory_gb :int , sockets :int = 1 , vcpu_reservation_hz :int = 0 , memory_reservation_gb :int = 0 , description :str = '' ,
3036
+ def create (self , name :str , cores :int , memory_gb :int , sockets :int = 1 , vcpu_reservation_hz :int = 0 , memory_reservation_gb :int = 0 , description :str = '' ,
3037
3037
power_state :str = 'on' , disks :list = [], storage_container_uuid :str = None , nics :list = [], gpus :list = [], serial_ports :list = [], timezone :str = 'UTC' ,
3038
3038
sysprep :str = None , cloudinit :str = None , add_cdrom :bool = True , ha_priority :int = 0 , machine_type :str = 'pc' , wait :bool = True , clusteruuid :str = None ):
3039
3039
""" Create a new virtual machine.
@@ -3042,12 +3042,12 @@ def create(self, name:str, vcpus:int, memory_gb:int, sockets:int=1, vcpu_reserva
3042
3042
:type name: str
3043
3043
:param description: A description for the VM (default='')
3044
3044
:type description: str, optional
3045
- :param vcpus: The number of vCPUs to be assigned to this VM
3046
- :type vcpus: int
3047
- :param memory_gb: The amount of memory in GB to be assigne to this VM
3048
- :type memory_gb: int
3045
+ :param cores: The number of virtual CPU cores per virtual CPU socket
3046
+ :type cores: int
3049
3047
:param sockets: The number of virtual CPU sockets to distribute the defined vCPUs over (default=1)
3050
3048
:type sockets: int, optional
3049
+ :param memory_gb: The amount of memory in GB to be assigne to this VM
3050
+ :type memory_gb: int
3051
3051
:param vcpu_reservation_hz: A CPU reservation in hz for this VM. Only applicable on the ESXi hypervisor. (default=0)
3052
3052
:type vcpu_reservation_hz: int, optional
3053
3053
:param memory_reservation_gb: An amount of memory to lock to this VM. Only applicable on the ESXi hypervisor. (default=0)
@@ -3154,8 +3154,8 @@ def create(self, name:str, vcpus:int, memory_gb:int, sockets:int=1, vcpu_reserva
3154
3154
'name' : name ,
3155
3155
'description' : description ,
3156
3156
'memory_mb' : int (bm_memory_mb ),
3157
+ 'num_vcpus' : cores ,
3157
3158
'sockets' : sockets ,
3158
- 'num_vcpus' : (vcpus / sockets ),
3159
3159
'power_state' : 'OFF' ,
3160
3160
'timezone' : timezone ,
3161
3161
'ha_priority' : ha_priority ,
@@ -4054,7 +4054,7 @@ def power_state(self, uuid:str, desired_state:str='on', wait:bool=True, clusteru
4054
4054
else :
4055
4055
return False
4056
4056
4057
- def update_name (self , name :str , new_name :str = None , vcpus :int = None , memory_gb :int = None , sockets :int = None , vcpu_reservation_hz :int = None ,
4057
+ def update_name (self , name :str , new_name :str = None , cores :int = None , sockets :int = None , memory_gb :int = None , vcpu_reservation_hz :int = None ,
4058
4058
memory_reservation_gb :int = None , description :str = None , disks :list = [], nics :list = [], gpus :list = [], serial_ports :list = [], timezone :str = None ,
4059
4059
add_cdrom :bool = None , ha_priority :int = None , force :bool = False , wait :bool = True , clusteruuid :str = None ):
4060
4060
"""Updates a specific virtual machine by the vm name provided.
@@ -4063,12 +4063,12 @@ def update_name(self, name:str, new_name:str=None, vcpus:int=None, memory_gb:int
4063
4063
:type name: str
4064
4064
:param new_name: A new name for the virtual machine.
4065
4065
:type new_name: str, optional
4066
- :param vcpus: The number of vCPUs to be assigned to this VM
4067
- :type vcpus: int
4068
- :param memory_gb: The amount of memory in GB to be assigne to this VM
4069
- :type memory_gb: int
4066
+ :param cores: The number of virtual CPU cores per virtual CPU socket
4067
+ :type cores: int
4070
4068
:param sockets: The number of virtual CPU sockets to distribute the defined vCPUs over (default=1)
4071
4069
:type sockets: int, optional
4070
+ :param memory_gb: The amount of memory in GB to be assigne to this VM
4071
+ :type memory_gb: int
4072
4072
:param vcpu_reservation_hz: A CPU reservation in hz for this VM. Only applicable on the ESXi hypervisor. (default=0)
4073
4073
:type vcpu_reservation_hz: int, optional
4074
4074
:param memory_reservation_gb: An amount of memory to lock to this VM. Only applicable on the ESXi hypervisor. (default=0)
@@ -4157,7 +4157,7 @@ def update_name(self, name:str, new_name:str=None, vcpus:int=None, memory_gb:int
4157
4157
vm_config = {
4158
4158
'uuid' : vm .get ('uuid' ),
4159
4159
'new_name' : new_name ,
4160
- 'vcpus ' : vcpus ,
4160
+ 'cores ' : cores ,
4161
4161
'memory_gb' : memory_gb ,
4162
4162
'sockets' : sockets ,
4163
4163
'vcpu_reservation_hz' : vcpu_reservation_hz ,
@@ -4178,7 +4178,7 @@ def update_name(self, name:str, new_name:str=None, vcpus:int=None, memory_gb:int
4178
4178
else :
4179
4179
raise ValueError ()
4180
4180
4181
- def update_uuid (self , uuid :str , new_name :str = None , vcpus :int = None , memory_gb :int = None , sockets :int = None , vcpu_reservation_hz :int = None ,
4181
+ def update_uuid (self , uuid :str , new_name :str = None , cores :int = None , sockets :int = None , memory_gb :int = None , vcpu_reservation_hz :int = None ,
4182
4182
memory_reservation_gb :int = None , description :str = None , disks :list = [], nics :list = [], gpus :list = [], serial_ports :list = [], timezone :str = None ,
4183
4183
add_cdrom :bool = None , ha_priority :int = None , force :bool = False , wait :bool = True , clusteruuid :str = None ):
4184
4184
"""Updates a specific virtual machine by the uuid provided
@@ -4187,10 +4187,10 @@ def update_uuid(self, uuid:str, new_name:str=None, vcpus:int=None, memory_gb:int
4187
4187
:type uuid: str
4188
4188
:param new_name: A new name for the virtual machine.
4189
4189
:type new_name: str, optional
4190
- :param vcpus: The number of vCPUs to be assigned to this VM
4191
- :type vcpus: int
4192
4190
:param memory_gb: The amount of memory in GB to be assigne to this VM
4193
4191
:type memory_gb: int
4192
+ :param cores: The number of virtual CPU cores per virtual CPU socket
4193
+ :type cores: int
4194
4194
:param sockets: The number of virtual CPU sockets to distribute the defined vCPUs over (default=1)
4195
4195
:type sockets: int, optional
4196
4196
:param vcpu_reservation_hz: A CPU reservation in hz for this VM. Only applicable on the ESXi hypervisor. (default=0)
@@ -4305,15 +4305,13 @@ def update_uuid(self, uuid:str, new_name:str=None, vcpus:int=None, memory_gb:int
4305
4305
bm_memory_mb = bm_memory_gb .to_MB ()
4306
4306
payload ['memory_mb' ] = int (bm_memory_mb )
4307
4307
4308
- if sockets :
4308
+ if cores :
4309
4309
required_power_state = 'off'
4310
- payload ['sockets' ] = sockets
4311
- else :
4312
- sockets = vm .get ('sockets' )
4310
+ payload ['num_vcpus' ] = cores
4313
4311
4314
- if vcpus :
4312
+ if sockets :
4315
4313
required_power_state = 'off'
4316
- payload ['num_vcpus ' ] = ( vcpus / sockets )
4314
+ payload ['sockets ' ] = sockets
4317
4315
4318
4316
if timezone :
4319
4317
payload ['timezone' ] = timezone
0 commit comments