Blog

Implementation of tree data structure in Python

Posted by on Sep 22, 2014 in Python | 0 comments

Environment: Language used: python Version: 3.3.2 OS: Fedora 20 Data Structure used: Python lists Algorithm: Enter the height of the tree Type “Add” to add a node to the tree: First node should be root For any other value: Ask the user if its a left or a right node Find the possible parents (Note: For example if the height of the tree is 2 with elements 1,2,3. Where 1 is the root node and 2 is left node and 3 is the right node. For node 2 the possible parent is 1 which is at index 1.  ) List the possible parent and allow the user to select the parent Add the value to the node Enter ‘N’ to go to next level or ‘S’ to stay at the same level. (Note: If we take the same example as explained above then the first level is consist of 1 node i.e. root and the 2nd level is consist of child node 2 and 3 and so on) Type “Show” to view the current tree structure Type “exit” to exit the program Code Snippet: Implementing tree data structure using Python Python class buildTree (): """Please run the code with Python 3""" def __init__(self): """Class to build your own tree data structure""" self.root_status=False self.data_list=[] self.current_level=1 def possible_parents(self): result=[] for i in range(self.current_level,self.current_level*2): if self.data_list[i]!=-999: result.append(i) return result def addNode(self,node): """The following function will add the node on the left side of the parent""" val=self.possible_parents() if len(val)==0: print ("Error: No parent available. Cannot add any value as a left node") return else: print ("\n") print ("---List of possible parents:") print ("---Index: " + str([data for data in val])) print ("---Value: " + str([self.data_list[data] for data in val])) print ("---Note: The above list shows the indexes and the values of the possible parents. Select the index for which you want to assign the current node as parent") while True: input_user=int(input(">>")) if input_user not in val: print ("Error: Incorrect input. Try Again") else: break input_value=int(input("---Enter the value for {} node with parent {} >> ".format(node,self.data_list[input_user]))) try: if node=="Left": self.data_list[input_user*2]=input_value elif node=="Right": self.data_list[input_user*2+1]= input_value return except: print ("Error: No more space left. Please try again with a higher level/height value") return def changeLevel(self): #Asking the user if they want to continue on the same level or move to another level print ("---If you want to move to the next level type N or S to stay on the same level") print ("---Note: Current level is {}".format(self.current_level-1)) while True: try: input_user = input(">> ") if input_user.lower()=="n": self.current_level=self.current_level*2 break elif input_user.lower()=="s": break except: print ("Error: Exception raised. Incorrect format") print ("Error: Incorrect input. Try Again") return def addRoot(self): """The following function will add the data at root node""" self.root_status=True input_user=input(">>Enter the value for root node >> ") self.data_list[1]=input_user print ("---Value added at root node\n") return def message(self): """The following function will handle the menu portion and after gathering the input from the user it will perform the corrospondng operations """ print ("Type \"Add\" to add a node") print ("Type \"Show\" to view the current tree structure") print ("Type \"Exit\" to \"exit\" the program\n\n") try: input_user=input(">>") #Requesting the user for input except: print ("Error: Incorrect input") if input_user=="add": #1 if if self.root_status==False: #2 if print ("---The first node should be root") return self.addRoot() else: try: input_user=input("---Type Left...

read more

Mellanox IB card failed to initialize after updating the bios to 3.3.2 on Dell C6145

Posted by on Aug 10, 2014 in BMC, Dell CloudEdge | 0 comments

Issue: After updating the bios firmware on Dell C6145, the Mellanox IB card failed to initialize. The dmesg shows the following error message: mlx4_core 0000:04:00.0: Failed to initialize queue pair table, aborting. mlx4_core 0000:04:00.0: PCI INT A disabled mlx4_core: probe of 0000:04:00.0 failed with error -16   Solution 1: Downgrade the bios firmware back to 3.0.0   Solution 2: 1) Reboot the server and press F2 during the post to go to bios menu 2) Under BIOS setup utility go to Exit menu and select Load Optimal Defaults and reboot the server. Note: Make sure to change the BMC settings as per your environment after the above steps. Resetting to default is going to change the BMC and boot settings back to...

read more

RACADM command fails when importing iDRAC Licence

Posted by on Jul 17, 2014 in Dell, Dell Poweredge, DRAC | 0 comments

Issue: When importing the iDRAC license using racadm command it reports: root@theprojectbot:-# racadm license import -f mylicense.xml -c idrac.embedded.1 NOTE: This Integrated Dell Remote Access Controller does not support RACADM commands. Please contact Dell Customer Service to upgrade your version of iDRAC. The executed RACADM commands are not supported by the current version of Integrated Dell Remote Access Controller (iDRAC) in the system. To upgrade to latest version of iDRAC, contact Dell customer service.   Solution: Install packages srvadmin-idrac7 and srvadmin-idracadm7 If you have dell-omsa-repository configured then just run the following command: root@theprojectbot:-# yum install srvadmin-idrac7 srvadmin-idracadm7   Note: The above packages are different then srvadmin-idracadm and srvadmin-idrac Note: To check the installed packages on a rpm based OS, run the following command: root@theprojectbot:-# rpm -qva | grep...

read more

How to gather controller logs on Power Edge 12G server from Life cycle controller

Posted by on Jun 29, 2014 in Dell, Dell Poweredge, RAID | 0 comments

Instructions Step 1 Install USB flash drive in the server Step 2 Reboot the server and press F2 during the POST to enter BIOS Step 3 Under BIOS go to Device Settings > RAID Controller > Controller Management Step 4 Click Save Debug Log (Make sure you have a USB key plugged to the server) Step 5 On the next screen it will show up your USB device where you can save the...

read more

How to control indication light on Dell CloudEdge Servers?

Posted by on Jun 21, 2014 in BMC, Dell, Dell CloudEdge, Dell Poweredge, DRAC | 0 comments

There are multiple ways to do it: Using BMC Tool Download the BMC tar package from following link: http://poweredgec.com/files/bmc-2014-01-08.tgz Extract the contents using command root@theprojectbot:-#tar –xvf bmc-2014-01-08.tgz Run the command: root@theprojectbot:-#./bmc id_led blink Note: Other command that can be used are: on|off|blink|fastblink Note: BMC web interface does have a Chassis indication option which shows the current status of the lights but it doesn’t work. Dell is aware of this issue and currently working on a firmware fix.   Using ipmitool The following ipmitool command will blink the indication light for 20 sec. root@theprojectbot:-#ipmitool chassis identify 20 Note:The above command can be use on most of the Dell & HP...

read more

Script to gather storage, hardware logs from Dell Cloudedge and Poweredge Servers

Posted by on Feb 26, 2014 in BMC, Dell, Dell CloudEdge, Dell Poweredge, DRAC, Operating Systems, RAID | 0 comments

Log-bot script uses ipmitool, lshw, MegaCli to grab System event logs, controller logs and various hardware information. During execution the script checks for the ipmitool (delloem patched) and install it if its not available. The script takes 4-8 minute to complete. It is successfully tested on various Dell CloudEdge and PowerEdge servers running different Linux distributions. List of logs it gathers: Chassis -Fan rpm’s -FRU information -Power consumption and power history -Power Supply -DRAC info -System event logs -Temperature information OS -Basic Linux command output: (df -h, dmesg, fdisk, free, fstab, lspci etc) -Network Information -Bus information -Logical information -Driver and firmware information -Tape drive information -Disk and volume information -Controller & Vendor information -Size & disk information -Disk’s UUID -Disk size & serial number -BMC information -GPGPU information Storage -Controller logs -Partition information & other storage related information Note: In each bundle there will be a execs.logs file which will have all the commands the script execute.   How to gather logs: For previous versions click here  Download the script by clicking on link or root@theprojectbot:-# wget http://theprojectbot.com/Program/log-bot_v2.tar.gz  Extract the file using the command: root@theprojectbot:-# tar -xvf log-bot_v2.tar.gz  Navigate to the right directory using command: root@theprojectbot:-# cd bot  Run the script: root@theprojectbot:-# python...

read more

Issue with iDRAC 7 display when installing openSUSE 12.3

Posted by on Nov 13, 2013 in Dell, Dell Poweredge, DRAC, Operating Systems | 0 comments

Issue: When try to install openSUSE 12.3 via iDRAC7 the virtual console screen distorts as shown in the picture below. Resolution: Boot the server from the DVD and on installation menu set the video mode to 1024×768 and on boot option set the kernel parameter to usbcore.autosuspend=-1 as shown below. Explanation: Changing the Video mode to any other resolution fixes the display problem but on the other hand it disables the keyboard and mouse. This happen because some of the power management feature in the LFC/DRAC put the DRAC keyboard to temporary sleep when not being used. In this specific installation, for some reason the keyboard and mouse never came back up after sent to the temporary sleep. The usbcore.autosuspend=-1 parameter forces it so stay in action all the time and fixes the...

read more

ipmitool Cheatsheet and Configuring DRAC from ipmitool

Posted by on Oct 7, 2013 in DRAC | 2 comments

  1) List of helpful ipmitool commands: Check BMC Firmware Revision: #ipmitool –I open bmc info | grep –A3 “Firmware Revision” Check SEL log: #ipmitool sel List SEL log: #ipmitool sel list Check which node you are in [For Dell Cloud edge]: #ipmitool raw 0x34 0x11 Reset BMC/DRAC to default: #ipmitool  mc reset cold   2) Configure DRAC from ipmitool Set BMC/DRAC static IP #ipmitool lan set 1 ipsrc static Set BMC/DRAC IP Address #ipmitool lan set 1 ipaddr <ip add of bmc> Set BMC/DRAC Subnet Mask #ipmitool lan set 1 netmask <netmask addr> Set BMC/DRAC Default Gateway #ipmitool lan set 1 defgw ipaddr <ip add> Change the NIC settings to dedicated #ipmitool raw 0x30 0x24 2 Change the NIC settings to shared #ipmitool raw 0x30 0x24 0 Check the NIC settings #ipmitool raw 0x30 0x25 [Output of 00 means shared and 02 means dedicated] Restart the BMC/DRAC #ipmitool mc reset...

read more

Dell iDRAC CLPSession error

Posted by on Sep 24, 2013 in DRAC | 0 comments

Symptoms: DRAC web interface is not working When try ssh to the DRAC it returns: Create CLPsession instance error (1) ; Curl error 7 Solution: Do a soft reset on the DRAC. If you have racadm install then run the following command:  racadm racreset soft If you have ipmitool installed then run the command:  ipmitool mc reset cold Looking for ipmitool rpm, click...

read more

What is a punctured RAID array?

Posted by on Sep 17, 2013 in RAID | 1 comment

What is a puncture stripe or a punctured RAID array and how to recover from it?  To understand the concept of a punctured stripe first we need to understand what exactly a RAID array is and how the information is stored on the disks in a RAID configuration. In the following post I am considering RAID5 (with three drives) as an example and will try to explain how the puncture happen and how to get rid of it. What is RAID5: In RAID5 the data is distributed in the form of parity across all the member disks.  In the case if one of the drive goes bad the data can rebuild again by calculating the parity across all the drives. More information on the parity can be found on: http://www.dataclinic.co.uk/raid-parity-xor/ But if two drives goes bad then there is no way to rebuild the data back to its original state. In most of the LSI* based controller whenever one disk fails from a container (Virtual Disk), the controller marked that virtual disk as degraded. What causes a puncture? Usually there are several things which can cause a puncture but it usually starts with a failed drive. For an instance John is a busy system admin and his job is to monitor a Dell PE 1950 which has a PERC 5/i controller installed [RAID5 with three disks] . He did not bother to do anything unless there is a amber light reporting an error on the front LCD panel. One ugly Monday  he came to work and saw a drive in slot 0 blinking amber. He called the support and ordered a new drive. Once he received the new drive he yanked the bad hard drive out and put the new drive in. As soon as he puts the new drive in, it starts rebuilding and in an hour or so all the drives are green again.   What did John do wrong? Most of us will say he didn’t do anything wrong. So lets move forward.   After couple of days John find out that drive in slot 1 is now blinking amber. Oh! Bummer. He called the support again and got another drive and continue with the same thing.   What did John do wrong this time? Hmmm lets say nothing because there is a possibility of multiple drive failure in a week difference. No big deal.   One day some of the users were experiencing some disk issues and John thought it may be because the server is up and running from last several months. So he rebooted the server and during the POST he saw the message “one of the virtual disk is in offline sate. System halted”. Now John calls the support and after some troubleshooting and looking at the controller logs, the tech on the phone says you have a punctured array.   In the above scenario Mr John did almost everything correct except  one little thing. When John realizes that one of the drive in slot 0 is bad he quickly grabs a new one and put it in, without bothering about the state of other disks.  When disk on slot 0 was blinking amber there were some bad logical blocks exists on another disk on slot 1  (Usually in the controller logs...

read more