pyvmomi-community-samples icon indicating copy to clipboard operation
pyvmomi-community-samples copied to clipboard

change_disk_mode.py: pyVmomi.VmomiSupport.NoPermission

Open ItsAMeMarcel opened this issue 5 years ago • 0 comments

Hi, and first of all thank you guys for this nice samples 👍 they already helped me a lot! But now I'm stuck. I try to change a VMs disk mode with your example change_disk_mode.py.

I run it like this from the command-line:

python change_disk_mode.py -s myhost -u "EUR\myuser" -p mypassword -v myvm -d 1 -m independent_persistent

I instantly get the following traceback:

File "change_disk_mode.py", line 108, in <module>
    main()
  File "change_disk_mode.py", line 101, in main
    change_disk_mode(si, vm_obj, args.disk_number, args.mode)
  File "change_disk_mode.py", line 54, in change_disk_mode
    task = vm_obj.ReconfigVM_Task(spec=spec)
  File "/vSphere-env/lib64/python3.6/site-packages/pyVmomi/VmomiSupport.py", line 706, in <lambda>
    self.f(*(self.args + (obj,) + args), **kwargs)
  File "/vSphere-env/lib64/python3.6/site-packages/pyVmomi/VmomiSupport.py", line 512, in _InvokeMethod
    return self._stub.InvokeMethod(self, info, args)
  File "/vSphere-env/lib64/python3.6/site-packages/pyVmomi/SoapAdapter.py", line 1397, in InvokeMethod
    raise obj # pylint: disable-msg=E0702
pyVmomi.VmomiSupport.NoPermission: (vim.fault.NoPermission) {
   dynamicType = <unset>,
   dynamicProperty = (vmodl.DynamicProperty) [],
   msg = 'Permission to perform this operation was denied.',
   faultCause = <unset>,
   faultMessage = (vmodl.LocalizableMessage) [],
   object = 'vim.Datastore:datastore-24829',
   privilegeId = 'System.Read'

}

So it looks like it is a permission problem. Because of this it try to set the disk mode with this user via [VmWare vSphere Client > VM > Virtual Machine Properties] . Here it is possible to set the disk mode.

Can somebody help me to archive changing the disk mode with this user?

Best regards and thank you guys!

ItsAMeMarcel avatar Dec 03 '19 13:12 ItsAMeMarcel