vmware/pyvmomi-community-samples

change_disk_mode.py: pyVmomi.VmomiSupport.NoPermission

開放

#619 建立於 2019年12月3日

 (0 則留言) (0 個反應) (0 位負責人)Python (914 個分叉)batch import
help wanted

倉庫指標

星標
 (972 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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!

貢獻者指南