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

Adding a virtual disk on SCSI controller with physical/virtual sharing fails

$
0
0

I am adding a virtual disk to a SCSI controller with either physical or virtual bus sharing, which is getting failed for the below code. Same code gets successful if bus sharing is "noSharing".

 

    $vmView = Vim::find_entity_view(view_type=>'VirtualMachine',filter=>{name=>$vms[0]});
    $controllerKey = find_scsi_cntlrkey(vm=>$vmView,controller=>$cntlr);
    my %hash = (
                vm=>$vmView,
                diskMode=>"persistent",
                fileName=>$filename,
                controllerKey=>$controllerKey,
                unitNumber=>$target,
                size=>"5242880",
                backingtype=>"regular",
                uuid =>undef,
                deviceName=>undef,
                );
    my $filespec = get_vdiskSpec(%hash);
    print Dumper $filespec;
    my $vdisk = add_virtualdisk(vm=>$vmView,devspec=>$filespec);

 

 

 

Command execution:

 

amrut@2:~/scripts/vmware/apps$ perl RDM_add.pl  --vmname vm1  --server vcenter_server --username administrator@vsphere.local --password Pass@123 --operation add --controller 2:2 --filename vm_232
Adding new LsiLogicSAS vSCSI Controller 2 to "vm1"
Successfully added
$VAR1 = bless( {
                 'fileOperation' => bless( {
                                             'val' => 'create'
                                           }, 'VirtualDeviceConfigSpecFileOperation' ),
                 'operation' => bless( {
                                         'val' => 'add'
                                       }, 'VirtualDeviceConfigSpecOperation' ),
                 'device' => bless( {
                                      'capacityInKB' => '5242880',
                                      'backing' => bless( {
                                                            'fileName' => '[datastore1 (4)]/vm1/vm_232.vmdk',
                                                            'diskMode' => 'persistent'
                                                          }, 'VirtualDiskFlatVer2BackingInfo' ),
                                      'unitNumber' => 2,
                                      'controllerKey' => '1002',
                                      'key' => -1
                                    }, 'VirtualDisk' )
               }, 'VirtualDeviceConfigSpec' );
Unable to configure virtual device.

amrut@2:~/scripts/vmware/apps$

 

In vcenter GUi I am getting below error:

 

Failed to power on scsi2:2.
Failed to add disk scsi2:2.

 

 

 

 

 

But Getting successful if bus sharing is none!

 

amrut@uptohell2:~/scripts/vmware/apps$ perl RDM_add.pl  --vmname vm1 --server vcenter_server --username administrator@vsphere.local --password Pass@123 --operation add --controller 1:2 --filename vm_232
$VAR1 = bless( {
                 'fileOperation' => bless( {
                                             'val' => 'create'
                                           }, 'VirtualDeviceConfigSpecFileOperation' ),
                 'operation' => bless( {
                                         'val' => 'add'
                                       }, 'VirtualDeviceConfigSpecOperation' ),
                 'device' => bless( {
                                      'capacityInKB' => '5242880',
                                      'backing' => bless( {
                                                            'fileName' => '[datastore1 (4)]/vm1/vm1_232.vmdk',
                                                            'diskMode' => 'persistent'
                                                          }, 'VirtualDiskFlatVer2BackingInfo' ),
                                      'unitNumber' => 2,
                                      'controllerKey' => '1001',
                                      'key' => -1
                                    }, 'VirtualDisk' )
               }, 'VirtualDeviceConfigSpec' );
Virtual Disk created.
amrut@2:~/scripts/vmware/apps$

 

 

Can some one please let me know, do we need to pass any other parameter for adding disk to SCSIController with bus sharing physical/virtual ?

Thanks

AMrut


Viewing all articles
Browse latest Browse all 1577

Latest Images

Trending Articles



Latest Images

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