Open johnhenriksson opened 7 years ago
Thanks for reporting this! It's a national holiday in the US, so I may not get to this for a few days. I'll certainly take a look as soon as I can. Thanks again for reporting this!
Can I see what you are passing into vm_clone
for nicSettingMap
? nicSettingMap
expects an Array
, but it looks like you may be passing something else?
@johnhenriksson Hey, I haven't heard back from you. I was curious if you're still having this issue. If so, can you send a copy (scrubbed if necessary) of what you are passing in?
Thanks for the response, I've been busy and unable to respond.
Here's my script and with this I get the error message fault.NicSettingMismatch.summary
require 'rubygems'
require 'fog'
require 'pp'
connection = Fog::Compute.new(
provider: :vsphere,
vsphere_username: 'administrator',
vsphere_password: '*************',
vsphere_server: 'X.X.X.X',
vsphere_expected_pubkey_hash: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
vsphere_ssl: true,
vsphere_rev: '6.0'
)
puts "Connected to #{connection.vsphere_server} as #{connection.vsphere_username} (API version #{connection.vsphere_rev})"
options = {
'datacenter' => 'VIRTUAL_DATACENTER',
'template_path' => '/mall_labb',
'network_name' => ["NETWORK_NAME"],
'power_on' => true,
'memoryMB' => '1024',
# # 'network_label' => '172.18.2.x',
'numCPUs' => 2,
'datastore' => 'VSA_VOL_1',
'wait' => true,
'name' => 'Tester',
'customization_spec' => {
'interfaces' => {
'nic_type' => 'VirtualE1000',
},
'nicSettingMap' => [
'adapter' => {
'ipsettings' => {
'ip' => '172.16.0.17',
'gateway' => ['172.16.0.1'],
'subnetMask' => '255.255.255.0',
},
},
],
'identity' => {
'Sysprep' => {
'guiUnattended' => {
'autoLogon' => false,
'autoLogonCount' => 0,
'timeZone' => 110,
'password' => {
'value' => 'P@ssw0rd',
'plainText' => true,
},
},
'identification' => {
'joinWorkgroup' => 'WORKGROUP',
},
'userData' => {
'computerName' => 'test',
'fullName' => 'Tester',
'orgName' => 'My Company',
'productId' => 'XXXX-XXXX-XXXX-XXXX1',
},
'options' => {
'changeSID' => true,
},
},
},
# 'domain' => 'example.com',
'globalIPSettings' => {
'dnsServerList' => ['172.16.0.18'],
},
},
}
# }
puts "Deploying new VM from template. This may take a few minutes..."
new_vm=connection.vm_clone(options)
pp new_vm
Thanks! I'll take a look at this today and see what I can find!
@johnhenriksson Based on
require 'rubygems'
require 'fog'
I'm curious what version of fog/fog-vsphere you are using. Can you show me the output of gem list fog
?
Here's the output :)
username@machine:~/workspace/vcenter_ruby$ gem list fog
*** LOCAL GEMS ***
fog (1.38.0)
fog-aliyun (0.1.0)
fog-atmos (0.1.0)
fog-aws (0.12.0)
fog-brightbox (0.11.0)
fog-cloudatcost (0.1.2)
fog-core (1.43.0)
fog-dynect (0.0.3)
fog-ecloud (0.3.0)
fog-google (0.4.2, 0.1.0)
fog-json (1.0.2)
fog-local (0.3.1)
fog-openstack (0.1.17)
fog-powerdns (0.1.1)
fog-profitbricks (3.0.0)
fog-rackspace (0.1.2)
fog-radosgw (0.0.5)
fog-riakcs (0.1.0)
fog-sakuracloud (1.7.5)
fog-serverlove (0.1.2)
fog-softlayer (1.1.4)
fog-storm_on_demand (0.1.1)
fog-terremark (0.1.0)
fog-vmfusion (0.1.0)
fog-voxel (0.1.0)
fog-vsphere (1.5.1)
fog-xenserver (0.2.3)
fog-xml (0.1.2)
I'm still looking into this, but I'm having trouble recreating it with the code provided. Updating just to let you know I haven't dropped this.
I'm unable to set the property nicSettingMap in the customization_spec. More info here http://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.customization.Specification.html#field_detail
I get this error message,
/Users/john/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fog-vsphere-1.5.1/lib/fog/vsphere/requests/compute/vm_clone.rb:455:in
vm_clone': undefined method
key?' for nil:NilClass (NoMethodError)