vmware / vmware/pyvmomi

can use pyvmomi create vvol2.0 vm more than 2 disk ???

Open
#964 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I plan to use pyvmomi to create a vvol VM configured with 2 disks. vim.vm.ConfigSpec().vmProfile and vim.vm.device.VirtualDeviceSpec().profile are set to the VM storage policy profile as prompted. However, the VM fails to be created, and the message "A general system error occurred: Error creating disk The VVol target encountered a vendor specific error" is displayed. The VASA provider does not receive the disk storage profile of the VM.

code like this:

def create_vm_storage_profile_spec(self, vm_storage_policy_profile):
"""
:param vm_storage_policy_profile:
:return:
"""
storage_profile_specs = []
storage_profile_spec = vim.vm.DefinedProfileSpec()
storage_profile_spec.profileId = vm_storage_policy_profile.profileId.uniqueId
storage_profile_spec.replicationSpec = vim.vm.replication.ReplicationSpec()
replication_group = vim.vm.replication.ReplicationGroupId()
device_group_id = vim.vm.replication.DeviceGroupId()
device_group_id.id = 'ffffffff-ffff-ffff-ffff-ffffffffffff'
fault_domain_id = vim.vm.replication.FaultDomainId()
fault_domain_id.id = 'f0fe8c4f-c08b-4a15-ae07-7dca8a436335'
# fault_domain_id.id = self.spbm_fault_domain_id
replication_group.deviceGroupId = device_group_id
replication_group.faultDomainId = fault_domain_id
storage_profile_spec.replicationSpec.replicationGroupId = replication_group
storage_profile_specs.append(storage_profile_spec)
return storage_profile_specs

vm_config_spec = vim.vm.ConfigSpec()
if vm_storage_policy_profile:
storage_profile_specs = self.create_vm_storage_profile_spec(vm_storage_policy_profile)
vm_config_spec.vmProfile = storage_profile_specs

if 1 <= disk_num < 8:
for disk_num_tmp in range(1, disk_num + 1):
disk_config_spec_tmp = vim.vm.device.VirtualDeviceSpec()
disk_config_spec_tmp.fileOperation = 'create'
disk_config_spec_tmp.device = vim.vm.device.VirtualDisk()
disk_config_spec_tmp.device.capacityInKB = disk_sizeGB * 1024 * 1024
disk_config_spec_tmp.device.controllerKey = scsi_config_sec.device.key
disk_config_spec_tmp.device.unitNumber = disk_num_tmp - 1
disk_config_spec_tmp.device.backing =
vim.vm.device.VirtualDisk.FlatVer2BackingInfo()
disk_config_spec_tmp.device.backing.fileName = datastore_path
if vm_storage_policy_profile:
disk_config_spec_tmp.profile = storage_profile_specs

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 create_vm_storage_profile_spec and the ConfigSpec and VirtualDeviceSpec construction shown in the issue, then trace how vmProfile and disk profile values are passed during multi-disk VM creation. Done means identifying why the VASA provider does not receive the disk storage profile and whether the vVol VM can be created with the requested disks.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.