首页 > 解决方案 > Pyvmomi 配置 ESXi 'NTP Client Enabled' 复选框

问题描述

使用以下代码可以更新 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

标签: vmwareesxipyvmomi

解决方案


host.configManager.firewallSystem.EnableRuleset(id='ntpClient')


推荐阅读