vmware/pyvmomi-community-samples

change_disk_mode.py: pyVmomi.VmomiSupport.NoPermission

オープン

#619 opened on 2019/12/03

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)Python (914 件のフォーク)batch import
help wanted

Repository metrics

Stars
 (972 個のスター)
PR merge metrics
 (30d に merged 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!

コントリビューターガイド