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

VMDK issues with creating VM #182

Open
3 tasks done
JimCircadian opened this issue Sep 4, 2019 · 4 comments
Open
3 tasks done

VMDK issues with creating VM #182

JimCircadian opened this issue Sep 4, 2019 · 4 comments

Comments

@JimCircadian
Copy link

JimCircadian commented Sep 4, 2019

Environment

  • sdk package version:
nsx-vmc-aws-integration-python-sdk 2.3.0.0.3.13851140
nsx-vmc-policy-python-sdk          2.3.0.0.3.13851140
pyvmomi                            6.7.1.2018.12     
vapi-client-bindings               3.0.0             
vapi-common-client                 2.12.0            
vapi-runtime                       2.12.0            
vmc-client-bindings                1.10.0            
vSphere-Automation-SDK             1.4.0 

  • python version:
    Python 3.6.8

  • vSphere version: 6.7

  • Operating System/Shell (used to run SDK-based apps): bash / centos7

Steps or code snippet to reproduce

vmdkspec = Disk.VmdkCreateSpec(
        capacity=64 * 1024 ** 3,
        name="a-test-disk",
        storage_policy=None,
)
boot_disk = Disk.CreateSpec(type=Disk.HostBusAdapterType.SCSI,
                            scsi=ScsiAddressSpec(bus=0, unit=0),
                            new_vmdk=vmdkspec)

...
vm_create_spec = VM.CreateSpec(name="a-test-name",
                               hardware_version=Hardware.Version.VMX_11,
                               cpu=Cpu.UpdateSpec(count=2,
                                                  cores_per_socket=1,
                                                  hot_add_enabled=False,
                                                  hot_remove_enabled=False),
                               memory=Memory.UpdateSpec(size_mib=2 * 1024,
                                                        hot_add_enabled=False),
                               guest_os=GuestOS.CENTOS_7,
                               placement=placement_spec,
                               disks=[primary_disk],
                               nics=[nic],
                               boot=boot_spec,
                               boot_devices=boot_device_order,)

Actual behavior

Two things (related, I promise!)

Firstly, I can't see any way to thin provision the disks via the REST API when creating the VM, is this not possible?

Secondly, on attempting to provision the VM I get the following error:

INFO:root:Resource pool group-v1172 and folder resgroup-1053 with datastore datastore-952 selected
INFO:root:Creating VM
Traceback (most recent call last):
  File "create_vm.py", line 70, in <module>
    vm = client.vcenter.VM.create(vm_create_spec)
  File "/home/jambyr/.virtualenvs/vmware/lib/python3.6/site-packages/com/vmware/vcenter_client.py", line 3660, in create
    'spec': spec,
  File "/home/jambyr/.virtualenvs/vmware/lib/python3.6/site-packages/vmware/vapi/bindings/stub.py", line 345, in _invoke
    return self._api_interface.native_invoke(ctx, _method_name, kwargs)
  File "/home/jambyr/.virtualenvs/vmware/lib/python3.6/site-packages/vmware/vapi/bindings/stub.py", line 298, in native_invoke
    self._rest_converter_mode)
com.vmware.vapi.std.errors_client.Unsupported: {messages : [LocalizableMessage(id='com.vmware.api.vcenter.vm.device.disk.unsupported_gos_get_disk_size', default_message="Unable to get recommended disk size for the guest OS. Guest OS 'CENTOS_7' is not supported.", args=['CENTOS_7'], params=None, localized=None)], data : None, error_type : None}

Expected behavior

I would expect by defining the vmdkspec / disk spec that it shouldn't be trying to pull the recommended disk size from the CENTOS_7 profile. Also I was expecting (perhaps via the vmdkspec) to be able to specify the provisioning type.

Any help gratefully received!

All the best

@JimCircadian
Copy link
Author

It turns out using GuestOS.CENTOS or GuestOS.RHEL-7 works fine. I guess this is the based on the host version?

Though the disk also ended up being thin provisioned, I'd be interested to understand whether it's a missing feature of the REST API to specify the provisioning type?

Thanks in advance.

@jobingeo
Copy link
Contributor

jobingeo commented Dec 5, 2019

The REST API vmdk create spec doesn't support desired provisioning like LAZY, THICK, THIN etc.

Only few config is supported in vmdk create spec (which you already covered as in your code snippet),
https://vmware.github.io/vsphere-automation-sdk-python/vsphere/cloud/com.vmware.vcenter.vm.html#com.vmware.vcenter.vm.hardware_client.Disk.VmdkCreateSpec

@JimCircadian
Copy link
Author

JimCircadian commented Oct 9, 2020

If there's anything I can do to help advance this, let me know! ;-) I think it's still a really useful feature to have!

@strahinjanis
Copy link

"...The REST API vmdk create spec doesn't support desired provisioning like LAZY, THICK, THIN etc...." stuck with this as well, is there any estimation when we can expect that to be available? The provisioning of HDD (vmdk) is OK, but it's odd to think in direction to convert from thin to tick (or vice versa) because of lack of ability to specify that in advance.

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

No branches or pull requests

3 participants