cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Modify Boot Policy to service profile template

511
Views
0
Helpful
0
Comments
Advisor
This document was generated from CDN thread

Created by: Matteo Belletti on 31-07-2012 02:30:24 AM
Hi all,
I need to modify my Service Profile profile Boot Policy in a Disaster Recovery Environment. Actually the Boot Policy is set to boot from local disk, when we'll test the disaster recovery, the server will boot from san.
How can i script it with powershell?
Thanks

Subject: RE: Modify Boot Policy to service profile template
Replied by: Sage Harvey on 31-07-2012 10:03:49 AM
Hi Matteo,

You can do something like this:
1Get-UcsServiceProfile -name spName | Set-UcsServiceProfile -BootPolicyName san_boot -Force
2or when you're done...
3Get-UcsServiceProfile -name spName | Set-UcsServiceProfile -BootPolicyName local_boot -Force


That's assuming you've set up a boot policy called san_boot & local_boot, you've got boot luns built, presented, zoned, etc.  The -Force just prevents confirmation that you want to change the boot policy setting.

Sage

Subject: RE: Modify Boot Policy to service profile template
Replied by: Matteo Belletti on 31-07-2012 10:16:08 AM
Hi,
I've resolved with the following script:


#########################
# Input Parameters #
#########################
PARAM ($Org, $SPTemp)


#######################
# Input variables here#
#######################
$ucsvip = "x.x.x.x"
$ucsadmin = "ucs_user"
$ucspsswd = "ucs_user"

#########################################
# Import the Cisco UCS PowerTool module #
#########################################
Import-Module CiscoUcsPS


############################################
# Authenticate to UCSM with the admin user #
############################################
$user = $ucsadmin
$password = $ucspsswd | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object system.Management.Automation.PSCredential($user, $password)
$handle1 = Connect-Ucs $ucsvip -Credential $cred

############################################
# Set Service Profile Template Boot Policy #
############################################


Set-UcsServiceProfile -ServiceProfile org-root/org-$Org/$SPTemp -BootPolicyName BOOT_POLICY_NAME -force


# Loop through each SP requiring acknowledgement
${lsAcks} = Get-UcsLsmaintAck -OperState "waiting-for-user" 
   
foreach (${lsAck} in ${lsAcks})
{
     # Acknowledge Maintenance Acknowlwedgement to progress reboot
     Set-UcsLsmaintAck -LsmaintAck ${lsAck} -AdminState "trigger-immediate" -force
    
     # Wait for UCS state change; reboot triggered
     ${lsAck} | Watch-Ucs -Property OperState -SuccessValue pending-next-boot -PollSec 30 -TimeoutSec 600
   
}
CreatePlease to create content
This widget could not be displayed.