cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
13371
Views
6
Helpful
10
Replies

UCS PowerTool + Service Profiles

jimstehlik
Level 1
Level 1

Hello,

During the recent Cisco Live, I sat in the BRKCOM-1004 - Automating UCS for Systems Administrators session hosted by Ike Kent and Jason Shaw.  During their presentation, they demonstrated using the UCS PowerTool how you could look for a fault, once a fault was reached, move a Service Profile from one blade to another.  They also used a .csv file as input.  I would like to obtain that .csv as well as see the full script because they had it looping.  Here are the four lines of code from the slide deck:

Get SP Hierarchy:
$lSpMos = (Get-UcsServiceProfile -dn $aInSpDn -hierarchy)

–Get Blade Hierarchy:
$lBladeMos = (Get-UcsManagedObject -dn $aInDn -hierarchy)

–Delete our requirement:
Get-UcsServiceProfile -dn $aInSpDn | Disconnect-UcsServiceProfile –force

–Decomission our blade:
Set-UcsManagedObject -force -XmlTag computeBlade -PropertyMap @{dn = $lPnDn ; lc= "decommission"}

–Associate a service profile with a blade:
Get-UcsServiceProfile -dn $aInSpDn | Associate-UcsServiceProfile -ServerPoolName $lPoolName -force

I would also like to know how to have the service profile associated with a blade from a second UCS domain too.

Thank you,

Jim

1 Accepted Solution

Accepted Solutions

Here is a script I wrote to do most of that.  Only thing it doesn't do is disassciate your SP on domain A at this point, but the replication it does do:

Import-Module CiscoUcsPS

$devnull = set-ucspowertoolconfiguration -supportmultipledefaultucs $true

$ip1 = "1.2.3.4"

$ip2 = "2.3.4.5"

$srcorg = "org-root"

$destorg = "org-root"

$spname = "bob"

$cred1 = Get-Credential

$cred2 = Get-Credential

$ucs1 = Connect-Ucs $ip1 -Credential $cred1

$ucs2 = Connect-Ucs $ip2 -Credential $cred2

$srcorgmo = Get-UcsManagedObject -Dn $srcorg -Ucs $ucs1

$destorgmo = Get-UcsManagedObject -Dn $destorg -Ucs $ucs2

$srcsp = $srcorgmo | Get-UcsServiceProfile -LimitScope -Hierarchy -Ucs $ucs1 -name $spname -type instance

$destsp = $destorg | get-ucsserviceprofile -LimitScope -Hierarchy -ucs $ucs2 -Name $spname -Type instance

$diff = @()

$diff = Compare-UcsManagedObject @($destsp) @($srcsp)

Sync-UcsMo -ucs $ucs2 ($diff) -force

View solution in original post

10 Replies 10

ikent
Level 1
Level 1

Hi Jim

Thanks for attending our session.  Below is a link to the script and related artifacts (including the .csv file):

https://github.com/greygoose/PowerTool/tree/master/MonitorSp

Typically, you associate a service profile with a pool or a physical hardware within a UCS domain (a FI or HA pair of FI's and attached chassis, blades, rack servers, etc).  If you wish to use the same service profile in another domain, you can copy the service profile to the other domain.  This can be done using the "Sync-UcsManagedObject" PowerTool Cmdlet.

Here is an example that I have cut and pasted from the PowerTool book.

Sync-UcsManagedobject -Ucs SYSB (Compare-UcsManagedObject (Get-UcsOrg -ucs SYSB) (Get-UcsOrg -ucs SYSA)) -whatif 

The PowerTool book can be found here:

http://www.cisco.com/en/US/docs/unified_computing/ucs/sw/msft_tools/powertools/ucs_powertool_book/ucs_pwrtool_bkl1.html#wp439338

UCS Central 1.1 (released today) provides the ability to create global service profiles.  Global service can literally be shared across 100's of domains!

Cheers

Ike

Ike,

Thank you for the awesome and complete answer.  Once again, you and Jason did an awesome job as well as all the other presentations that I was fortunate to attend.

Between your session and Jeff Silberman's session, I learned a lot.  Especially being new to PowerTool.

Jim

Ike,

 

I've been trying to implement the "Sync-UcsManagedObject" PowerTool Cmdlet as you suggested, but I seem to be running into an issue getting the proper syntax for the variable $xlateDN.  Here is my code:

   

$xlateDn['Get-UcsServiceProfile -ucs ahc-lgh-ucs2 -Dn org-root/ls-DWtest'] = 'Get-UcsServiceProfile -ucs AHC-UCS3 -Dn org-root/ls-DWtest'

 

$org = Get-UcsOrg -ucs ahc-lgh-ucs2 -Name root -LimitScope

 

$destOrg = Get-UcsOrg -ucs AHC-UCS3 -Name root -LimitScope

 

Sync-UcsManagedObject (Compare-UcsManagedObject (Get-UcsServiceProfile  -Org $destOrg -Name DWtest -LimitScope) (Get-UcsServiceProfile -Org $org -Name DWtestDR -LimitScope ) -XlateMap $xlateDn) -Force | select Dn - verbose

I do appreciate your help.

Thank you,

Jim

James:

What is your goal with the SP copy here?  Are you trying to copy one SP from one org to another in one UCS domain, or into another domain across systems?  If you are just trying to copy a SP from one domain to another in the same org, you don't need to do that. 

Let me know your intent here, as it's not clear in the thread to me, and I'll help you out.

Eric

Eric,

I do apologize for not clearly stating my intent with the original post.  I also thought it would be good to post the question here so that others could benefit.

My goal is as follows:

I have a Service Profile in UCS doman A that I would like to copy that Service Profile to UCS domain B.  The reason being is that UCS domain A is in the primary data center and UCS B is in the secondary data center and as part of a disaster recovery and or business continuity plan, I would like to create a script to replicate a Service Profile to the second UCS domain, disassociate the Service Profile from the blade it was associated with in UCS domain A, and then associate it with a blade in UCS domain B.

I am trying to do this in stages with the first stage to be the coping of the Service Profile between the two domains and making sure that I can replicate any changes made to the Service Profile in domain A can be replicated to domain B.

Thank you again,

Jim

Here is a script I wrote to do most of that.  Only thing it doesn't do is disassciate your SP on domain A at this point, but the replication it does do:

Import-Module CiscoUcsPS

$devnull = set-ucspowertoolconfiguration -supportmultipledefaultucs $true

$ip1 = "1.2.3.4"

$ip2 = "2.3.4.5"

$srcorg = "org-root"

$destorg = "org-root"

$spname = "bob"

$cred1 = Get-Credential

$cred2 = Get-Credential

$ucs1 = Connect-Ucs $ip1 -Credential $cred1

$ucs2 = Connect-Ucs $ip2 -Credential $cred2

$srcorgmo = Get-UcsManagedObject -Dn $srcorg -Ucs $ucs1

$destorgmo = Get-UcsManagedObject -Dn $destorg -Ucs $ucs2

$srcsp = $srcorgmo | Get-UcsServiceProfile -LimitScope -Hierarchy -Ucs $ucs1 -name $spname -type instance

$destsp = $destorg | get-ucsserviceprofile -LimitScope -Hierarchy -ucs $ucs2 -Name $spname -Type instance

$diff = @()

$diff = Compare-UcsManagedObject @($destsp) @($srcsp)

Sync-UcsMo -ucs $ucs2 ($diff) -force

Hi

have tried the script but get this error..

Get-UcsServiceProfile : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or

the input and its properties do not match any of the parameters that take pipeline input.

At C:\script\ucs\migrate.ps1:39 char:43

+ $destsp = $destorg | get-ucsServiceprofile <<<<  -LimitScope -Hierarchy -ucs $ucs2 -name $spname -type instance

    + CategoryInfo          : InvalidArgument: (org-root:String) [Get-UcsServiceProfile], ParameterBindingException

    + FullyQualifiedErrorId : InputObjectNotBound,Cisco.Ucs.Cmdlets.GetUcsServiceProfile

any ideas?

Regards Patrik

Can you please post how you got "$destorg"? Provide the code where you defined it, and a "$destorg | get-member" output. I want to make sure you are pipelining a UCS Organization object.

For example:

PS C:\ucs> $destorg = Get-UcsOrg -Name root

PS C:\ucs> $destorg

Descr :

Level : root

Name : root

PermAccess : yes

Dn : org-root

Rn : org-root

Status :

XtraProperty : {}

Ucs : eric

PS C:\ucs> $destorg | Get-Member

TypeName: Cisco.Ucs.OrgOrg

Name MemberType Definition

-


Hi

thanks for a quick reply, but i found another script that solved it for me

Synchronize UCS Objects

Regards Patrik

I use UCS Central with 4 domains. I was trying to associate a service profile (ServiceProfileA) to a new blade from Domain2 Chassis 11/ Slot 1

 

I am not able to complete the command. Could you please help 

Associate-UcsCentralServiceProfile -ServiceProfile ServerProfileA 

 

 

Review Cisco Networking for a $25 gift card

Cisco UCS X-Series Energy Efficiency Offer