NIM - "...the resource is currently allocated for client use" - er, NO it's not!On the odd occasion, NIM may report that a resource is allocated to a NIM client, when, in fact, it is not. Typically, you’d check that the resource was, in fact, not allocated for use to any NIM client and if it was, you would reset the client; and this would resolve the issue. But if that doesn’t work, you may need to take an additional action to resolve the problem. This doesn’t happen very often but it can frustrate you when it does.
Here’s an example of the problem. I try to remove an lpp_source resource but I’m told that it’s still allocated to a client. But it isn’t, I tell you!
# nim -o remove liveupdaterte 0042-001 nim: processing error encountered on "master": 0042-061 m_rmpdir: the "liveupdaterte" resource is currently allocated for client use
Even lsnim is telling me that the resource is still allocated, somewhere, because alloc_count is set to 1.
# lsnim -Fl liveupdaterte liveupdaterte: id = 1447111715 class = resources type = lpp_source comments = LIVE arch = power Rstate = ready for use prev_state = verification is being performed location = /export/nim/cglpp alloc_count = 1 server = master
After
trying to de-allocate the resources, by resetting my NIM clients (see
my script at the bottom of the page), and still receiving the same
error, I’m left with little choice but to manually reset the alloc_count value to 0, using the (almost undocumented) /usr
# /usr
Now lsnim shows that the resource is no longer allocated to a client and I can remove the lpp_source resource from the NIM database.
# lsnim -Fl liveupdaterte liveupdaterte: id = 1447111715 class = resources type = lpp_source comments = LIVE arch = power Rstate = ready for use prev_state = verification is being performed location = /export/nim/cglpp alloc_count = 0 server = master
# nim -o remove liveupdaterte #
I say “almost undocumented” because you can find one reference to the m_chattr command under the NIM error and warning messages page in the AIX 7.1 knowledge center. http
One question that comes to mind is how did the NIM resource end up in this state? Most likely it was the result of a failed NIM operation on the lpp_source and NIM client to which it was to be allocated. This can be tricky to pick up and almost always, it’s the next person who tries to use the resource that finds the problem and has no idea what events led up to this point.
As always, use caution when experimenting with this tool. If in doubt, take a backup of your NIM database before you start messing with the attributes, just in case you need it in the future.
Here’s my NIM client reset script. It resets the client and de-allocates any resources assigned to it. It also resets the NIM client cpuid (this is not always required) but I often use the same NIM client to install multiple AIX partitions across several Power servers, so it’s useful to me only (probably)! You can remove that line if need be.
#!/usr/bin/ksh # Reset a NIM client.
if [[ "$1" = "" ]] ; then echo Please specify a NIM client to reset e.g. lparaix1nim. else if lsnim -l $1 > /dev/null 2>&1 ; then nim -o reset -F $1 nim -Fo deallocate -a subclass=all $1 nim -Fo change -a cpuid= $1 else echo Not a valid NIM client!? fi fi |