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

Extending the Disk

Open BhargaviAllada opened this issue 6 years ago • 6 comments

Versions:

  • Version of knife-vsphere: 2.0.1
  • Version of chef: 13.6.4

Platform Details

  • Version of vSphere: Version 6.5.0.10000 Build 7119157
  • Version of ESXi: 6.5.0

Scenario:

We are trying to extend the disk size.

Please paste the command and output (run with -VV). Don't forget to X out any passwords or sensitive information:

Command we used is below: knife vsphere vm disk extend VM_Name 1000000 --folder Chef_Test --diskname "Hard disk 2" -VV

Output (run with -VV): /root/.chefdk/gem/ruby/2.4.0/gems/rbvmomi-1.11.7/lib/rbvmomi/vim/Task.rb:14:in wait_for_completion': InvalidDeviceOperation: Invalid operation for device '0'. (RbVmomi::Fault) from /root/.chefdk/gem/ruby/2.4.0/gems/knife-vsphere-2.0.4/lib/chef/knife/vsphere_vm_disk_extend.rb:62:in run' from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife.rb:442:in block in run_with_pretty_exceptions' from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/local_mode.rb:44:in with_server_connectivity' from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife.rb:441:in run_with_pretty_exceptions' from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife.rb:219:in run' from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application/knife.rb:156:in run' from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/bin/knife:25:in <top (required)>' from /bin/knife:255:in load' from /bin/knife:255:in

'

Expected Result:

We are trying to extend the existing VM disk size.

Actual Result:

We are getting the below error: ERROR: RbVmomi::Fault: InvalidDeviceOperation: Invalid operation for device '0'.

BhargaviAllada avatar May 30 '18 09:05 BhargaviAllada

Hello! How big is the disk right now? The command expects the new disk size, in kilobytes. So 1000000 is trying to change the disk to 1 gigabyte, not grow it by one gig. If that ends up shrinking it, you get an error.

Let me know if that's the case, please.

swalberg avatar May 30 '18 11:05 swalberg

Hi swalberg,

Thanks for you reply ! We were trying to shrink the size, So that might be the cause for the error. However it works fine when we are trying to extend the size with the greater value compared to the current size.

Is there any chance to give the disk value in MB or GB instead?

BhargaviAllada avatar May 30 '18 11:05 BhargaviAllada

Hi, I don't think you can shrink it through the API we're using. If I ever learn of a way to do that I'll put it on the backlog. I've got some concerns about the user experience so maybe putting it in a separate knife vsphere vm disk shrink command might be better.

Allowing it to accept human readable numbers like 100g or 200m is a great idea. Going to flag this as an enhancement.

swalberg avatar May 30 '18 12:05 swalberg

Hi, Do we have a command to add the extra disk as well?

BhargaviAllada avatar Jun 27 '18 12:06 BhargaviAllada

Hi Sean Walberg,

Do we have a separate knife vSphere command to add extra disk to the VM post provisioning/Cloning ?

Thanks & Regards.

Bhargavi.A. [cid:[email protected]] Vnet: 572301 Email: [email protected]mailto:[email protected]

From: Sean Walberg [email protected] Sent: Wednesday, May 30, 2018 5:36 PM To: chef-partners/knife-vsphere [email protected] Cc: Allada, Bhargavi (Cognizant) [email protected]; Author [email protected] Subject: Re: [chef-partners/knife-vsphere] Extending the Disk (#433)

Hi, I don't think you can shrink it through the API we're using. If I ever learn of a way to do that I'll put it on the backlog. I've got some concerns about the user experience so maybe putting it in a separate knife vsphere vm disk shrink command might be better.

Allowing it to accept human readable numbers like 100g or 200m is a great idea. Going to flag this as an enhancement.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/chef-partners/knife-vsphere/issues/433#issuecomment-393136376, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlGwdj_QI2MreTqOsNHYhO_sfkMO7GEBks5t3os8gaJpZM4US74k.

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

BhargaviAllada avatar Jun 27 '18 12:06 BhargaviAllada

Discussion in #437.

swalberg avatar Jun 29 '18 22:06 swalberg