vmware - 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
解决方案
host.configManager.firewallSystem.EnableRuleset(id='ntpClient')
推荐阅读
- python - 使用 python 从自定义路径验证 SSL 证书
- angular - Angular - 使用子路由延迟加载模块内部的模块
- angular - 如何使用 @ViewChild() 在 Angular 库之外调用 Angular 组件方法?
- servlets - AEM Servlet 未执行
- c++ - 使用指针指向 Vector 的索引,C++
- .net-core - 如何将边界框信息叠加到 JPG 上并创建 PDF
- python - 问:如何存储/保存 Pylint 执行的结果?
- mysql - MySQL如何按列分组并使某些值进入1行
- wordpress - 无法通过移动浏览器访问本地主机上的 Wordpress 站点(Chrome devtools - 远程设备)
- react-native - React Native - 如何将捕获的图像存储在应用程序中,而不是存储在图库中并将它们从应用程序本身上传到 AWS s3