Pyvmomi 配置 ESXi 'NTP Client Enabled' 复选框
Pyvmomi configure ESXi 'NTP Client Enabled' check box
使用下面的代码可以更新 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
host.configManager.firewallSystem.EnableRuleset(id='ntpClient')
使用下面的代码可以更新 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
host.configManager.firewallSystem.EnableRuleset(id='ntpClient')