The Vim::get_view() method can be used like this to create a new VMFS Datastore in Perl:
# Get HostDatastoreSystem MO to call CreateVMFSDatastore() method my $hdSystem_mo_ref = $host_view -> configManager -> datastoreSystem; # Get Managed Object so we can run methods on it my $hdSystem_view = Vim::get_view (mo_ref => $hdSystem_mo_ref ) ; my $vmfs_datastore_options = $hdSystem_view -> QueryVmfsDatastoreCreateOptions ( devicePath => $esxLun -> devicePath, vmfsMajorVersion => 5 ); my $vmfs_spec = @$vmfs_datastore_options[0] -> spec; # Here you can modify $vmfs_spec to what you need, such as the volume name: $vmfs_spec->{vmfs}->{volumeName} = $lun->lun(); # Create the Datastore! my $datastore = $hdSystem_view -> CreateVmfsDatastore( spec => $vmfs_spec );