I can not figure out what I am doing wrong, a very unhelpful error "Undefined subroutine &VmfsDatastoreCreateSpec::type called at /usr/share/perl/5.14/VMware/VICommon.pm line 1501" is thrown when I run this subroutine
sub attach(){
#getting the arguments
(my $storage, my $host) = @_;
#creating the arguments for creating the datastore
my $partition = HostDiskPartitionSpec->new(
chs => undef,
partition => undef,
totalSectors => undef
);
my $hostPartition = HostScsiDiskPartition->new(
diskName => $storage->uuid,
partition => 0
);
my $hostVmfs = HostVmfsSpec->new(
blockSizeMb => undef,
extent => $hostPartition,
majorVersion => 5,
volumeName => $storage->uuid
);
my $spec = VmfsDatastoreCreateSpec->new(
extent => undef,
partition => $partition,
vmfs => $hostVmfs,
diskUuid => $storage->uuid
);
#getting the data store manager
my $dataStoreManager = Vim::get_view(mo_ref => $host->configManager->datastoreSystem);
$dataStoreManager -> CreateVmfsDatastore(Vim::get_view(mo_ref => $spec, view_type => "VmfsDatastoreCreateSpec"));
}