Automation

 View Only
  • 1.  How to attach shared RAC disks to other nodes prgramatically?

    Posted Sep 19, 2020 01:55 PM

    I have some Oracle RAC nodes that have been built with all shared disks, ASM , etc. I need to attach the shared disks (IndependentPersistent) to the other nodes in the RAC.

    I think I have a pretty good idea of how this should work.  This is what I have so far:

    $vm1 = Get-VM -Name PRD-DB01
    $vm2 = Get-VM -Name PRD-DB02
    $scsi2 = (Get-ScsiController -VM $vm2 | Where-Object{$_.extensiondata.busNumber -eq 2})
    $scsi3 = (Get-ScsiController -VM $vm2 | Where-Object{$_.extensiondata.busNumber -eq 3})

    $sharedHD = (Get-HardDisk -VM $vm1 | Where-Object {$_.Persistence -eq "IndependentPersistent"})

    $sharedHD | FT -AutoSize

    CapacityGB Persistence                                                         Filename
    ---------- -----------                                                         --------
    80.000     IndependentPersistent  [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_2.vmdk
    80.000     IndependentPersistent  [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_4.vmdk
    75.000     IndependentPersistent  [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_6.vmdk
    75.000     IndependentPersistent  [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_8.vmdk
    80.000     IndependentPersistent  [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_3.vmdk
    80.000     IndependentPersistent  [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_5.vmdk
    75.000     IndependentPersistent  [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_7.vmdk
    75.000     IndependentPersistent  [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_9.vmdk
    75.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_10.vmdk
    75.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_12.vmdk
    75.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_11.vmdk
    75.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_13.vmdk
    15.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_14.vmdk
    15.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_16.vmdk
    15.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_15.vmdk
    15.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_17.vmdk
    15.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_18.vmdk
    15.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_20.vmdk
    15.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_19.vmdk
    15.000     IndependentPersistent [XIO-ORACLE-VM-01] PRD-DB01/PRD-DB01_21.vmdk

    So I have all of the disk info from the first node.  The first 4 disks need to go to $scsi2, the next 4 to $scsi3, back and forth.
    I've tried this:

    PS C:\> foreach ($disk in $sharedHD[0,1,2,3]) {
    New-HardDisk -VM $vm2 -DiskPath $disk.Filename -Persistence $disk.Persistence -Controller $scsi2
    }

    CapacityGB      Persistence                                                    Filename
    ----------      -----------                                                    --------
    80.000          IndependentPersis... ...RACLE-VM-01] PRD-DB01/PRD-DB01_2.vmdk
    New-HardDisk : 9/19/2020 9:36:06 AM    New-HardDisk        Invalid configuration for device '0'.    
    At line:2 char:1
    + New-HardDisk -VM $vm2 -DiskPath $disk.Filename -Persistence $disk.Per ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [New-HardDisk], InvalidDeviceSpec
        + FullyQualifiedErrorId : Client20_VirtualDeviceServiceImpl_AttachHardDisk_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.NewHardDisk
     
    New-HardDisk : 9/19/2020 9:36:12 AM    New-HardDisk        Invalid configuration for device '0'.    
    At line:2 char:1
    + New-HardDisk -VM $vm2 -DiskPath $disk.Filename -Persistence $disk.Per ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [New-HardDisk], InvalidDeviceSpec
        + FullyQualifiedErrorId : Client20_VirtualDeviceServiceImpl_AttachHardDisk_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.NewHardDisk
     
    New-HardDisk : 9/19/2020 9:36:16 AM    New-HardDisk        Invalid configuration for device '0'.    
    At line:2 char:1
    + New-HardDisk -VM $vm2 -DiskPath $disk.Filename -Persistence $disk.Per ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [New-HardDisk], InvalidDeviceSpec
        + FullyQualifiedErrorId : Client20_VirtualDeviceServiceImpl_AttachHardDisk_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.NewHardDisk
     

    So the first disk attaches to the correct adapter, but then it fails.  The VM also shows the newly attached disk as No Sharing, but it was created as MultiWriter.

    I have tried manually specifying the adapter as $scsi2:1, but that didn't work either.



  • 2.  RE: How to attach shared RAC disks to other nodes prgramatically?

    Posted Sep 19, 2020 02:57 PM

    Have you looked at Add and set Hard Disk MultiWriter flag on Powered On VM

    It uses the API method to add the shared disks in multi-writer mode



  • 3.  RE: How to attach shared RAC disks to other nodes prgramatically?

    Posted Sep 19, 2020 03:28 PM

    I have not, but I will take a look.

    Thanks, Luc!