VMware Cloud Community
davidlublink
Contributor
Contributor

Path ignore or invalid when creating disk ( fcd ) over API pyvmomi

Hello.

I am using vmware vcenter with a modern API ( at least 6.7 ).

I am trying to create a new disk in a datastore and attach it to a virtual machine. I was able to do both, however for whatever reason I am unable to name my vmdk file or control the destination folder ( it's ALWAYS created in the fcd/ folder ) .

When I create the disk it is created without any virtual machine at the time. The disk is simply created and later it is used ( ie connected to a virtual machine ) .

The vcenter has a SAN with a number of data stores. I do not know the inner workings of the setup, I have only a general understanding of the setup.

Here is a snippet, mostly from here ( https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/fcd_create_vdisk.py )

 

from pyVmomi import vim 

spec = vim.vslm.CreateSpec()
spec.name = "thebravebanana"
spec.capacityInMB = 128
spec.backingSpec = vim.vslm.CreateSpec.DiskFileBackingSpec()
spec.backingSpec.provisioningType = "eagerZeroedThick"
spec.backingSpec.datastore = datastore

### This next line seems to be ignored
spec.backingSpec.path = 'foo/bar.vmdk' 

storage = content.vStorageObjectManager
task = storage.CreateDisk_Task(spec)

WaitForTask(task)

 


I expect the file to be created as foo/bar.vmdk.

Instead the files are always created as fcd/{uuid}.vmdk.

It's as if the path is completely ignored!

How do I set the file name for these newly created disks?

Thank you!

David

Reply
0 Kudos
0 Replies