Specified datastore when adding a new disk not take effect
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 763
- PR merge metrics
- No merged PRs in 30d
Description
Purpose:
Add a new disk in the specified datastore, not in the same path of the VM files.
Sample code:
...
disk_spec = vim.vm.device.VirtualDeviceSpec()
disk_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.add
disk_spec.fileOperation = vim.vm.device.VirtualDeviceSpec.FileOperation.create
disk_spec.device = vim.vm.device.VirtualDisk()
disk_spec.device.capacityInKB = disk_size
disk_spec.device.backing = vim.vm.device.VirtualDisk.FlatVer2BackingInfo()
**disk_spec.device.backing.datastore = disk_datastore**
disk_spec.device.controllerKey = scsi_ctl_key
disk_spec.device.unitNumber = disk_unit_number
config_spec.deviceChange.append(disk_spec)
...
If use above code only set disk_spec.device.backing.datastore = disk_datastore, the new added disk will be in the same folder and datastore with the VM files. But if adding this line disk_spec.device.backing.fileName = '[disk_datastore] test_file/test_file.vmdk', the new added disk will be in the specified datastore. Is setting this "fileName" the only way to do this? We do not want to set the file name explicitly since it will cause file duplication issue, only want to specify the datastore name.
Thanks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file, test, or entry point is named. Start by reproducing the sample VirtualDisk.FlatVer2BackingInfo configuration and consult the vSphere API behavior for datastore and fileName placement. Done means determining whether a datastore-only placement is supported without an explicit filename and documenting or correcting the supported approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100