Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

NBU 7.1 available_media bug with encryption status?

Created: 27 May 2011 | 2 comments

I just upgraded to NBU7.1 (from 6.5.5) and started playing around with KMS encryption.  Ran into an issue with the available_media script, which I use for multiple scripted reports, where the status of the encrypted tapes came up as IMPORTED/FULL/SUSPENDED/FROZEN/MPX/WORM/BEMEDIA.

Taking a look at the code:

                                # Translate bpstat into a string
                                if [ "$bpstat" -gt 8192 ] ; then
                                        # Ignore all bits > 8192
                                        Mod=`expr $bpstat \/ 8192`
                                        bpstat=`expr $bpstat - \( ${Mod} \* 8192 \)`
                                        if [ "$bpstat" -gt 8191 ] ; then
                                                isencrypted=1
                                                bpstat=`expr $bpstat - 8192`
                                        fi
                                fi

                                if [ "$bpstat" -gt 4095 ] ; then
                                        isbemedia=1
                                        bpstat=`expr $bpstat - 4096`
                                fi

                                ........

and seeing that the status of the tape as reported by bpmedialist was 8192, what was happening was that the first check (where it drops bits >8192) failed because my status was -eq 8192, not -gt 8192, then it got caught in all the subsequent checks which tag the tape with all the attributes (bemeida, worm, mpx, etc).

I moved the -gt 8191 check out of the -gt 8192 check, which looks like what was intended:

                                if [ "$bpstat" -gt 8192 ] ; then
                                        # Ignore all bits > 8192
                                        Mod=`expr $bpstat \/ 8192`
                                        bpstat=`expr $bpstat - \( ${Mod} \* 8192 \)`
                                fi

                                if [ "$bpstat" -gt 8191 ] ; then
                                        isencrypted=1
                                        bpstat=`expr $bpstat - 8192`
                                fi

                                if [ "$bpstat" -gt 4095 ] ; then
                                        isbemedia=1
                                        bpstat=`expr $bpstat - 4096`
                                fi

                                .........

and it seems to work - now my status is ACTIVE/ENCRYPTION.

I'm wondering if others have run into this, if they've made the same modification I have, and if they have seen a problem with it (or if they people just see a problem with the modification I've made).

Bill

Comments 2 CommentsJump to latest comment

bills's picture

I hadn't seen status codes > 8192 when I posted the last bit.  Now on tapes with status > 8192, my "fix" above seems to interpret all the bits correctly except for the encryption bit (8192).  Taking another stab, I still keep the -gt 8191 bit seperate, but I change the first if clause to

                               if [ "$bpstat" -ge 16384 ] ; then
                                        # Ignore all bits > 8192
                                        Mod=`expr $bpstat \/ 8192`
                                        bpstat=`expr $bpstat - \( ${Mod} \* 8192 \)`
                                fi
 

while does actually do what the comment states - ignore all bits > 8192 (16384, 32768), but DON'T ignore VALUES over 8192, which is what the original code does.

So:

                                # Translate bpstat into a string
                                if [ "$bpstat" -ge 16384 ] ; then
                                        # Ignore all bits > 8192
                                        Mod=`expr $bpstat \/ 8192`
                                        bpstat=`expr $bpstat - \( ${Mod} \* 8192 \)`
                                fi

                                if [ "$bpstat" -gt 8191 ] ; then
                                        isencrypted=1
                                        bpstat=`expr $bpstat - 8192`
                                fi

......

This seems to give me what I expect.

I hope this is useful to someone......

Bill

Marianne's picture

THANKS for sharing!!

Supporting Storage Foundation and VCS on Unix and Windows as well as NetBackup on Unix and Windows
Handy NBU Links