Script to reset NIM state and deallocate resources

Sometimes we need to reset the state of a lpar on our NIM server. You can use smitty, but it’s simpler to use a shell script.
First, we check the which NIM resources our LPAR has inside NIM:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@nim] lsnim -l lpar1
lpar1:
   class          = machines
   type           = standalone
   current_master = nim
   connect        = nimsh (secure)
   sync_required  = yes
   platform       = chrp
   netboot_kernel = mp
   if1            = ent-Network9 lpar1 0
   cable_type1    = N/A
   Cstate         = BOS installation has been enabled
   prev_state     = ready for a NIM operation
   Mstate         = currently running
   lpp_source     = LPP_INS_AIX61
   spot           = spotimagen_aix6
   cpuid          = 000U040AD401
   control        = master

As you can see, lpar1 has two resources, one lpp_source and a spot resource.
Now. it’s time for this script (resetaix.ksh):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/ksh
# Copyright (C) 2012 Israel Garcia iga3725 @ yahoo.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program
# You need to add parameter $1 as the name of the lpar (machine resource) to the script:
#
# Check machine resource exist on NIM:
lsnim -c machines|grep "$1" 1>/dev/null
if [[ $? -eq 0 ]] ; then
   echo
    else
       echo "ERROR: $1 machine resource does not exists on NIM." && exit 1
fi
#
nim -Fo reset $1
nim -Fo deallocate -a subclass=all $1

Check again machine resources:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@nim:/usr/local/bin] lsnim -l lpar1
lpar1:
   class          = machines
   type           = standalone
   current_master = nim
   connect        = nimsh (secure)
   sync_required  = yes
   platform       = chrp
   netboot_kernel = mp
   if1            = ent-Network9 lpar1 0
   cable_type1    = N/A
   Cstate         = ready for a NIM operation
   prev_state     = BOS installation has been enabled
   Mstate         = currently running
   cpuid          = 000E050AD400
   Cstate_result  = reset

Just thanks if the post was helpful

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Configuration of AIX Fast Connect and SMBFS
Viewed 8587 times since Mon, Jun 18, 2018
Authenticate AIX using MS DC’s kerberos servers (Active Directory)
Viewed 2236 times since Thu, Feb 21, 2019
Convert to Scalable Volume Groups
Viewed 4019 times since Wed, May 30, 2018
Part 2, NFS monitoring and tuning
Viewed 6532 times since Mon, Jun 4, 2018
Removing Failed or Missing Paths
Viewed 2877 times since Wed, May 30, 2018
R2dump debug tool
Viewed 2304 times since Tue, Sep 8, 2020
Processes and Devices—It’s All About the Children
Viewed 2305 times since Wed, May 30, 2018
Practical Guide to AIX - network
Viewed 17800 times since Thu, Sep 20, 2018
0516-404 allocp: This system cannot fulfill the allocation request. [AIX]
Viewed 5334 times since Thu, Sep 20, 2018
AIX Errpt - Diag - Alog
Viewed 3757 times since Wed, Mar 20, 2019