Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geeting the error "[InvalidDeviceSpec: Invalid configuration for device '0'." when using additional_disk_size_gb #70

Open
seongyongkim opened this issue Apr 15, 2016 · 6 comments

Comments

@seongyongkim
Copy link

Hi,

I am trying to use Test-Kitchen to provisione Redhat 7 VM on vSphere 5.5. I can provision a VM but when I try to add disk by adding the following two lines to .kitchen.yml, I get the error. I can see the VM is created in vCenter but with no additional disk. The template already has an 8GB disk already.

  datastore: 'AM2_TSPC1_NCS09_BASE01'
  additional_disk_size_gb:
    - 40

===== Error ====

------Exception-------
Class: Kitchen::ActionFailed
Message: Failed to complete #create action: [InvalidDeviceSpec: Invalid configuration for device '0'.

]

Please see .kitchen/logs/kitchen.log for more details
Also try running kitchen diagnose --all for configuration

@mwrock
Copy link
Contributor

mwrock commented Apr 15, 2016

Try running with debug logging add ing -l debug to the kitchen command. This will spit out all the device spec info fed to vmware and also a stack trace.

@seongyongkim
Copy link
Author

Here's the output of debug.

------Exception-------
Class: Kitchen::ActionFailed

Message: Failed to complete #create action: [InvalidDeviceSpec: Invalid configuration for device '0'.]

Please see .kitchen/logs/kitchen.log for more details
Also try running kitchen diagnose --all for configuration

D ------Exception-------
D Class: Kitchen::ActionFailed
D Message: Failed to complete #create action: [InvalidDeviceSpec: Invalid configuration for device '0'.]
D ---Nested Exception---
D Class: RbVmomi::Fault
D Message: InvalidDeviceSpec: Invalid configuration for device '0'.
D ------Backtrace-------
D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/vim/Task.rb:11:in wait_for_completion' D /home/skim/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.4/lib/chef/provisioning/vsphere_driver/driver.rb:541:inblock in clone_vm'
D /home/skim/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.4/lib/chef/provisioning/vsphere_driver/driver.rb:524:in each' D /home/skim/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.4/lib/chef/provisioning/vsphere_driver/driver.rb:524:inclone_vm'
D /home/skim/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.4/lib/chef/provisioning/vsphere_driver/driver.rb:177:in find_or_create_vm' D /home/skim/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.4/lib/chef/provisioning/vsphere_driver/driver.rb:135:inallocate_machine'
D /home/skim/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.4/lib/kitchen/driver/vsphere.rb:41:in block in create' D /home/skim/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.4/lib/kitchen/driver/vsphere.rb:73:incall'
D /home/skim/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.4/lib/kitchen/driver/vsphere.rb:73:in with_provisioning_driver' D /home/skim/.chefdk/gem/ruby/2.1.0/gems/chef-provisioning-vsphere-0.8.4/lib/kitchen/driver/vsphere.rb:40:increate'
D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:431:in public_send' D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:431:inblock in perform_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:495:in call' D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:495:insynchronize_or_call'
D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:460:in block in action' D /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:inmeasure'
D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:459:in action' D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:431:inperform_action'
D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:359:in create_action' D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:348:inblock in transition_to'
D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:347:in each' D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:347:intransition_to'
D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/instance.rb:127:in create' D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/command.rb:176:inpublic_send'
D /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'

@mwrock
Copy link
Contributor

mwrock commented Apr 15, 2016

we'll want to see the spec details too earlier in the output.

@seongyongkim
Copy link
Author

Here's the output before the error. Redacted of course.

VCENTER_USER=vcenteruser VCENTER_PASSWORD=******* kitchen create -l debug

-----> Starting Kitchen (v1.5.0)
D Berksfile found at /home/skim/Developer/chef-repo/cookbooks/websphere/Berksfile, loading Berkshelf
D Berkshelf 4.2.1 library loaded
-----> Creating ...
creating machine default-rhel7-8e522e19 on vsphere://somehost/sdk?use_ssl=true&insecure=true
use_linked_clone: false
datacenter: "DC"
template_folder: "Templates"
template_name: "rhel7_base"
vm_folder: "Tenants/kitchen"
num_cpus: 4
memory_mb: 8192
resource_pool: "CLUSTER_01/resource_pool_01"
datastore: "DATASTORE_01"
additional_disk_size_gb: [80]
network_name: ["NETWORK_01"]
ssh: {:user=>"_", :paranoid=>false, :password=>"_*", :port=>22}
convergence_options: nil
customization_spec: {:domain=>"somedomain", :ipsettings=>{:ip=>"xxx.xxx.xxx.xxx", :subnetMask=>"255.255.255.0", :gateway=>["xxx.xxx.xxx.1"], :dnsServerList=>["xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx"]}}
establishing connection to somehost
finding networks...
network: NETWORK_01 is a DistributedVirtualPortgroup
changing template nic for NETWORK_01
customizing default-rhel7-8e522e19 with static IP xxx.xxx.xxx.xxx
customizing default-rhel7-8e522e19 with /
dynamic IP and DNS: ["xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx"]

@mwrock
Copy link
Contributor

mwrock commented Apr 15, 2016

ok. Yeah unfortunately its hard for me to say what might be the issue here. It could be that some aspect of your datastore is incompatible with the configuration the driver is setting. The driver creates this spec with the vsphere API:

      RbVmomi::VIM::VirtualDeviceConfigSpec(
        :operation     => :add,
        :fileOperation => :create,
        :device        => RbVmomi::VIM.VirtualDisk(
          :key           => vm.disks.count,
          :backing       => RbVmomi::VIM.VirtualDiskFlatVer2BackingInfo(
            :fileName        => "[#{datastore}]",
            :diskMode        => 'persistent',
            :thinProvisioned => true
          ),
          :capacityInKB  => size_gb * 1024 * 1024,
          :controllerKey => 1000,
          :unitNumber    => vm.disks.count
        )
      )

@seongyongkim
Copy link
Author

I found out what was the cause. THere's no problem with your driver. The template I was using has set its Disk on SCSI 0::1 Disk 1 instead of Disk 0. Therefore the new disk becomes Disk 0 instead becoming the 1st disk in the boot order causing the VM to fail to boot.

Thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants