Open yluinca opened 3 years ago
Hello, I'm able to add a nvdimm device via vcenter GUI, and I captured the code. However, when I tried to program it (similar to the captured code) to add the nvdimm device, I got error InvalidDeviceSpec error. Any idea? Appreciate any help here.
pyVmomi.VmomiSupport.InvalidDeviceSpec: (vim.fault.InvalidDeviceSpec) { dynamicType = , dynamicProperty = (vmodl.DynamicProperty) [], msg = "Invalid configuration for device '0'.", faultCause = , faultMessage = (vmodl.LocalizableMessage) [ (vmodl.LocalizableMessage) { dynamicType = , dynamicProperty = (vmodl.DynamicProperty) [], key = 'com.vmware.vim.vpxd.vmprov.invalidNVDIMMPolicy', arg = (vmodl.KeyAnyValue) [], message = 'com.vmware.vim.vpxd.vmprov.invalidNVDIMMPolicy' }, (vmodl.LocalizableMessage) { dynamicType = , dynamicProperty = (vmodl.DynamicProperty) [], key = 'com.vmware.vim.vpxd.vpx.vmprov.DeviceStr', arg = (vmodl.KeyAnyValue) [ (vmodl.KeyAnyValue) { dynamicType = , dynamicProperty = (vmodl.DynamicProperty) [], key = 'deviceStr', value = 'New NVDIMM' } ], message = 'Device: New NVDIMM.' } ], property = '', deviceIndex = 0 }
Captured code from vcenter for adding a 10G nvdimm device:
spec = vim.vm.ConfigSpec() spec_deviceChange_0 = vim.vm.device.VirtualDeviceSpec() spec_deviceChange_0.fileOperation = create spec_deviceChange_0.device = vim.vm.device.VirtualNVDIMM() spec_deviceChange_0.device.backing = vim.vm.device.VirtualNVDIMM.BackingInfo() spec_deviceChange_0.device.backing.fileName = '' spec_deviceChange_0.device.controllerKey = 27000 spec_deviceChange_0.device.capacityInMB = 10240 spec_deviceChange_0.device.deviceInfo = vim.Description() spec_deviceChange_0.device.deviceInfo.summary = 'New NVDIMM' spec_deviceChange_0.device.deviceInfo.label = 'New NVDIMM' spec_deviceChange_0.device.key = -111 spec_deviceChange_0.operation = add spec.deviceChange = [spec_deviceChange_0] spec.cpuFeatureMask = [] managedObject.ReconfigVM_Task(spec) # VirtualMachine-vm-933962
Test code: def add_nvdimm_device(si, vm_obj):
nvdimm_spec = vim.vm.device.VirtualDeviceSpec() nvdimm_spec.fileOperation = "create" nvdimm_spec.operation = vim.vm.device.VirtualDeviceSpec.Operation.add nvdimm_spec.device = vim.vm.device.VirtualNVDIMM() nvdimm_spec.device.deviceInfo = vim.Description() nvdimm_spec.device.deviceInfo.summary = "New NVDIMM" nvdimm_spec.device.deviceInfo.label = "New NVDIMM" nvdimm_spec.device.backing = vim.vm.device.VirtualNVDIMM.BackingInfo() nvdimm_spec.device.backing.fileName = "" nvdimm_spec.device.capacityInMB = 8192 nvdimm_spec.device.key = -114 nvdimm_spec.device.controllerKey = 27000 spec = vim.vm.ConfigSpec() spec.deviceChange = [nvdimm_spec] spec.cpuFeatureMask = [] task = vm_obj.ReconfigVM_Task(spec=spec) tasks.wait_for_tasks(si, [task]) return True
Hello, I'm able to add a nvdimm device via vcenter GUI, and I captured the code. However, when I tried to program it (similar to the captured code) to add the nvdimm device, I got error InvalidDeviceSpec error. Any idea? Appreciate any help here.
pyVmomi.VmomiSupport.InvalidDeviceSpec: (vim.fault.InvalidDeviceSpec) { dynamicType =,
dynamicProperty = (vmodl.DynamicProperty) [],
msg = "Invalid configuration for device '0'.",
faultCause = ,
faultMessage = (vmodl.LocalizableMessage) [
(vmodl.LocalizableMessage) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
key = 'com.vmware.vim.vpxd.vmprov.invalidNVDIMMPolicy',
arg = (vmodl.KeyAnyValue) [],
message = 'com.vmware.vim.vpxd.vmprov.invalidNVDIMMPolicy'
},
(vmodl.LocalizableMessage) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
key = 'com.vmware.vim.vpxd.vpx.vmprov.DeviceStr',
arg = (vmodl.KeyAnyValue) [
(vmodl.KeyAnyValue) {
dynamicType = ,
dynamicProperty = (vmodl.DynamicProperty) [],
key = 'deviceStr',
value = 'New NVDIMM'
}
],
message = 'Device: New NVDIMM.'
}
],
property = '',
deviceIndex = 0
}
Captured code from vcenter for adding a 10G nvdimm device:
---------------ReconfigVM_Task---------------
spec = vim.vm.ConfigSpec() spec_deviceChange_0 = vim.vm.device.VirtualDeviceSpec() spec_deviceChange_0.fileOperation = create spec_deviceChange_0.device = vim.vm.device.VirtualNVDIMM() spec_deviceChange_0.device.backing = vim.vm.device.VirtualNVDIMM.BackingInfo() spec_deviceChange_0.device.backing.fileName = '' spec_deviceChange_0.device.controllerKey = 27000 spec_deviceChange_0.device.capacityInMB = 10240 spec_deviceChange_0.device.deviceInfo = vim.Description() spec_deviceChange_0.device.deviceInfo.summary = 'New NVDIMM' spec_deviceChange_0.device.deviceInfo.label = 'New NVDIMM' spec_deviceChange_0.device.key = -111 spec_deviceChange_0.operation = add spec.deviceChange = [spec_deviceChange_0] spec.cpuFeatureMask = [] managedObject.ReconfigVM_Task(spec) # VirtualMachine-vm-933962
Test code: def add_nvdimm_device(si, vm_obj):
Add NVDIMM device