【发布时间】:2020-10-20 11:16:11
【问题描述】:
使用以下代码可以更新 ESXi 服务器中 ntpd 服务的启动策略,
con = connect.SmartConnect(host=host, user=user, pwd=pwd)
content = con.RetrieveContent()
cv = content.viewManager.CreateContainerView(
container=content.rootFolder, type=[vim.HostSystem], recursive=True)
for child in cv.view:
child.configManager.serviceSystem.UpdatePolicy(id='ntpd', policy='on')
服务中没有线索
(vim.host.Service) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
key = 'ntpd',
label = 'NTP Daemon',
required = false,
uninstallable = false,
running = false,
ruleset = (str) [
'ntpClient'
],
policy = 'off',
sourcePackage = (vim.host.Service.SourcePackage) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
sourcePackageName = 'esx-base',
description = 'This VIB contains all of the base functionality of
vSphere ESXi.'
}
}
但是如何使用 Pyvmomi 为 ESXi 标记 NTP Client Enabled 复选框?
VMware 版本 - 6.0.0
【问题讨论】: