kitchen-vsphere icon indicating copy to clipboard operation
kitchen-vsphere copied to clipboard

Example

Open rodrigdav opened this issue 11 years ago • 16 comments

Could you provide an example of your kitchen yaml? I am getting the following error.

E, [2015-02-20T15:57:50.719992 #88856] ERROR -- Kitchen: ------Backtrace------- E, [2015-02-20T15:57:50.720002 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:61:in parse_response' E, [2015-02-20T15:57:50.720012 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:90:incall' E, [2015-02-20T15:57:50.720022 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:205:in _call' E, [2015-02-20T15:57:50.720031 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:74:inblock (2 levels) in init' E, [2015-02-20T15:57:50.720041 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/fog-1.27.0/lib/fog/vsphere/requests/compute/vm_clone.rb:237:in vm_clone' E, [2015-02-20T15:57:50.720060 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/kitchen-vsphere-0.2.0/lib/kitchen/driver/vsphere.rb:95:increate_server' E, [2015-02-20T15:57:50.720072 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/kitchen-vsphere-0.2.0/lib/kitchen/driver/vsphere.rb:54:in create' E, [2015-02-20T15:57:50.720082 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:352:inpublic_send' E, [2015-02-20T15:57:50.720091 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:352:in block in perform_action' E, [2015-02-20T15:57:50.720101 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:416:incall' E, [2015-02-20T15:57:50.720111 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:416:in synchronize_or_call' E, [2015-02-20T15:57:50.720120 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:381:inblock in action' E, [2015-02-20T15:57:50.720130 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in measure' E, [2015-02-20T15:57:50.720139 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:380:inaction' E, [2015-02-20T15:57:50.720149 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:352:in perform_action' E, [2015-02-20T15:57:50.720158 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:303:increate_action' E, [2015-02-20T15:57:50.720168 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:292:in block in transition_to' E, [2015-02-20T15:57:50.720177 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:291:ineach' E, [2015-02-20T15:57:50.720223 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:291:in transition_to' E, [2015-02-20T15:57:50.720248 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:152:inverify' E, [2015-02-20T15:57:50.720261 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:181:in block in test' E, [2015-02-20T15:57:50.720272 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:inmeasure' E, [2015-02-20T15:57:50.720283 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:177:in test' E, [2015-02-20T15:57:50.720293 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/command.rb:176:inpublic_send' E, [2015-02-20T15:57:50.720303 #88856] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/command.rb:176:in `block (2 levels) in run_action' E, [2015-02-20T15:57:50.720313 #88856] ERROR -- Kitchen: ---------------------- I, [2015-02-20T16:01:04.606980 #88871] INFO -- Kitchen: -----> Starting Kitchen (v1.3.1) I, [2015-02-20T16:01:07.069873 #88871] INFO -- Kitchen: -----> Cleaning up any prior instances of I, [2015-02-20T16:01:07.070382 #88871] INFO -- Kitchen: -----> Destroying ... I, [2015-02-20T16:01:07.071236 #88871] INFO -- Kitchen: -----> Testing I, [2015-02-20T16:01:07.071306 #88871] INFO -- Kitchen: -----> Creating ... E, [2015-02-20T16:01:07.500678 #88871] ERROR -- Kitchen: ------Exception------- E, [2015-02-20T16:01:07.500723 #88871] ERROR -- Kitchen: Class: Kitchen::ActionFailed E, [2015-02-20T16:01:07.500751 #88871] ERROR -- Kitchen: Message: Failed to complete #create action: [InvalidRequest: Cannot parse "E1000" as an int value

while parsing serialized value of type int at line 1, column 710

while parsing property "key" of static type int

while parsing serialized DataObject of type vim.vm.device.VirtualE1000 at line 1, column 678

while parsing property "device" of static type VirtualDevice

while parsing serialized DataObject of type vim.vm.device.VirtualDeviceSpec at line 1, column 602

while parsing property "deviceChange" of static type ArrayOfVirtualDeviceConfigSpec

while parsing serialized DataObject of type vim.vm.ConfigSpec at line 1, column 558

while parsing property "config" of static type VirtualMachineConfigSpec

while parsing serialized DataObject of type vim.vm.CloneSpec at line 1, column 363

while parsing call information for method CloneVM_Task at line 1, column 177

while parsing SOAP body at line 1, column 167

while parsing SOAP envelope at line 1, column 0

while parsing HTTP request for method clone on object of type vim.VirtualMachine at line 1, column 0] E, [2015-02-20T16:01:07.500768 #88871] ERROR -- Kitchen: ---Nested Exception--- E, [2015-02-20T16:01:07.500782 #88871] ERROR -- Kitchen: Class: RbVmomi::Fault E, [2015-02-20T16:01:07.500794 #88871] ERROR -- Kitchen: Message: InvalidRequest: Cannot parse "E1000" as an int value

while parsing serialized value of type int at line 1, column 710

while parsing property "key" of static type int

while parsing serialized DataObject of type vim.vm.device.VirtualE1000 at line 1, column 678

while parsing property "device" of static type VirtualDevice

while parsing serialized DataObject of type vim.vm.device.VirtualDeviceSpec at line 1, column 602

while parsing property "deviceChange" of static type ArrayOfVirtualDeviceConfigSpec

while parsing serialized DataObject of type vim.vm.ConfigSpec at line 1, column 558

while parsing property "config" of static type VirtualMachineConfigSpec

while parsing serialized DataObject of type vim.vm.CloneSpec at line 1, column 363

while parsing call information for method CloneVM_Task at line 1, column 177

while parsing SOAP body at line 1, column 167

while parsing SOAP envelope at line 1, column 0

while parsing HTTP request for method clone on object of type vim.VirtualMachine at line 1, column 0 E, [2015-02-20T16:01:07.500808 #88871] ERROR -- Kitchen: ------Backtrace------- E, [2015-02-20T16:01:07.500821 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:61:in parse_response' E, [2015-02-20T16:01:07.500834 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/connection.rb:90:incall' E, [2015-02-20T16:01:07.500847 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:205:in _call' E, [2015-02-20T16:01:07.500860 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:74:inblock (2 levels) in init' E, [2015-02-20T16:01:07.500873 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/fog-1.27.0/lib/fog/vsphere/requests/compute/vm_clone.rb:237:in vm_clone' E, [2015-02-20T16:01:07.500887 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/kitchen-vsphere-0.2.0/lib/kitchen/driver/vsphere.rb:95:increate_server' E, [2015-02-20T16:01:07.500900 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/kitchen-vsphere-0.2.0/lib/kitchen/driver/vsphere.rb:54:in create' E, [2015-02-20T16:01:07.500913 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:352:inpublic_send' E, [2015-02-20T16:01:07.500926 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:352:in block in perform_action' E, [2015-02-20T16:01:07.500939 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:416:incall' E, [2015-02-20T16:01:07.500959 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:416:in synchronize_or_call' E, [2015-02-20T16:01:07.500974 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:381:inblock in action' E, [2015-02-20T16:01:07.500987 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in measure' E, [2015-02-20T16:01:07.501000 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:380:inaction' E, [2015-02-20T16:01:07.501013 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:352:in perform_action' E, [2015-02-20T16:01:07.501026 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:303:increate_action' E, [2015-02-20T16:01:07.501048 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:292:in block in transition_to' E, [2015-02-20T16:01:07.501061 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:291:ineach' E, [2015-02-20T16:01:07.501074 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:291:in transition_to' E, [2015-02-20T16:01:07.501087 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:152:inverify' E, [2015-02-20T16:01:07.501100 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:181:in block in test' E, [2015-02-20T16:01:07.501113 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:inmeasure' E, [2015-02-20T16:01:07.501126 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/instance.rb:177:in test' E, [2015-02-20T16:01:07.501139 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/command.rb:176:inpublic_send' E, [2015-02-20T16:01:07.501152 #88871] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.3.1/lib/kitchen/command.rb:176:in `block (2 levels) in run_action' E, [2015-02-20T16:01:07.501164 #88871] ERROR -- Kitchen: ----------------------

rodrigdav avatar Feb 20 '15 21:02 rodrigdav

I would also love to see an example block in the readme to demonstrate how to obtain the values for "network_adapter_device_key" for all the available networks. This is something which I am finding not so straight forward, to figure out.

rhass-r7 avatar Feb 22 '15 20:02 rhass-r7

I agree with you.

rodrigdav avatar Feb 24 '15 15:02 rodrigdav

It's been a while since I've used this driver but I think it may have been this setting that forced me to abandon it in favor of direct access via rbvmomi. That or some other networking or storage config.

If someone else knows how to get to that setting via the fog API, a pr is welcome.

mwrock avatar Feb 24 '15 17:02 mwrock

Honestly it has been so long since I fought this and was able to resolve it. Ended up using 4000 for network_adapter_device_key. I think this came from digging through random google searches on vsphere and network configuration.

network_adapter_device_key: 4000

I wish I had a better way to describe how I came up with this but I think it was just google + trial and error unfortunately.

zarry avatar Mar 02 '15 20:03 zarry

I've found the value 4000 works in my environment too

cmluciano avatar Apr 16 '15 14:04 cmluciano

4000 worked for us as well.

mwrock avatar Apr 16 '15 15:04 mwrock

@mwrock do you think this should be a README change or a code change? I can push up a commit for either. In the code I don't see an obvious place to put a [:network_key] ||= 4000, so I imagine this is coming from fog itself.

cmluciano avatar Apr 16 '15 15:04 cmluciano

4000 doesn't work for me though.

rhass-r7 avatar Apr 17 '15 01:04 rhass-r7

Aw poop. I can try to poke around the APIs and see what I can expose.

cmluciano avatar Apr 17 '15 12:04 cmluciano

I will give 4000 a shot and see what I find.

rodrigdav avatar Apr 17 '15 13:04 rodrigdav

looked this up and here is how i get the key from an existing VM using direct rbvmomi:

vm.config.hardware.device.each do |d| 
  puts d.key if d.is_a?(RbVmomi::VIM::VirtualEthernetCard)
end

Consistently the first card is assigned to 4000 and they increment by one if there are multiple NICs

mwrock avatar Apr 22 '15 07:04 mwrock

@mwrock any good tutorials on using rbvmomi ?

rodrigdav avatar Apr 24 '15 13:04 rodrigdav

Not aware of a tutorial but you might have a look at https://github.com/RallySoftware/vmonkey

mwrock avatar Apr 24 '15 21:04 mwrock

The documentation on this is really really poor. I've managed to struggle through most of the configuration, mostly by pouring over the source code for the various dependencies, but I'm currently stuck with some kind of SOAP error and I don't know who's fault it is. Specifically I'm getting this error and I don't know if it's due to a mistake in the configuration I've provided, a bug in kitchen-vsphere, or something else entirely:

>>>>>> Message: Failed to complete #create action: [Undefined namespace prefix: //soapenv:Body/*]

orclev avatar Apr 30 '15 20:04 orclev

The code example @mwrock provided worked for me -- the new issue I am dealing with is that the network_label doesn't seem to place nicely with distributed virtual switches as the name value is extended to contain the name of the dv switch, but it doesn't seem to behave as if it can attach to the existing item.

(Sorry for thread-jacking here)

rhass-r7 avatar Apr 30 '15 23:04 rhass-r7

this is likely a dead issue, but for reference I was able to find a valid network key on my host by examining the keys assigned to other running VMs using fog like so in the interactive ruby shell:

require 'fog'
(Fog::Compute.new(:provider => "vsphere", :vsphere_username => "USERNAME", :vsphere_password=> "PASSWORD", :vsphere_server => "SERVER_HOSTNAME", :vsphere_expected_pubkey_hash => "################################################################")).servers.all

which resulted in:

...
interfaces=        <Fog::Compute::Vsphere::Interfaces
  server_id="50163416-3554-4207-d618-0e53584781e0"
  [
                            <Fog::Compute::Vsphere::Interface
      mac="00:50:56:96:dd:24",
      network="VM Network",
      name="Network adapter 2",
      status="ok",
      summary="VM Network",
      type=RbVmomi::VIM::VirtualE1000,
      key=4001,
      virtualswitch=nil,
      server_id="50163416-3554-4207-d618-0e53584781e0"
    >
  ]
>,
...

key=4001,

jkerry avatar Jun 19 '15 19:06 jkerry