Quantcast
Channel: VMware Communities : Discussion List - vSphere SDK for Perl
Viewing all articles
Browse latest Browse all 1577

Creating datastore of specific size say 2.5 TB using Vmware perl API CreateVmfsDatastore

$
0
0

How do I create datastore of specific size say 2.5 TB using Vmware perl API CreateVmfsDatastore ?

 

I have used following block of code, where i am passing $dataStoreSize as the argument -

 

my $dataStoreSize = 2.5; # datastore size is set in TB

my $newDatastoreOptions = $ds_view->QueryVmfsDatastoreCreateOptions( devicePath => $hostScsiDisk->devicePath ) ;

my $HostDiskPartitionInfo = $hs_view->ComputeDiskPartitionInfo ( devicePath => $hostScsiDisk->devicePath , layout => @$newDatastoreOptions[0]->info->layout );

my $diskname = @$newDatastoreOptions[0]->spec->vmfs->extent->diskName ;

my $partition = @$newDatastoreOptions[0]->spec->vmfs->extent->partition ;

my $diskUuid = @$newDatastoreOptions[0]->spec->diskUuid ;

 

my $partitionarr = @$newDatastoreOptions[0]->spec->partition->partition ;

my $hostDiskPartitionSpec = HostDiskPartitionSpec->new(

    chs => @$newDatastoreOptions[0]->spec->partition->chs ,

    partition => @$newDatastoreOptions[0]->spec->partition->partition,

    totalSectors => $dataStoreSize * ???,

    partitionFormat => @$newDatastoreOptions[0]->spec->partition->partitionFormat

);

 

my $hostScsiDiskPartition = new HostScsiDiskPartition( diskName => $diskname, partition => @$newDatastoreOptions[0]->spec->vmfs->extent->partition );

my $hostVmfsSpec = new HostVmfsSpec( blockSizeMb => 1, extent => $hostScsiDiskPartition, majorVersion => @$newDatastoreOptions[0]->spec->vmfs->majorVersion,  volumeName => $dataStore);

my $vmfsDatastoreCreateSpec = new VmfsDatastoreCreateSpec( partition => $hostDiskPartitionSpec, vmfs => $hostVmfsSpec , diskUuid => $diskUuid );

 

$newDatastore = $ds_view->CreateVmfsDatastore( spec => $vmfsDatastoreCreateSpec );

 

I wanted to know how the totalSectors would be calculated -

totalSectors => $dataStoreSize *???

 

Can we use API call ComputeDiskPartitionInfo, while creating a datastore of specific size?


Viewing all articles
Browse latest Browse all 1577

Trending Articles



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