Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update doc
  • Loading branch information
Ethan Lynn committed Dec 19, 2016
commit 09d63e774c1796b35a3c94d5635c02269559eb9b
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ Vagrant.configure("2") do |config|
vsphere.name = 'NEW VM NAME'
vsphere.user = 'YOUR VMWARE USER'
vsphere.password = 'YOUR VMWARE PASSWORD'
vsphere.networks = [
{'network': 'VM Network'},
{'network': 'VM Network 2'}
]
end
end
```
Expand Down Expand Up @@ -127,14 +131,10 @@ This provider has the following settings, all are required unless noted:
* `proxy_host` - _Optional_ proxy host name for connecting to vSphere via proxy
* `proxy_port` - _Optional_ proxy port number for connecting to vSphere via
proxy
* `vlan` - _Optional_ vlan to connect the first NIC to
* `memory_mb` - _Optional_ Configure the amount of memory (in MB) for the new VM
* `cpu_count` - _Optional_ Configure the number of CPUs for the new VM
* `mac` - _Optional_ Used to set the mac address of the new VM
* `cpu_reservation` - _Optional_ Configure the CPU time (in MHz) to reserve for this VM
* `mem_reservation` - _Optional_ Configure the memory (in MB) to reserve for this VM
* `addressType` - _Optional_ Configure the address type of the
[vSphere Virtual Ethernet Card](https://www.vmware.com/support/developer/vc-sdk/visdk2xpubs/ReferenceGuide/vim.vm.device.VirtualEthernetCard.html)
* `custom_attribute` - _Optional_ Add a
[custom attribute](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAAahUKEwiWwbWX59jHAhVBC5IKHa3HAEU&url=http%3A%2F%2Fpubs.vmware.com%2Fvsphere-51%2Ftopic%2Fcom.vmware.vsphere.vcenterhost.doc%2FGUID-25244732-D473-4857-A471-579257B6D95F.html&usg=AFQjCNGTSl4cauFrflUJpBeTBb0Yv7R13g&sig2=a9he6W2qVvBSZ5lCiXnENA)
to the VM upon creation. This method takes a key/value pair,
Expand All @@ -151,6 +151,14 @@ This provider has the following settings, all are required unless noted:
adapters exist on a host.
* `ip_address_timeout` _ _Optional_ Maximum number of seconds to wait while an
IP address is obtained
* `networks` - _Optional_ List of networks attached to VM. This property will shadow `vlan`, `addressType`, `mac` properties
* `network` - _Required_ Network name
* `adaptertype` - _Optional_ Either `e1000` or `vmxnet3`
* `mac` - _Optional_ Mac address of this adapter
* `vlan` - (_Deprecated_ Please use `networks` instead)_Optional_ vlan to connect the first NIC to
* `mac` - (_Deprecated_ Please use `networks` instead)_Optional_ Used to set the mac address of the new VM
* `addressType` - (_Deprecated_ Please use `networks` instead)_Optional_ Configure the address type of the
[vSphere Virtual Ethernet Card](https://www.vmware.com/support/developer/vc-sdk/visdk2xpubs/ReferenceGuide/vim.vm.device.VirtualEthernetCard.html)

### Cloning from a VM rather than a template

Expand Down
14 changes: 7 additions & 7 deletions lib/vSphere/action/clone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ def call(env)

spec[:customization] = get_customization_spec(machine, customization_info) unless customization_info.nil?

# env[:ui].info "Setting custom address: #{config.addressType}" unless config.addressType.nil?
# add_custom_address_type(template, spec, config.addressType) unless config.addressType.nil?
env[:ui].info "Setting custom address: #{config.addressType}" unless config.addressType.nil? || !config.networks.empty?
add_custom_address_type(template, spec, config.addressType) unless config.addressType.nil? || !config.networks.empty?

# env[:ui].info "Setting custom mac: #{config.mac}" unless config.mac.nil?
# add_custom_mac(template, spec, config.mac) unless config.mac.nil?
env[:ui].info "Setting custom mac: #{config.mac}" unless config.mac.nil? || !config.networks.empty?
add_custom_mac(template, spec, config.mac) unless config.mac.nil? || !config.networks.empty?

# env[:ui].info "Setting custom vlan: #{config.vlan}" unless config.vlan.nil?
# add_custom_vlan(template, dc, spec, config.vlan) unless config.vlan.nil?
env[:ui].info "Setting custom vlan: #{config.vlan}" unless config.vlan.nil? || !config.networks.empty?
add_custom_vlan(template, dc, spec, config.vlan) unless config.vlan.nil? || !config.networks.empty?

env[:ui].info "Setting custom networks: #{config.networks}" unless config.networks.empty?
add_custom_networks(template, spec, config.networks) unless config.networks.empty?
Expand Down Expand Up @@ -283,7 +283,7 @@ def add_custom_networks(template, spec, networks)
adaptertype = net[:adaptertype] || ''
mac = net[:mac] || ''
if mac == ''
addresstype = net[:addresstype] || 'generated'
addresstype = 'generated'
else
addresstype = 'manual'
end
Expand Down