Skip to content

Commit

Permalink
* Updated the kickstarts and syslinux files to support NVMe-based das…
Browse files Browse the repository at this point in the history
…hboards (needs testing).

* Updating 'anvil-safe-start' to use '@reboot' in crontab instead of running every minute (not finished).
* Updated Striker.pm->scan_anvil() to first check if the nodes are off before trying to scan the nodes. This should speed up responsiveness when one or both nodes are off.

Signed-off-by: Digimer <[email protected]>
  • Loading branch information
Digimer committed Dec 20, 2016
1 parent b3ddc8b commit ac6069f
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 47 deletions.
60 changes: 40 additions & 20 deletions AN/Tools/Striker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ sub mark_node_as_clean_off
name1 => "stop_reason", value1 => $stop_reason,
}, file => $THIS_FILE, line => __LINE__});

### TODO: Is this where shutdown is failing?
my $query = "
UPDATE
hosts
Expand Down Expand Up @@ -807,10 +808,47 @@ sub scan_anvil

# Show the 'scanning in progress' table.
print $an->Web->template({file => "common.html", template => "scanning-message", replace => {
anvil_message => $an->String->get({key => "message_0272", variables => { anvil => $an->data->{sys}{anvil}{name} }}),
anvil_message => $an->String->get({key => "message_0272", variables => { anvil => $an->data->{sys}{anvil}{name} }}),
}});

# Start your engines!
# Check the power state of both nodes. If either report 'on', we'll do a full scan.
my $node1_state = $an->ScanCore->target_power({target => $an->data->{sys}{anvil}{node1}{uuid}});
my $node2_state = $an->ScanCore->target_power({target => $an->data->{sys}{anvil}{node2}{uuid}});
$an->Log->entry({log_level => 2, message_key => "an_variables_0002", message_variables => {
name1 => "node1_state", value1 => $node1_state,
name2 => "node2_state", value2 => $node2_state,
}, file => $THIS_FILE, line => __LINE__});
if (($node1_state eq "off") && ($node2_state eq "off"))
{
# Neither node is up. If I can power them on, then I will show the node section to enable
# power up.
if (($node1_state eq "unknown") or ($node2_state eq "unknown"))
{
print $an->Web->template({file => "main-page.html", template => "no-access-message", replace => {
anvil => $an->data->{sys}{anvil}{name},
message => "#!string!message_0029!#",
}});
}
if ($node1_state eq "off")
{
my $node1_name = $an->data->{sys}{anvil}{node1}{name};
$an->data->{node}{$node1_name}{enable_poweron} = 1;
$an->Log->entry({log_level => 2, message_key => "an_variables_0001", message_variables => {
name1 => "node::${node1_name}::enable_poweron", value1 => $an->data->{node}{$node1_name}{enable_poweron},
}, file => $THIS_FILE, line => __LINE__});
}
if ($node2_state eq "off")
{
my $node2_name = $an->data->{sys}{anvil}{node2}{name};
$an->data->{node}{$node2_name}{enable_poweron} = 1;
$an->Log->entry({log_level => 2, message_key => "an_variables_0001", message_variables => {
name1 => "node::${node2_name}::enable_poweron", value1 => $an->data->{node}{$node2_name}{enable_poweron},
}, file => $THIS_FILE, line => __LINE__});
}
return(1);
}

# Still here? Start your engines!
$an->Log->entry({log_level => 2, message_key => "an_variables_0002", message_variables => {
name1 => "sys::anvil::node1::uuid", value1 => $an->data->{sys}{anvil}{node1}{uuid},
name2 => "sys::anvil::node2::uuid", value2 => $an->data->{sys}{anvil}{node2}{uuid},
Expand Down Expand Up @@ -842,24 +880,6 @@ sub scan_anvil
$an->Striker->scan_servers();
$an->Striker->_post_scan_calculations();
}
else
{
# Neither node is up. If I can power them on, then I will show the node section to enable
# power up.
my $node1_power = $an->data->{sys}{anvil}{node1}{power};
my $node2_power = $an->data->{sys}{anvil}{node2}{power};
$an->Log->entry({log_level => 2, message_key => "an_variables_0002", message_variables => {
name1 => "node1_power", value1 => $node1_power,
name2 => "node2_power", value2 => $node2_power,
}, file => $THIS_FILE, line => __LINE__});
if (($node1_power eq "unknown") or ($node2_power eq "unknown"))
{
print $an->Web->template({file => "main-page.html", template => "no-access-message", replace => {
anvil => $an->data->{sys}{anvil}{name},
message => "#!string!message_0029!#",
}});
}
}

return(0);
}
Expand Down
46 changes: 36 additions & 10 deletions ISO/CentOS/6/Anvil/syslinux/syslinux.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,54 @@ LABEL next
MENU DEFAULT
localboot -1

LABEL usb-new-striker01
MENU LABEL ^1) New Striker Dashboard 01 - CentOS 6 - USB - Deletes All Existing Data!
LABEL usb-new-striker01-sdb
MENU LABEL ^1) New Striker Dashboard 01 - CentOS 6 - USB on sdb - Deletes All Existing Data!
TEXT HELP

Installs a new Striker Dashboard 01 using CentOS 6. Will create a traditional
/boot + MBR install for systems with traditional BIOSes. Partition will
be 0.5 GiB /boot, 4 GiB <swap>, remainder for /.
Installs a new Striker Dashboard 01 using CentOS 6 where the USB drive
is /dev/sdb (traditional systems). Will create a traditional /boot + MBR
install for systems with traditional BIOSes. Partition will be 0.5 GiB
/boot, 4 GiB <swap>, remainder for /.
ENDTEXT
KERNEL vmlinuz
APPEND initrd=initrd.img repo=hd:sdb1:/ ks=hd:sdb1:ks/usb-new-striker01.ks

LABEL usb-new-striker02
MENU LABEL ^2) New Striker Dashboard 02 - CentOS 6 - USB - Deletes All Existing Data!
LABEL usb-new-striker02-sdb
MENU LABEL ^2) New Striker Dashboard 02 - CentOS 6 - USB on sdb - Deletes All Existing Data!
TEXT HELP

Installs a new Striker Dashboard 02 using CentOS 6. Will create a traditional
/boot + MBR install for systems with traditional BIOSes. Partition will
be 0.5 GiB /boot, 4 GiB <swap>, remainder for /.
Installs a new Striker Dashboard 02 using CentOS 6 where the USB drive
is /dev/sdb (traditional systems). Will create a traditional /boot + MBR
install for systems with traditional BIOSes. Partition will be 0.5 GiB
/boot, 4 GiB <swap>, remainder for /.
ENDTEXT
KERNEL vmlinuz
APPEND initrd=initrd.img repo=hd:sdb1:/ ks=hd:sdb1:ks/usb-new-striker02.ks

LABEL usb-new-striker01-sda
MENU LABEL ^3) New Striker Dashboard 01 - CentOS 6 - USB on sda - Deletes All Existing Data!
TEXT HELP

Installs a new Striker Dashboard 01 using CentOS 6 where the USB drive
is /dev/sda (systems using NVMe drives, etc). Will create a traditional
/boot + MBR install for systems with traditional BIOSes. Partition will
be 0.5 GiB /boot, 4 GiB <swap>, remainder for /.
ENDTEXT
KERNEL vmlinuz
APPEND initrd=initrd.img repo=hd:sda1:/ ks=hd:sda1:ks/usb-new-striker01.ks

LABEL usb-new-striker02-sda
MENU LABEL ^4) New Striker Dashboard 02 - CentOS 6 - USB on sda - Deletes All Existing Data!
TEXT HELP

Installs a new Striker Dashboard 02 using CentOS 6 where the USB drive
is /dev/sda (systems using NVMe drives, etc). Will create a traditional
/boot + MBR install for systems with traditional BIOSes. Partition will
be 0.5 GiB /boot, 4 GiB <swap>, remainder for /.
ENDTEXT
KERNEL vmlinuz
APPEND initrd=initrd.img repo=hd:sda1:/ ks=hd:sda1:ks/usb-new-striker02.ks

label rescue
MENU LABEL ^B) Rescue installed system
MENU HELP
Expand Down
46 changes: 36 additions & 10 deletions ISO/RHEL/6/Anvil/syslinux/syslinux.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,54 @@ LABEL next
MENU DEFAULT
localboot -1

LABEL usb-new-striker01
MENU LABEL ^1) New Striker Dashboard 01 - RHEL 6 - USB - Deletes All Existing Data!
LABEL usb-new-striker01-sdb
MENU LABEL ^1) New Striker Dashboard 01 - RHEL 6 - USB on sdb - Deletes All Existing Data!
TEXT HELP

Installs a new Striker Dashboard 01 using RHEL 6. Will create a traditional
/boot + MBR install for systems with traditional BIOSes. Partition will
be 0.5 GiB /boot, 4 GiB <swap>, remainder for /.
Installs a new Striker Dashboard 01 using RHEL 6 where the USB drive
is /dev/sdb (traditional systems). Will create a traditional /boot + MBR
install for systems with traditional BIOSes. Partition will be 0.5 GiB
/boot, 4 GiB <swap>, remainder for /.
ENDTEXT
KERNEL vmlinuz
APPEND initrd=initrd.img repo=hd:sdb1:/ ks=hd:sdb1:ks/usb-new-striker01.ks

LABEL usb-new-striker02
MENU LABEL ^2) New Striker Dashboard 02 - RHEL 6 - USB - Deletes All Existing Data!
LABEL usb-new-striker02-sdb
MENU LABEL ^2) New Striker Dashboard 02 - RHEL 6 - USB on sdb - Deletes All Existing Data!
TEXT HELP

Installs a new Striker Dashboard 02 using RHEL 6. Will create a traditional
/boot + MBR install for systems with traditional BIOSes. Partition will
be 0.5 GiB /boot, 4 GiB <swap>, remainder for /.
Installs a new Striker Dashboard 02 using RHEL 6 where the USB drive
is /dev/sdb (traditional systems). Will create a traditional /boot + MBR
install for systems with traditional BIOSes. Partition will be 0.5 GiB
/boot, 4 GiB <swap>, remainder for /.
ENDTEXT
KERNEL vmlinuz
APPEND initrd=initrd.img repo=hd:sdb1:/ ks=hd:sdb1:ks/usb-new-striker02.ks

LABEL usb-new-striker01-sda
MENU LABEL ^3) New Striker Dashboard 01 - RHEL 6 - USB on sda - Deletes All Existing Data!
TEXT HELP

Installs a new Striker Dashboard 01 using RHEL 6 where the USB drive
is /dev/sda (systems using NVMe drives, etc). Will create a traditional
/boot + MBR install for systems with traditional BIOSes. Partition will
be 0.5 GiB /boot, 4 GiB <swap>, remainder for /.
ENDTEXT
KERNEL vmlinuz
APPEND initrd=initrd.img repo=hd:sda1:/ ks=hd:sda1:ks/usb-new-striker01.ks

LABEL usb-new-striker02-sda
MENU LABEL ^4) New Striker Dashboard 02 - RHEL 6 - USB on sda - Deletes All Existing Data!
TEXT HELP

Installs a new Striker Dashboard 02 using RHEL 6 where the USB drive
is /dev/sda (systems using NVMe drives, etc). Will create a traditional
/boot + MBR install for systems with traditional BIOSes. Partition will
be 0.5 GiB /boot, 4 GiB <swap>, remainder for /.
ENDTEXT
KERNEL vmlinuz
APPEND initrd=initrd.img repo=hd:sda1:/ ks=hd:sda1:ks/usb-new-striker02.ks

label rescue
MENU LABEL ^B) Rescue installed system
MENU HELP
Expand Down
22 changes: 19 additions & 3 deletions tools/anvil-generate-iso
Original file line number Diff line number Diff line change
Expand Up @@ -721,10 +721,15 @@ then
DRIVE=\"vda\"
fi
### Nodes with NVMe drives will use '/dev/nvme0n1'
if grep -q nvme0n1 /proc/partitions; then
DRIVE=\"nvme0n1\"
fi
# Zero-out the first 100GB to help avoid running into problems when a node that
# was previously in a cluster gets rebuilt. Only run on real hardware, tends to
# crash VMs.
if grep -q sda /proc/partitions;
if ! grep -q vda /proc/partitions;
then
echo \"Please be patient! Zero'ing out the first 100 GiB of /dev/\${DRIVE}...\"
dd if=/dev/zero of=/dev/\${DRIVE} bs=4M count=25000
Expand Down Expand Up @@ -806,7 +811,12 @@ dd if=/dev/cdrom of=/mnt/sysimage/var/www/html/$os_dir/x86_64/iso/$conf->{path}{
# USB target
$ks_body .= "
# Make sure our USB source partition is mounted.
mount /dev/sdb1 /mnt/source;
if grep -q nvme0n1 /proc/partitions;
then
mount /dev/sda1 /mnt/source;
else
mount /dev/sdb1 /mnt/source;
fi
# Copy the install ISO into place
echo 'Copying the install iso image. Be patient'
Expand Down Expand Up @@ -1102,7 +1112,7 @@ fi
if ($target eq "usb")
{
$ks_body .= "
### The USB drives comes up as 'sdb', so the Eee's HDD is /dev/sdc
### The USB drives come up as 'sdb', so the Eee's HDD is /dev/sdc
# /dev/sdc ASUS EeeBox machine
if grep -q sdc /proc/partitions; then
DRIVE=\"sdc\"
Expand All @@ -1120,6 +1130,12 @@ fi
}

$ks_body .= "
### Dashboards with NVMe drives will use '/dev/nvme0n1'
if grep -q nvme0n1 /proc/partitions; then
DRIVE=\"nvme0n1\"
fi
# Now write the partition script
cat >> /tmp/part-include <<END
zerombr
Expand Down
61 changes: 57 additions & 4 deletions tools/anvil-safe-start
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,17 @@ if ($an->data->{switches}{start})
if ($an->data->{switches}{enable})
{
# Create the /etc/rc3.d link.
create_rc3d_symlink($an);
add_to_root_crontab($an);
#create_rc3d_symlink($an);
$an->nice_exit({exit_code => 0});
}
if ($an->data->{switches}{disable})
{
# Create the /etc/rc3.d link.
remove_rc3d_symlink($an);
# Remove the crontab entry
remove_from_root_crontab($an);

# Remove the /etc/rc3.d link.
#remove_rc3d_symlink($an);
$an->nice_exit({exit_code => 0});
}
if (($an->data->{switches}{'state'}) or ($an->data->{switches}{status}))
Expand Down Expand Up @@ -2946,6 +2949,55 @@ sub report_state
return(0);
}

# Remove the crontab entry.
sub remove_from_root_crontab
{
my ($an) = @_;
$an->Log->entry({log_level => 3, title_key => "tools_log_0001", title_variables => { function => "remove_from_root_crontab" }, message_key => "tools_log_0002", file => $THIS_FILE, line => __LINE__});

### TODO
my $rewrite = 0;
my $body = "";
my $shell_call = $an->data->{path}{root_crontab};
$an->Log->entry({log_level => 2, message_key => "an_variables_0001", message_variables => {
name1 => "shell_call", value1 => $shell_call,
}, file => $THIS_FILE, line => __LINE__});
open (my $file_handle, "<$shell_call") or $an->Alert->error({title_key => "an_0003", message_key => "error_title_0016", message_variables => { shell_call => $shell_call, error => $! }, code => 254, file => $THIS_FILE, line => __LINE__});
while(<$file_handle>)
{
chomp;
my $line = $_;
$an->Log->entry({log_level => 2, message_key => "an_variables_0001", message_variables => {
name1 => "line", value1 => $line,
}, file => $THIS_FILE, line => __LINE__});

if ($line =~ /^$an->data->{path}{'anvil-safe-start'}$/)
{
my $space1 = $1;
my $space2 = $2;
my $value = $3;
$an->Log->entry({log_level => 3, message_key => "an_variables_0002", message_variables => {
name1 => "value", value1 => $value,
name2 => "set", value2 => $set,
}, file => $THIS_FILE, line => __LINE__});
if ($value ne $set)
{
$changed = 1;
$line = "tools::anvil-safe-start::enabled".$space1."=".$space2."$set";
$an->Log->entry({log_level => 3, message_key => "an_variables_0002", message_variables => {
name1 => "changed", value1 => $changed,
name2 => "line", value2 => $line,
}, file => $THIS_FILE, line => __LINE__});
}
}

$new_config .= "$line\n";
}
close $file_handle;

return(0);
}

# This adds anvil-safe-start to the root user's cron table if needed.
sub add_to_root_crontab
{
Expand All @@ -2959,8 +3011,9 @@ then
".$an->data->{path}{echo}." 'in crontab';
else
".$an->data->{path}{echo}." 'adding the crontab';
".$an->data->{path}{echo}." '*/1 * * * * ".$an->data->{path}{'anvil-safe-start'}."' >> ".$an->data->{path}{root_crontab}."
".$an->data->{path}{echo}." '\@reboot ".$an->data->{path}{'anvil-safe-start'}."' >> ".$an->data->{path}{root_crontab}."
fi";
# ".$an->data->{path}{echo}." '*/1 * * * * ".$an->data->{path}{'anvil-safe-start'}."' >> ".$an->data->{path}{root_crontab}."
$an->Log->entry({log_level => 2, message_key => "an_variables_0001", message_variables => {
name1 => "shell_call", value1 => $shell_call,
}, file => $THIS_FILE, line => __LINE__});
Expand Down

0 comments on commit ac6069f

Please sign in to comment.