From a0dd4f53c8607fac0410b245c4affca83290e695 Mon Sep 17 00:00:00 2001 From: Ahmad Musa <53178237+ahmadiesa-abu@users.noreply.github.com> Date: Sun, 24 Sep 2023 18:32:32 +0300 Subject: [PATCH] fix-extra-config (#259) * fix-extra-config * make-cpu-memory-hot-add-configurable --- CHANGELOG.txt | 3 +++ cloudify_vsphere/__version__.py | 2 +- plugin.yaml | 11 ++++++++++- plugin_1_4.yaml | 17 ++++++++++++++++- v2_plugin.yaml | 11 ++++++++++- vsphere_plugin_common/clients/server.py | 11 +++++++---- vsphere_server_plugin/server.py | 5 ++++- 7 files changed, 51 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c848b902..071eb005 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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: diff --git a/cloudify_vsphere/__version__.py b/cloudify_vsphere/__version__.py index 122f91bc..eac8ebbd 100644 --- a/cloudify_vsphere/__version__.py +++ b/cloudify_vsphere/__version__.py @@ -1 +1 @@ -version = '2.20.6' +version = '2.20.7' diff --git a/plugin.yaml b/plugin.yaml index 743c7e5f..7cad3142 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -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: @@ -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: diff --git a/plugin_1_4.yaml b/plugin_1_4.yaml index 5cf712fa..ab5dbc22 100755 --- a/plugin_1_4.yaml +++ b/plugin_1_4.yaml @@ -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: @@ -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: diff --git a/v2_plugin.yaml b/v2_plugin.yaml index 9e9e3f77..1676947f 100755 --- a/v2_plugin.yaml +++ b/v2_plugin.yaml @@ -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: @@ -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: diff --git a/vsphere_plugin_common/clients/server.py b/vsphere_plugin_common/clients/server.py index 8e7a7152..d50dea35 100644 --- a/vsphere_plugin_common/clients/server.py +++ b/vsphere_plugin_common/clients/server.py @@ -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( @@ -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() @@ -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 diff --git a/vsphere_server_plugin/server.py b/vsphere_server_plugin/server.py index 3581f94b..41135ec2 100644 --- a/vsphere_server_plugin/server.py +++ b/vsphere_server_plugin/server.py @@ -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