GoodBrew I am trying to do the same thing, but using the rbvmomi api. Can you share what you were able to do. We do have vCenter server. I think I am using correct storage profile, but something in how I am calling ReconfigVM_Task is not working right, so I suspect I am creating the storage profile incorrectly!
We ended up automating an API call to the vCenter Server's RESTful API server to get the datastore policy ID. We used this endpoint:
Once we had the policy ID, we constructed a VirtualMachineConfigSpec object like this to pass to reconfigure_vm task:
# make the nvdimm_backing object
# We had to pass an empty string as a fileName value for some reason...
nvdimm_backing = VirtualNVDIMMBackingInfo(fileName = "")
# make the nvdimm device object
nvdimm_dev = VirtualNVDIMM(capacityInMB = <some_size>, backing=nvdimm_backing, controllerKey=<your-nvdimm-controller>)
# some other values we needed to fill out
op = VirtualDeviceConfigSpecOperation("add")
fileOp = VirtualDeviceConfigSpecFileOperation("create")
nvdimm_profile = new VirtualMachineDefinedProfileSpec(profileId = <the policy ID you got from the vcenter>) # this is where we insert the policy ID
# combine it all together for the VirtualDeviceConfigSpec:
vnvdimm_spec = VirtualDeviceConfigSpec(profile=[ nvdimm_profile ], device=nvdimm_dev , fileOperation=fileOp, operation=fileOp)
# then roll that into the VirtualMachineConfigSpec and reconfigure the VM
config_spec = VirtualMachineConfigSpec([deviceChange = vnvdimm_spec])
Thanks so much! That worked! I had the correct profile ID, it was the filename in the nvdimm backing info that was giving me trouble. Passing the empty string worked wonderfully. Appreciate your help!