Vmware的.net api参考有点令人困惑,难以遵循。我已经能够连接到我的vCenter主机,然后获得一个esxi主机列表。然后,我已经能够使用HostKernelModuleSystem
获取主机上的所有正在运行的模块,并探测变量“mod”的属性...但我无法弄清楚如何获取许可证信息,我尝试在下面创建一个对象lic
,从类型中的单词许可证尝试所有不同类型的vmware的“类型”。但是,它永远不会奏效它有一个问题转换线与LicenseManagerLicenseInfo lic = ....
我总是得到如下:vmware .net api help vmware.vim.dll问题
“无法将类型‘Vmware.Vim.Viewbase’到 ‘Vmware.Vim.LicenseManagerLicenseInfo’”
但上面的“mod”声明工作正常。
我也曾尝试:
- HostLicenseConnectInfo
- LicenseAssignmentManagerLicenseAssignment
- LicenseManager有
我希望有人谁已与VMware .NET API的工作可以揭示我是什么的一些光做错了?我是C#的新手,大约1年:)但这些VMware API对我来说有些困惑。
esxList = client.FindEntityViews(typeof(HostSystem), null, null, null);
foreach (HostSystem host in esxList)
{
HostKernelModuleSystem mod = (HostKernelModuleSystem)client.GetView(host.ConfigManager.KernelModuleSystem, null);
LicenseManagerLicenseInfo lic = (LicenseManagerLicenseInfo)client.GetView(host.ConfigManager.LicenseManager, null);
string name = lic.Name;
}
更新我的实例“主持人”的:我在做这个,但是当我得到一个主机背面并查看它的ConfigManager.LicenseManager属性为空,因此很难尝试对它进行某些操作。 – 2012-02-02 14:36:08
是的,我知道我得到了同样的东西,我无法弄清楚大声笑..我以为我是从vmware api,但我不知道,我想如果它null无法做任何事情,那么什么或如何获得许可证是问题 – 2012-02-03 13:40:36
对不起,我很难过。我也在下周休假。如果你还没弄明白,我会再看一遍,因为我真的很想亲自熟悉API。 – 2012-02-03 15:30:14