File fixes-56144-to-enable-hotadd-profile-support.patch of Package salt.20998

From 5761a11227c8d78df62d1a1552a50c0a4b76ae33 Mon Sep 17 00:00:00 2001
From: nicholasmhughes <nicholasmhughes@gmail.com>
Date: Fri, 14 Feb 2020 22:03:42 -0500
Subject: [PATCH] fixes #56144 to enable hotadd profile support

---
 doc/topics/cloud/vmware.rst |  8 ++++++++
 salt/cloud/clouds/vmware.py | 12 ++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/doc/topics/cloud/vmware.rst b/doc/topics/cloud/vmware.rst
index e4cb607e8d..0ac7c255a8 100644
--- a/doc/topics/cloud/vmware.rst
+++ b/doc/topics/cloud/vmware.rst
@@ -457,6 +457,14 @@ Set up an initial profile at ``/etc/salt/cloud.profiles`` or
     Specifies whether the new virtual machine should be powered on or not. If
     ``template: True`` is set, this field is ignored. Default is ``power_on: True``.
 
+``cpu_hot_add``
+    Boolean value that enables hot-add support for modifying CPU resources while
+    the guest is powered on.
+
+``mem_hot_add``
+    Boolean value that enables hot-add support for modifying memory resources while
+    the guest is powered on.
+
 ``extra_config``
     Specifies the additional configuration information for the virtual machine. This
     describes a set of modifications to the additional options. If the key is already
diff --git a/salt/cloud/clouds/vmware.py b/salt/cloud/clouds/vmware.py
index 5ebf448abc..edaca9618b 100644
--- a/salt/cloud/clouds/vmware.py
+++ b/salt/cloud/clouds/vmware.py
@@ -2824,6 +2824,12 @@ def create(vm_):
     win_run_once = config.get_cloud_config_value(
         "win_run_once", vm_, __opts__, search_global=False, default=None
     )
+    cpu_hot_add = config.get_cloud_config_value(
+        'cpu_hot_add', vm_, __opts__, search_global=False, default=None
+    )
+    mem_hot_add = config.get_cloud_config_value(
+        'mem_hot_add', vm_, __opts__, search_global=False, default=None
+    )
 
     # Get service instance object
     si = _get_si()
@@ -3042,6 +3048,12 @@ def create(vm_):
         )
         config_spec.deviceChange = specs["device_specs"]
 
+    if cpu_hot_add and hasattr(config_spec, 'cpuHotAddEnabled'):
+        config_spec.cpuHotAddEnabled = bool(cpu_hot_add)
+
+    if mem_hot_add and hasattr(config_spec, 'memoryHotAddEnabled'):
+        config_spec.memoryHotAddEnabled = bool(mem_hot_add)
+
     if extra_config:
         for key, value in six.iteritems(extra_config):
             option = vim.option.OptionValue(key=key, value=value)
-- 
2.29.2


openSUSE Build Service is sponsored by