- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- script to find logic
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2007 02:35 AM
02-01-2007 02:35 AM
script to find logic
Ex: lanscan |grep -v -E "Hardware|Path" |awk '{print $1}' shows lan card Hardware paths.
then putting into a loop will get all corresponding CPU ID's.
for i in `lanscan |grep -v -E "Hardware|Path" |awk '{print $1}'`
do
intctl -H $i | grep -v -E "cpu|ID" |awk '{print $5}'
done
My Question: Want to make sure they are not using same CPU ID's. If it is using then change to different CPU ID for that path using following command.
intctl -M -H
The above command performs to transfer interrupts from one CPU to another one for the path specified.
Thanks in Advance.
- Tags:
- lanscan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2007 03:18 AM
02-01-2007 03:18 AM
Re: script to find logic
(UNTESTED. Need to check for some max-cpu!)
Hein.
use strict;
use warnings;
my ($cpu, $hw, @hw_to_reassign, %cpu_assigned_to, %hw_assigned_to);
foreach (`lanscan`) {
next if /Hardware|Path/;
chomp;
$hw = $_;
foreach (`intctl -H $hw`){
next unless /$hw/;
$cpu = (split)[4];
if (exists $hw_assigned_to{$cpu}) {
push @hw_to_reassign, $hw;
} else {
$hw_assigned_to{$cpu} = $hw;
}
$cpu_assigned_to{$hw} = $cpu; # optional
}
$cpu = 0;
while ($hw = shift @hw_to_reassign) {
$cpu++ while ($hw_assigned_to{$cpu});
$cpu_assigned_to{$hw} = $cpu; # optional
$hw_assigned_to{$cpu} = $hw;
print "$hw cpu $cpu_assigned_to{$hw} re-assigned to $cpu\n";
system ("intctl -M -H $hw -I 1 -c $cpu");
}
}
print "\n";
foreach $cpu (sort keys %hw_assigned_to) {
print "cpu $cpu --> $hw_assigned_to{$cpu}\n";
}
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2007 03:22 AM
02-01-2007 03:22 AM
Re: script to find logic
Forgot to say this would be a PERL script.. if not obvious.
Also, I see I have my loop nesting wrong
The first section is a double nesting of lanscan and intctl building a list of device which have a duplicate cpu.
Then comes a section to deal with those (after $cpu=0).
Finally comes an overview report (after print \n)
Should be:
use strict;
use warnings;
my ($cpu, $hw, @hw_to_reassign, %cpu_assigned_to, %hw_assigned_to);
foreach (`lanscan`) {
next if /Hardware|Path/;
chomp;
$hw = $_;
foreach (`intctl -H $hw`){
next unless /$hw/;
$cpu = (split)[4];
if (exists $hw_assigned_to{$cpu}) {
push @hw_to_reassign, $hw;
} else {
$hw_assigned_to{$cpu} = $hw;
}
$cpu_assigned_to{$hw} = $cpu; # optional
}
}
$cpu = 0;
while ($hw = shift @hw_to_reassign) {
$cpu++ while ($hw_assigned_to{$cpu});
$cpu_assigned_to{$hw} = $cpu; # optional
$hw_assigned_to{$cpu} = $hw;
print "$hw cpu $cpu_assigned_to{$hw} re-assigned to $cpu\n";
system ("intctl -M -H $hw -I 1 -c $cpu");
}
print "\n";
foreach $cpu (sort keys %hw_assigned_to) {
print "cpu $cpu --> $hw_assigned_to{$cpu}\n";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2007 04:33 AM
02-01-2007 04:33 AM
Re: script to find logic
thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2007 07:56 AM
02-01-2007 07:56 AM
Re: script to find logic
Is there a reason why you don't just move the interrupts around once manually and then use:
intctl -s /etc/my_interrupt_cfg
Then every time you reboot you can just call
intctl -r /etc/my_interrupt_cfg
Which will restore the config to how you had it before.
Of course if you have iCAP CPUs or vPars... the number of CPUs will change and this won't work.
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2007 12:37 PM
02-01-2007 12:37 PM
Re: script to find logic
I guess that a reason why I keep reading and replying to the forums always something new to learn. This time the -r / -s option for intctl
I had an opportunity to test my script on my 2620.
It almost worked. Only serious problem:
chomp;
$hw = $_;
Should be
$hw = (split)[0];
I looked at the intctl output some more, and tehre is no reason to first do the lanscan + individual intctl's. You can call it once adn licp up the ' lan ' lines remembering the hardware addresses and cpu's as you go.
Minor re-hash:
"move_network_interrupts.pl" 39 lines, 932 characters
use strict;
use warnings;
my ($cpu, $hw, @hw_to_reassign, %cpu_assigned_to, %hw_assigned_to);
#
# Loop through hardware looking for lan entries as:
# 0/1/2/1 lan iether N/A 1
#
foreach (`intctl`){
if (/(\S+)\s+lan\s+\S+\s+\S+\s+(\d+)/) {
$hw = $1;
$cpu = $2;
print "... $hw $cpu\n";
if ($hw_assigned_to{$cpu}) {
push @hw_to_reassign, $hw;
} else {
$hw_assigned_to{$cpu} = $hw;
}
$cpu_assigned_to{$hw} = $cpu;
}
}
#
# Re-assign duplica
#
$cpu = 0;
while ($hw = shift @hw_to_reassign) {
$cpu++ while ($hw_assigned_to{$cpu});
print "reassining $hw cpu $cpu_assigned_to{$hw} to $cpu\n";
system ("intctl -M -H $hw -I 1 -c $cpu");
$cpu_assigned_to{$hw} = $cpu;
$hw_assigned_to{$cpu} = $hw;
}
#
# Final report
#
print "\n";
foreach $cpu (sort keys %hw_assigned_to) {
print "cpu $cpu --> $hw_assigned_to{$cpu}\n";
}
Sample run:
>perl move_network_interrupts.pl
... 0/1/2/0 0
... 0/1/2/1 0
reassining 0/1/2/1 cpu 0 to 1
intctl: Moved the interrupt: 1, of card 0/1/2/1, driver iether, from CPU:0 to CPU:1
cpu 0 --> 0/1/2/0
cpu 1 --> 0/1/2/1
Enjoy,
Hein.