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

knife vsphere vm vmdk add - last 10% hard-coded #184

Open
gitfirenz opened this issue Jul 31, 2015 · 10 comments
Open

knife vsphere vm vmdk add - last 10% hard-coded #184

gitfirenz opened this issue Jul 31, 2015 · 10 comments
Labels
Status: Good First Issue An issue ready for a new contributor. Type: Enhancement Adds new functionality.

Comments

@gitfirenz
Copy link
Contributor

Hello,

(I'm using a lot your work today :) )

There is an "issue" : When you add a disk, you check if, after the creation of the disk, it will remain 10% of the disk capacity. I understand the need for a protection.

Buuut :

  • 10% is a lot (i'm working on a 7To datastore), so it should be configurable
  • at least as a quick fix, the error should talk about this 10%.
@swalberg
Copy link
Collaborator

I think I know what you're talking about, but can you paste a command and output, please? We can make it configurable and leave a 10% default, as I agree, a percentage has little meaning when the size of the volume varies so much.

(Also, I'm out for a week, so won't be responding much until after the 8th)

@gitfirenz
Copy link
Contributor Author

Here's an output :

sudo knife vsphere vm vmdk add my_vm_01 20
Datastore: datastoreSAN (25.86 GB(27762098176) / 139.75 GB)
Insufficient space on all LUNs designated or assigned to the virtual machine. Please specify a new target.

I asked 20g, 25.86 left, but it is not enough :(

It comes from "def choose_datastore(dstores, size)" in base_vsphere_command.rb with thses lines (243) :

# also let's not use more than 90% of total space to save room for snapshots.
          cap_remains = 100 * ((store.summary[:freeSpace].to_f - vmdk_size_b.to_f) / store.summary[:capacity].to_f)
          candidates.push(store) if cap_remains.to_i > 10

In line 250 :
puts 'Insufficient space on all LUNs designated or assigned to the virtual machine. Please specify a new target.'
The best would be to put the 10% in the knife config (so i can decide 0%, 0,1% etc).

@bathenme
Copy link

any update on this?

@nkichukov
Copy link

Same happens if you try to add a thin provisioned disk to a VM but the requested initial size is bigger than the available minus 10%.

So if you have 1.71TB available and you want to add a 2TB thin provisioned disk, then it fails:

Datastore: <DSNAME> (1.71 TB(1877164412928) / 10.00 TB)
Insufficient space on all LUNs designated or assigned to the virtual machine. Please specify a new target.

Same works via the vCenter vSphere thick client as you are adding a thin provisioned disk so the free space at the moment of adding should not be a concern.

Thanks,
-N

@swalberg
Copy link
Collaborator

Hi, I remember working on this one then pausing, but I don't remember why. I think I may just remove that 10% check altogether.

@nkichukov
Copy link

The 10% check is not exactly what I had in mind. It needs to go away anyways, but mine is different. It is to do with the type of disk and the available storage.

If adding THICK disk, the current state is safe, but if that is THIN, the current state needs to be able to consider this and proceed(due to thin) even though not enough space is reported to exist.

Thank you,
-N

@swalberg
Copy link
Collaborator

Oh, you want to be able to overprovision using thin? That makes sense. Sorry for my slowness here, this command is among the ones I don't understand fully and don't want to make changes that break other people's workflow. I think I can do this one without breaking things.

swalberg added a commit to swalberg/knife-vsphere that referenced this issue Apr 24, 2018
Fixes chef#184

Refactor to get some methods out of base that are only used here.

Remove check for needing 10% overhead.
If we're thin provisioning, then only require 1G
@swalberg
Copy link
Collaborator

Are you able to pull down my branch and test this locally?

https://github.com/swalberg/knife-vsphere/tree/vmdk_add_thin

swalberg added a commit that referenced this issue Apr 24, 2018
Fixes #184

Refactor to get some methods out of base that are only used here.

Remove check for needing 10% overhead.
If we're thin provisioning, then only require 1G
@nkichukov
Copy link

Yes, I can do that. Once I have the time to switch again into this, I will definitely give it a try and report back my results. Thank you!
-Nik

@nkichukov
Copy link

nkichukov commented Sep 21, 2018

Hello, sorry for the long delay in testing this. I can confirm that the feature does allow one to add a thin-provisioned disk that not only exceeds the current free space on the selected datastore, but also allows to extend beyond the size of the whole datastore.

In the example below, I have managed to add 10000GB thin vmdk disk to a VM where the overall available size on the datastore was: 7.81 TB.

So for me this is resolved. Thank you! See test below:

knife-vsphere-test]$ knife vsphere vm vmdk add --vmdk-type thin mytestvm 10000G
Datastore: mytestdatastore (7.74 TB(8512542343168) / 7.81 TB)
Choosing: mytestdatastore
here
VirtualMachine("vm-1933")
[mytestdatastore] mytestvm/mytestvm.vmx
[mytestdatastore] mytestvm/mytestvm.vmxf
[mytestdatastore] mytestvm/mytestvm.nvram
[mytestdatastore] mytestvm/mytestvm.vmsd
[mytestdatastore] mytestvm/mytestvm.vmdk
[mytestdatastore] mytestvm/mytestvm-flat.vmdk
[mytestdatastore] mytestvm/mytestvm_1.vmdk
[mytestdatastore] mytestvm/mytestvm_1-flat.vmdk
[mytestdatastore] mytestvm/mytestvm_2.vmdk
[mytestdatastore] mytestvm/mytestvm_2-flat.vmdk
[mytestdatastore] mytestvm/mytestvm-d95dbafd.vswp
[mytestdatastore] mytestvm/vmx-mytestvm-3646798589-1.vswp
[mytestdatastore] mytestvm/vmware-1.log
[mytestdatastore] mytestvm/vmware-2.log
[mytestdatastore] mytestvm/vmware.log
Next vmdk name is => [mytestdatastore] mytestvm/mytestvm_3.vmdk
Creating VMDK
Capacity: 10000G GB
Disk: [mytestdatastore] mytestvm/mytestvm_3.vmdk
Attaching VMDK to mytestvm
using SCSI controller 0
using SCSI ID 3

and knife-vsphere v2.1.1 which came preinstalled with chefdk-3.2.30-1.el6.x86_64.rpm and I reinstalled from the gem I built from https://github.com/swalberg/knife-vsphere/tree/vmdk_add_thin (not sure if those are the same or not because the versions matched):
knife-vsphere-test]$ chef gem list | grep knife-vsphere
knife-vsphere (2.1.1)

Thank you!
-N

@tas50 tas50 added Type: Jump In Type: Enhancement Adds new functionality. and removed Hacktoberfest labels Dec 18, 2018
@tas50 tas50 added Status: Good First Issue An issue ready for a new contributor. and removed Help: Good First Issue labels Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Good First Issue An issue ready for a new contributor. Type: Enhancement Adds new functionality.
Projects
None yet
Development

No branches or pull requests

5 participants