Merge pull request #22394 from nmadhok/vmware-extra_config

Adding ability to vmware cloud create() so extra_config can be specified
This commit is contained in:
Justin Findlay 2015-04-06 17:51:59 -06:00
commit 305ce35a09
2 changed files with 20 additions and 0 deletions

View File

@ -95,6 +95,12 @@ Set up an initial profile at ``/etc/salt/cloud.profiles`` or
host: c4212n-002.domain.com host: c4212n-002.domain.com
template: False template: False
power_on: True power_on: True
extra_config:
mem.hotadd: 'yes'
guestinfo.saltMaster: 10.20.30.140
guestinfo.domain: foobar.com
contactGroup: 'Core Infrastructure'
randomKey: randomValue
provider provider
@ -206,3 +212,9 @@ template
power_on power_on
Specifies whether the new virtual machine should be powered on or not. If 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``. ``template: True`` is set, this field is ignored. Default is ``power_on: True``.
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
present, it will be reset with the new value provided. Otherwise, a new option is
added. Keys with empty values will be removed.

View File

@ -954,6 +954,9 @@ def create(vm_):
devices = config.get_cloud_config_value( devices = config.get_cloud_config_value(
'devices', vm_, __opts__, default=None 'devices', vm_, __opts__, default=None
) )
extra_config = config.get_cloud_config_value(
'extra_config', vm_, __opts__, default=None
)
power = config.get_cloud_config_value( power = config.get_cloud_config_value(
'power_on', vm_, __opts__, default=False 'power_on', vm_, __opts__, default=False
) )
@ -1018,6 +1021,11 @@ def create(vm_):
device_specs = _manage_devices(devices, object_ref) device_specs = _manage_devices(devices, object_ref)
config_spec.deviceChange = device_specs config_spec.deviceChange = device_specs
if extra_config:
for key, value in extra_config.iteritems():
option = vim.option.OptionValue(key=key, value=value)
config_spec.extraConfig.append(option)
# Create the clone specs # Create the clone specs
clone_spec = vim.vm.CloneSpec( clone_spec = vim.vm.CloneSpec(
template=template, template=template,