Skip to content

Commit

Permalink
fix-extra-config (#259)
Browse files Browse the repository at this point in the history
* fix-extra-config

* make-cpu-memory-hot-add-configurable
  • Loading branch information
ahmadiesa-abu authored Sep 24, 2023
1 parent 37c3ad1 commit a0dd4f5
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2.20.7:
- Fix Extra_config when creating new server.
- Make cpu/memory hot_add/remove configurable.
2.20.6:
- Add support for attaching/detaching PCI/Serial on turned off machine already
2.20.5:
Expand Down
2 changes: 1 addition & 1 deletion cloudify_vsphere/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '2.20.6'
version = '2.20.7'
11 changes: 10 additions & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins:
vsphere:
executor: central_deployment_agent
package_name: cloudify-vsphere-plugin
package_version: '2.20.6'
package_version: '2.20.7'

data_types:

Expand Down Expand Up @@ -66,6 +66,15 @@ data_types:
disk_size:
type: integer
required: false
cpu_hot_add:
type: boolean
default: true
cpu_hot_remove:
type: boolean
default: true
memory_hot_add:
type: boolean
default: true

cloudify.datatypes.vsphere.NetworkingProperties:
properties:
Expand Down
17 changes: 16 additions & 1 deletion plugin_1_4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins:
vsphere:
executor: central_deployment_agent
package_name: cloudify-vsphere-plugin
package_version: '2.20.6'
package_version: '2.20.7'

data_types:

Expand Down Expand Up @@ -122,6 +122,21 @@ data_types:
Disk size in GBs.
type: integer
required: false
cpu_hot_add:
description: >
control whether to have cpu_hot_add enabled or not.
type: boolean
default: true
cpu_hot_remove:
description: >
control whether to have cpu_hot_remove enabled or not.
type: boolean
default: true
memory_hot_add:
description: >
control whether to have memory_hot_add enabled or not.
type: boolean
default: true

cloudify.datatypes.vsphere.NetworkingProperties:
properties:
Expand Down
11 changes: 10 additions & 1 deletion v2_plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins:
vsphere:
executor: central_deployment_agent
package_name: cloudify-vsphere-plugin
package_version: '2.20.6'
package_version: '2.20.7'

data_types:

Expand Down Expand Up @@ -70,6 +70,15 @@ data_types:
disk_size:
type: integer
required: false
cpu_hot_add:
type: boolean
default: true
cpu_hot_remove:
type: boolean
default: true
memory_hot_add:
type: boolean
default: true

cloudify.datatypes.vsphere.NetworkingProperties:
properties:
Expand Down
11 changes: 7 additions & 4 deletions vsphere_plugin_common/clients/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@ def create_server(
clone_vm=None,
disk_provision_type=None,
disk_size=None,
cpu_hot_add=True,
cpu_hot_remove=True,
memory_hot_add=True,
**_):

self._logger.debug(
Expand Down Expand Up @@ -705,9 +708,9 @@ def create_server(
vmconf = vim.vm.ConfigSpec()
vmconf.numCPUs = cpus
vmconf.memoryMB = memory
vmconf.cpuHotAddEnabled = True
vmconf.memoryHotAddEnabled = True
vmconf.cpuHotRemoveEnabled = True
vmconf.cpuHotAddEnabled = cpu_hot_add
vmconf.memoryHotAddEnabled = memory_hot_add
vmconf.cpuHotRemoveEnabled = cpu_hot_remove
vmconf.deviceChange = devices

clonespec = vim.vm.CloneSpec()
Expand All @@ -721,7 +724,7 @@ def create_server(
self._logger.debug('Extra config: {config}'
.format(config=text_type(extra_config)))
for k in extra_config:
clonespec.extraConfig.append(
vmconf.extraConfig.append(
vim.option.OptionValue(key=k, value=extra_config[k]))

# if we pass 'none' value from the node properties inside os_family
Expand Down
5 changes: 4 additions & 1 deletion vsphere_server_plugin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ def create_new_server(server_client,
retry=ctx.operation.retry_number > 0,
clone_vm=server.get('clone_vm'),
disk_provision_type=server.get('disk_provision_type'),
disk_size=server.get('disk_size'))
disk_size=server.get('disk_size'),
cpu_hot_add=server.get('cpu_hot_add'),
cpu_hot_remove=server.get('cpu_hot_remove'),
memory_hot_add=server.get('memory_hot_add'))
ctx.logger.info('Created server called {name}'.format(name=vm_name))
return server_obj

Expand Down

0 comments on commit a0dd4f5

Please sign in to comment.