Quantcast
Channel: VMware Communities: Message List - vSphere Management SDK
Viewing all articles
Browse latest Browse all 2052

Re: Creating a VMFS Datastore using Vi Perl Toolkit Question

$
0
0

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 );

Viewing all articles
Browse latest Browse all 2052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>