【发布时间】:2019-04-20 09:36:29
【问题描述】:
我正在尝试使用 Vmware Perl SDK 来挂载一个 nfs 数据存储,并且文档...具有挑战性...但是虽然我认为我已经解决了,但我得到了:
无法通过 ./mkds 第 65 行的包“ManagedObjectReference”定位对象方法“CreateNasDatastore”。
我也更新到了最新的 Perl SDK (6.7)...
根据https://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.host.DatastoreSystem.html
CreateNasDatastore是Managed Object HostDatastoreSystem中的一个方法,它是HostConfigManager的一个属性,所以对于每个主机,我获取HostSystem视图然后使用configManager->datastoreSystem对象:
...
foreach my $host_view (@$host_views) {
...
print "connected to $host\n";
my $cf_views = Vim::find_entity_views(view_type => 'HostSystem');
foreach my $cfv (@$cf_views) {
my $ds = $cfv->configManager->datastoreSystem;
print Dumper($ds);
# no arguments yet, just trying to find out how to invoke it
$ds->CreateNasDatastore();
exit 0;
}
}
connected to vcenter01.ad.casco.net
Hosts found:
1: cvo-esx5.ad.casco.net
connected to cvo-esx5.ad.casco.net
$VAR1 = bless( {
'value' => 'ha-datastoresystem',
'type' => 'HostDatastoreSystem'
}, 'ManagedObjectReference' );
Can't locate object method "CreateNasDatastore" via package "ManagedObjectReference" at ./mkds line 65.
我不确定如何访问它,希望其他人比我更了解这个结构...
【问题讨论】: