我正在尝试使用pyvmomi将主机添加到vshere的端口组。 连接和所有工作都很好。当我尝试将主机添加到端口组时,出现以下错误。
grep -i -P "$item" /etc/hosts
这是我的代码:
Traceback (most recent call last):
File "/home/vkm/PycharmProjects/cdm/cdmapp/cdm/helper/switch.py", line 40, in <module>
vcenter.AddHostPortgroup(host,inputs['dvs_name'],inputs['dv_port_name'])
File "/home/vkm/PycharmProjects/cdm/cdmapp/cdm/helper/vcenter.py", line 239, in AddHostPortgroup
host.configManager.networkSystem.AddPortGroup(portgroup_spec)
File "/home/vkm/PycharmProjects/cdm/cmdenv/lib/python3.5/site-packages/pyVmomi/VmomiSupport.py", line 580, in <lambda>
self.f(*(self.args + (obj,) + args), **kwargs)
File "/home/vkm/PycharmProjects/cdm/cmdenv/lib/python3.5/site-packages/pyVmomi/VmomiSupport.py", line 386, in _InvokeMethod
return self._stub.InvokeMethod(self, info, args)
File "/home/vkm/PycharmProjects/cdm/cmdenv/lib/python3.5/site-packages/pyVmomi/SoapAdapter.py", line 1366, in InvokeMethod
raise obj # pylint: disable-msg=E0702
pyVmomi.VmomiSupport.NotFound: (vim.fault.NotFound) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
msg = 'The object or item referred to could not be found.',
faultCause = <unset>,
faultMessage = (vmodl.LocalizableMessage) []
}
请提供帮助。