VMware {code} Community
GoodBrew
Contributor
Contributor

Provisioning virtual NVDIMM with Perl SDK

Hi everyone!

I am trying to provision a virtual NVDIMM device using the Perl SDK. Specifically how the default storage policy for the PMEM datastore backing the device is determined / used.

I actually have been able to provision the virtual NVDIMM using a storage policy ID I  have determined with a REST call against the vSphere RESTful API service. But that requires a vCenter server and I was hoping to run this script against standalone hosts as well.

I was hoping some folks here might have some examples of provisioning a virtual NVDIMM device using the Perl SDK

Thanks!

0 Kudos
3 Replies
amy_reed
Contributor
Contributor

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!

0 Kudos
GoodBrew
Contributor
Contributor

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])

0 Kudos
amy_reed
Contributor
Contributor

@GoodBrew

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!

0 Kudos