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: GET <vcenter-server>/vcenter/datastore/<datastore-moid>...
See more...
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: GET <vcenter-server>/vcenter/datastore/<datastore-moid>/default-policy 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] )