vmware / vmware/pyvmomi

upload a vmdk to vsan datastore leaves disk unusable

Open
#1,064 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
2.3k
Forks
763
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Hi,
uploading a vmdk with pyvmomi to a vsan datastore seem to leave the resulting file in an unusable state.

This pops up for me because I am using vsphere_copy in ansible (which is using the sdk in background).

For simplicity I reproduced the issue with the sample datastore upload python:
https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/upload_file_to_datastore.py

Version 8.0.2.0.1
Python 3.11 on a RHEL8.9

vmdk is a stream optimized v6 image, using the same file and uploading it via the webui through firefox results in a usable vmdk.

Uploading the vmdk via api results in an error when trying to use in vsphere:
"Unsupported or invalid disk type 22 for 'scsi0:0'. Ensure that the disk has been imported."

vCenter: 7.0.3 Build: 22357613 (VxRail 7.0.482)

Reproduction steps
  1. have a stream optimized vmdk + a vsphere + vsan
  2. python3.11 upload_file_to_datastore.py -s vsphere_server -o 443 -u username@vsphere.local -p "password" --disable-ssl-verification --datastore-name VxRail-Virtual-SAN-Datastore-id --local-file-path ~/diskimages/file.vmdk --remote-file-path import/file.vmdk
  3. create a VM that uses that VMDK as disk
    ...
Expected behavior

Works, no error

Additional context

Actual behavior:
VM does not start; error "Unsupported or invalid disk type 22 for 'scsi0:0'. Ensure that the disk has been imported."

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with samples/upload_file_to_datastore.py and reproduce the upload using the reported Python 3.11 command against a vSAN datastore. Compare the API-uploaded VMDK with one uploaded through the vSphere web UI, then investigate why the API result cannot start a VM. Done means the uploaded stream-optimized VMDK is usable by vSphere without the disk type 22 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.