Skip to content

Commit

Permalink
Adding ability to vmware cloud create() so extra_config can be specif…
Browse files Browse the repository at this point in the history
…ied.
  • Loading branch information
nmadhok committed Apr 6, 2015
1 parent a19340d commit 3746d37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/topics/cloud/vmware.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ Set up an initial profile at ``/etc/salt/cloud.profiles`` or
host: c4212n-002.domain.com
template: False
power_on: True
extra_config:
guestinfo.SaltMaster: 10.20.30.140
provider
Expand Down Expand Up @@ -206,3 +208,9 @@ template
power_on
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``.

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.
8 changes: 8 additions & 0 deletions salt/cloud/clouds/vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,9 @@ def create(vm_):
devices = config.get_cloud_config_value(
'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_on', vm_, __opts__, default=False
)
Expand Down Expand Up @@ -1018,6 +1021,11 @@ def create(vm_):
device_specs = _manage_devices(devices, object_ref)
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
clone_spec = vim.vm.CloneSpec(
template=template,
Expand Down

0 comments on commit 3746d37

Please sign in to comment.