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

wait_for_completion not valid

Open chef09210 opened this issue 8 years ago • 6 comments

wait_for_completion call on line 62 of vsphere_vm_disk_extend.rb is not valid

C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/vim/Task.rb:11 in 'wait_for_completion': InvalidDeviceOperation: Invalid operation for device '0'. (RbVmomi::Fault)

chef09210 avatar Apr 01 '16 00:04 chef09210

Hi, thanks for bringing this up. Can you paste the command and complete output, please? Also the version of the knife-vsphere gem you're using, please and thank you.

swalberg avatar Apr 01 '16 16:04 swalberg

Going to close this, if you're still having issues here @chef09210 please post your error here and we can continue debugging.

jjasghar avatar Sep 13 '16 17:09 jjasghar

@jjasghar I am seeing this same issue. Here are some details:

knife-vsphere: 1.2.21 vsphere: 5.5.0

command I am running is:

knife vsphere vm disk extend test-vm 1000000 --folder myfolder --vsdc mydatacenter -p mypassword --vshost myvhost -u myuser -VV

the vm is in a powered off state when running this command.

full stack trace:

/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rbvmomi-1.8.2/lib/rbvmomi/vim/Task.rb:11:in `wait_for_completion': InvalidDeviceOperation: Invalid operation for device '0'. (RbVmomi::Fault)
       	from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-vsphere-1.2.21/lib/chef/knife/vsphere_vm_disk_extend.rb:62:in `run'
       	from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/knife.rb:421:in `block in run_with_pretty_exceptions'
       	from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/local_mode.rb:44:in `with_server_connectivity'
       	from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/knife.rb:420:in `run_with_pretty_exceptions'
       	from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/knife.rb:219:in `run'
       	from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application/knife.rb:148:in `run'
       	from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/bin/knife:25:in `<top (required)>'
       	from /usr/local/bin/knife:49:in `load'
       	from /usr/local/bin/knife:49:in `<main>'

let me know if you need any more information

warroyo avatar Dec 07 '16 19:12 warroyo

What size is the disk already? It may not be well documented but the second command line parameter (1 million in your example) sets the new size of the disk in kB, and you can't shrink a disk. So my guess is you're trying to add a gig of space, when what it's trying to do is shrink it to a gig and throwing an error.

swalberg avatar Dec 07 '16 19:12 swalberg

@swalberg that was exactly it! this is working as expected. thank you!

warroyo avatar Dec 07 '16 19:12 warroyo

Note for future self or anyone wanting to contribute:

  • It's not obvious that we're setting a new size rather than extending
    • Improve documentation
    • Change the behaviour to read the current size and add the param, but consider backwards compatibility
    • Or read the current size and error out if we know it's shrinking
    • Or DWIM and add it to the current size if it's less than the current size (need to think this one through)
    • Support friendlier params like 10g instead of needing 10 zeroes.

swalberg avatar Dec 07 '16 19:12 swalberg