StarlingX open source release updates

Signed-off-by: Dean Troyer <dtroyer@gmail.com>
This commit is contained in:
Dean Troyer 2018-05-30 16:15:37 -07:00
parent 7f0544bc4b
commit 18922761a6
417 changed files with 131695 additions and 0 deletions

8
CONTRIBUTORS.wrs Normal file
View File

@ -0,0 +1,8 @@
The following contributors from Wind River have developed the seed code in this
repository. We look forward to community collaboration and contributions for
additional features, enhancements and refactoring.
Contributors:
=============
Eric Macdonald <Eric.MacDonald@windriver.com>
Don Penney <Don.Penney@windriver.com>

202
LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

5
README.rst Normal file
View File

@ -0,0 +1,5 @@
=========
stx-metal
=========
StarlingX Bare Metal Management

297
bsp-files/centos-ks-gen.pl Executable file
View File

@ -0,0 +1,297 @@
#!/usr/bin/perl
#
# Copyright (c) 2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
use strict;
use Getopt::Long;
use POSIX qw(strftime);
# Defines the current list of YOW boot servers
my %boot_servers = ("yow-tuxlab", "128.224.150.9",
"yow-tuxlab2", "128.224.151.254",
"yow", "128.224.150.9"); # obsolete; kept for backwards compatibility
my $PLATFORM_RELEASE;
my $files_dir;
my $output_dir = 'generated';
my $pxeboot_output_dir = 'pxeboot';
my $extra_output_dir = 'extra_cfgs';
GetOptions("release=s" => \$PLATFORM_RELEASE,
"basedir=s" => \$files_dir);
die "Please specify release with --release" if (!$PLATFORM_RELEASE);
if (!$files_dir)
{
$files_dir = '.';
}
my $BOOT_SERVER = "none";
my $template_dir = "$files_dir/kickstarts";
system("mkdir -p ${output_dir}");
# Write USB image files
write_config_file("controller",
"${output_dir}/controller_ks.cfg", "filter_out_from_controller",
"pre_common_head.cfg",
"pre_pkglist.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_controller.cfg",
"post_platform_conf_controller.cfg",
"post_common.cfg",
"post_kernel_controller.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_usb_controller.cfg");
write_config_file("controller-compute",
"${output_dir}/smallsystem_ks.cfg", "filter_out_from_smallsystem",
"pre_common_head.cfg",
"pre_pkglist.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_aio.cfg",
"post_platform_conf_aio.cfg",
"post_common.cfg",
"post_kernel_aio_and_compute.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_system_aio.cfg",
"post_usb_controller.cfg");
write_config_file("controller-compute-lowlatency",
"${output_dir}/smallsystem_lowlatency_ks.cfg", "filter_out_from_smallsystem_lowlatency",
"pre_common_head.cfg",
"pre_pkglist_lowlatency.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_aio.cfg",
"post_platform_conf_aio_lowlatency.cfg",
"post_common.cfg",
"post_kernel_aio_and_compute.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_system_aio.cfg",
"post_usb_controller.cfg");
system("mkdir -p ${pxeboot_output_dir}");
# Write PXE boot files
write_config_file("controller",
"${pxeboot_output_dir}/pxeboot_controller.cfg", "filter_out_from_controller",
"pre_common_head.cfg",
"pre_pkglist.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_controller.cfg",
"post_platform_conf_controller.cfg",
"post_common.cfg",
"post_kernel_controller.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_pxeboot_controller.cfg");
write_config_file("controller-compute",
"${pxeboot_output_dir}/pxeboot_smallsystem.cfg", "filter_out_from_smallsystem",
"pre_common_head.cfg",
"pre_pkglist.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_aio.cfg",
"post_platform_conf_aio.cfg",
"post_common.cfg",
"post_kernel_aio_and_compute.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_system_aio.cfg",
"post_pxeboot_controller.cfg");
write_config_file("controller-compute-lowlatency",
"${pxeboot_output_dir}/pxeboot_smallsystem_lowlatency.cfg", "filter_out_from_smallsystem_lowlatency",
"pre_common_head.cfg",
"pre_pkglist_lowlatency.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_aio.cfg",
"post_platform_conf_aio_lowlatency.cfg",
"post_common.cfg",
"post_kernel_aio_and_compute.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_system_aio.cfg",
"post_pxeboot_controller.cfg");
# Write same net files
write_config_file("controller",
"${output_dir}/net_controller_ks.cfg", "filter_out_from_controller",
"pre_common_head.cfg",
"pre_pkglist.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_controller.cfg",
"post_platform_conf_controller.cfg",
"post_common.cfg",
"post_kernel_controller.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_net_controller.cfg",
"post_net_common.cfg");
write_config_file("controller-compute",
"${output_dir}/net_smallsystem_ks.cfg", "filter_out_from_smallsystem",
"pre_common_head.cfg",
"pre_pkglist.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_aio.cfg",
"post_platform_conf_aio.cfg",
"post_common.cfg",
"post_kernel_aio_and_compute.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_system_aio.cfg",
"post_net_controller.cfg",
"post_net_common.cfg");
write_config_file("controller-compute-lowlatency",
"${output_dir}/net_smallsystem_lowlatency_ks.cfg", "filter_out_from_smallsystem_lowlatency",
"pre_common_head.cfg",
"pre_pkglist_lowlatency.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_aio.cfg",
"post_platform_conf_aio_lowlatency.cfg",
"post_common.cfg",
"post_kernel_aio_and_compute.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_system_aio.cfg",
"post_net_controller.cfg",
"post_net_common.cfg");
write_config_file("compute",
"${output_dir}/net_compute_ks.cfg", "filter_out_from_compute",
"pre_common_head.cfg",
"pre_pkglist.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_compute.cfg",
"post_platform_conf_compute.cfg",
"post_common.cfg",
"post_kernel_aio_and_compute.cfg",
"post_lvm_no_pv_on_rootfs.cfg",
"post_net_common.cfg");
write_config_file("compute-lowlatency",
"${output_dir}/net_compute_lowlatency_ks.cfg", "filter_out_from_compute_lowlatency",
"pre_common_head.cfg",
"pre_pkglist_lowlatency.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_compute.cfg",
"post_platform_conf_compute_lowlatency.cfg",
"post_common.cfg",
"post_kernel_aio_and_compute.cfg",
"post_lvm_no_pv_on_rootfs.cfg",
"post_net_common.cfg");
write_config_file("storage",
"${output_dir}/net_storage_ks.cfg", "filter_out_from_storage",
"pre_common_head.cfg",
"pre_pkglist.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_storage.cfg",
"post_platform_conf_storage.cfg",
"post_common.cfg",
"post_kernel_storage.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_net_common.cfg");
system("mkdir -p ${extra_output_dir}");
# write Ottawa Lab files
my $server;
foreach $server (keys %boot_servers)
{
$BOOT_SERVER = $boot_servers{$server};
write_config_file("controller",
"${extra_output_dir}/${server}_controller.cfg", "filter_out_from_controller",
"pre_common_head.cfg",
"pre_pkglist.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_controller.cfg",
"post_platform_conf_controller.cfg",
"post_common.cfg",
"post_kernel_controller.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_yow_controller.cfg");
write_config_file("controller-compute",
"${extra_output_dir}/${server}_smallsystem.cfg", "filter_out_from_smallsystem",
"pre_common_head.cfg",
"pre_pkglist.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_aio.cfg",
"post_platform_conf_aio.cfg",
"post_common.cfg",
"post_kernel_aio_and_compute.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_system_aio.cfg",
"post_yow_controller.cfg");
write_config_file("controller-compute-lowlatency",
"${extra_output_dir}/${server}_smallsystem_lowlatency.cfg", "filter_out_from_smallsystem_lowlatency",
"pre_common_head.cfg",
"pre_pkglist_lowlatency.cfg",
"pre_disk_setup_common.cfg",
"pre_disk_aio.cfg",
"post_platform_conf_aio_lowlatency.cfg",
"post_common.cfg",
"post_kernel_aio_and_compute.cfg",
"post_lvm_pv_on_rootfs.cfg",
"post_system_aio.cfg",
"post_yow_controller.cfg");
}
exit 0;
#------------------------#
sub write_config_file {
my ($personality, $ksout, $filter_file, @templates) = @_;
my %filter;
if ($filter_file ne "") {
if (!(open(FILTER, "$files_dir/$filter_file"))) {
die "Could not open template $files_dir/$filter_file";
}
while (<FILTER>) {
chop();
next if ($_ =~ /^#/);
$filter{$_} = 1;
}
close(FILTER);
}
print "Writing: $ksout\n";
open(OUT, ">$ksout") || die "Could not write $ksout";
my $year = strftime "%Y", localtime;
print OUT "#\n";
print OUT "# Copyright (c) $year Wind River Systems, Inc.\n";
print OUT "# SPDX-License-Identifier: Apache-2.0\n";
print OUT "#\n";
print OUT "\n";
# Add functions header
foreach my $block ("\%pre", "\%post") {
if (!(open(FUNCTIONS, "$template_dir/functions.sh"))) {
die "Could not open functions.sh";
}
print OUT "$block\n";
while (<FUNCTIONS>) {
s/xxxPLATFORM_RELEASExxx/$PLATFORM_RELEASE/g;
s/xxxBOOT_SERVERxxx/$BOOT_SERVER/g;
s/xxxYEARxxx/$year/g;
print OUT $_;
}
print OUT "\%end\n\n";
close FUNCTIONS;
}
my $template;
foreach $template (@templates) {
if (!(open(TEMPLATE_IN, "$template_dir/$template"))) {
die "Could not open template $template_dir/$template";
}
print OUT "\n# Template from: $template\n";
while (<TEMPLATE_IN>) {
$_ =~ s/\n$//;
s/xxxPLATFORM_RELEASExxx/$PLATFORM_RELEASE/g;
s/xxxBOOT_SERVERxxx/$BOOT_SERVER/g;
s/xxxYEARxxx/$year/g;
s/xxxPACKAGE_LISTxxx/\@platform-$personality\n\@updates-$personality/;
print OUT "$_\n";
}
close(TEMPLATE_IN);
}
close(OUT);
}

View File

@ -0,0 +1,188 @@
display splash.cfg
timeout 0
F1 help.txt
F2 devices.txt
F3 splash.cfg
serial 0 115200
# Pull in the menu User Interface
ui vesamenu.c32
menu title Select kernel options and boot kernel
menu tabmsg Press [Tab] to edit, [Return] to select, [ESC] to return to previous menu
# Dark grey
menu background #ff555555
# ----------------- NOTE -----------------
# If you are updating label numbers, make sure that controllerconfig/clone.py
# is in sync with your changes (only serial console entries).
# STANDARD_STANDARD = '0'
# STANDARD_EXTENDED = 'S0'
# AIO_STANDARD = '2'
# AIO_EXTENDED = 'S2'
# AIO_LL_STANDARD = '4'
# AIO_LL_EXTENDED = 'S4'
# ----------------------------------------
# Standard Controller menu
menu begin
menu title Standard Controller Configuration
# Serial Console submenu
menu begin
menu title Serial Console
label 0
menu label STANDARD Security Boot Profile
text help
Standard Controller, console=ttyS0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=standard
label S0
menu label EXTENDED Security Boot Profile
text help
Standard Controller, console=ttyS0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=extended
menu end
# Graphical Console submenu
menu begin
menu title Graphical Console
label 1
menu label STANDARD Security Boot Profile
text help
Standard Controller, console=tty0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=standard
label S1
menu label EXTENDED Security Boot Profile
text help
Standard Controller, console=tty0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=extended
menu end
menu end
menu SEPARATOR
# AIO Controller menu
menu begin
menu title All-in-one Controller Configuration
# Serial Console submenu
menu begin
menu title Serial Console
label 2
menu label STANDARD Security Boot Profile
text help
All-in-one Controller, console=ttyS0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=standard
label S2
menu label EXTENDED Security Boot Profile
text help
All-in-one Controller, console=ttyS0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
initrd initrd.img
# Security profile option
append rootwait console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=extended
menu end
# Graphical Console submenu
menu begin
menu title Graphical Console
label 3
menu label STANDARD Security Boot Profile
text help
All-in-one Controller, console=tty0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=standard
label S3
menu label EXTENDED Security Boot Profile
text help
All-in-one Controller, console=tty0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=extended
menu end
menu end
menu SEPARATOR
# AIO (Low Latency) Controller menu
menu begin
menu title All-in-one (lowlatency) Controller Configuration
# Serial Console submenu
menu begin
menu title Serial Console
label 4
menu label STANDARD Security Boot Profile
text help
All-in-one (lowlatency) Controller, console=ttyS0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_lowlatency_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=standard
label S4
menu label EXTENDED Security Boot Profile
text help
All-in-one (lowlatency) Controller, console=ttyS0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_lowlatency_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=extended
menu end
# Graphical Console submenu
menu begin
menu title Graphical Console
label 5
menu label STANDARD Security Boot Profile
text help
All-in-one (lowlatency) Controller, console=tty0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_lowlatency_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=standard
label S5
menu label EXTENDED Security Boot Profile
text help
All-in-one (lowlatency) Controller, console=tty0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
initrd initrd.img
append rootwait console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_lowlatency_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 inst.gpt security_profile=extended
menu end
menu end

View File

@ -0,0 +1,263 @@
ceilometer-api
ceilometer-alarm-evaluator
ceilometer-alarm-notifier
ceilometer-collector
ceilometer-tests
ceph-manager
cgcs-dpdk-rt
cgcs-dpdk-rt-dev
cgcs-dpdk-rt-staticdev
cgcs-dpdk-rt-apps
cgts-client
cgts-client-bash-completion
cgcs-patch-controller
cgts-mtce-control
cgts-mtce-storage
cgts-mtce-common-guestAgent
cgtssys
cinder
cinder-api
cinder-scheduler
cinder-tests
cinder-volume
computeconfig-subfunction
configvalidator
controllerconfig
corosync
createrepo
d2to1
distributedcloud-dcmanager
distributedcloud-client-dcmanagerclient
distributedcloud-dcorch
drbd-tools
fm-doc
glance
glance-api
glance-registry
glance-tests
horizon
horizon-standalone
horizon-tests
heat-api-cfn
heat-api
heat-cfn
heat-common
heat-contrib-nova-flavor
heat-engine
heat-templates
heat-tests
io-monitor
isomd5sum
kernel-module-openvswitch
keystone
keystone-tests
ldapscripts
libconfig-general-perl
libssh2
lighttpd-module-access
lighttpd-module-accesslog
lighttpd-module-dirlisting
lighttpd-module-indexfile
lighttpd-module-proxy
lighttpd-module-staticfile
lighttpd
nodejs
nova-api
nova-conductor
nova-consoleauth
nova-controller
nova-network
nova-novncproxy
nova-scheduler
nova-spicehtml5proxy
nova-tests
nova-api-proxy
nova-placement-api
novnc
net-snmp
openldap-backend-bdb
openldap-backend-dnssrv
openldap-backend-hdb
openldap-backend-ldap
openldap-backend-mdb
openldap-backend-meta
openldap-backend-monitor
openldap-backend-null
openldap-backend-passwd
openldap-backend-shell
openldap-backends
openldap-dbg
openldap-doc
openldap-overlay-proxycache
openldap-overlay-syncprov
openldap-servers
openldap-slapd
openstack-ras
pacemaker
pacemaker-cli
pacemaker-cluster-libs
pacemaker-libs
patch-alarm
patching-controller
pbr
pecan
postgresql-client
postgresql-contrib
postgresql-timezone
postgresql
pxe-network-installer
python-cephclient
python-cinder
python-django
python-django-appconf
python-django-compressor
python-django-openstack-auth
python-glance
python2-gunicorn
python-heatclient
python-heatclient-bash-completion
python-heat
python-horizon
python-keystone
python-lockfile
python-novnc
python-pam
python-passlib
python-pytz
python-swiftclient
python-wsme
fm-mgr
snmp-ext
sm
sm-api
sm-client
sm-common
sm-db
sm-tools
storageconfig
storage-topology
task-cloud-controller
tgt
nfv-plugins
nfv-vim
vm-topology
remote-clients
lighttpd-fastcgi
lighttpd-mod_geoip
lighttpd-mod_mysql_vhost
openstack-aodh-api
openstack-aodh-commmon
openstack-aodh-compat
openstack-aodh-evaluator
openstack-aodh-expirer
openstack-aodh-listener
openstack-aodh-notifier
openstack-cinder
openstack-cinder-doc
openstack-dashboard
openstack-glance
openstack-glance-doc
openstack-heat-api
openstack-heat-api-cfn
openstack-heat-api-cloudwatch
openstack-heat-common
openstack-heat-engine
openstack-ironic-api
openstack-ironic-common
openstack-ironic-conductor
python-ironic-tests
python-ironic-inspector-client
python-ironic-lib
python2-ironicclient
openstack-keystone
openstack-keystone-doc
openstack-murano-api
openstack-murano-cf-api
openstack-murano-common
openstack-murano-doc
openstack-murano-engine
openstack-murano-ui
openstack-murano-ui-doc
python2-muranoclient
python-muranoclient-doc
openstack-magnum-api
openstack-magnum-common
openstack-magnum-conductor
openstack-magnum-doc
openstack-magnum-ui
python2-magnumclient
python-magnum
python-magnumclient-doc
python-magnumclient-tests
python-magnum-tests
python-magnum-ui-doc
openstack-neutron-common
openstack-neutron-ml2
openstack-nova-api
openstack-nova-cells
openstack-nova-conductor
openstack-nova-console
openstack-nova-doc
openstack-nova-network
openstack-nova-novncproxy
openstack-nova-objectstore
openstack-nova-scheduler
openstack-nova-serialproxy
openstack-nova-spicehtml5proxy
openstack-nova-placement-api
openstack-panko-api
openstack-panko-common
openstack-panko-doc
python-aodh
python-aodhclient
python-ceilometerclient-doc
python-cinder
python-cinderclient-doc
python-glance
python-heatclient
python-keystone
python-novaclient-doc
python-panko
python2-pankoclient
configutilities
drbd-bash-completion
drbd-udev
drbd-utils
drbd-heartbeat
drbd-pacemaker
drbd
kmod-drbd
python-networking-odl
tis-extensions-controller
wrs-heat-templates
python-django-horizon
kernel-rt
kernel-module-igb-uio-rt
kernel-rt-kvm
kmod-e1000e-rt
kmod-i40e-rt
kmod-ixgbe-rt
kmod-tpm-rt
kmod-integrity-rt
mlnx-ofa_kernel-rt-modules
rtctl
rt-setup
qat17-rt
kernel-rt-tools
kernel-rt-tools-libs
NaviCLI-Linux-64-x86-en_US
kmod-drbd-rt
snmp-audittrail
wrs-ssl
tpm2-tools
tss2
tpm2-openssl-engine
python2-networking-bgpvpn
python-networking-bgpvpn-dashboard
python-networking-bgpvpn-heat
python2-neutron-dynamic-routing
python2-ryu
python-ryu-common
platform-kickstarts
python-3parclient
python-lefthandclient

View File

@ -0,0 +1,265 @@
ceilometer-api
ceilometer-alarm-evaluator
ceilometer-alarm-notifier
ceilometer-collector
ceilometer-tests
ceph-manager
cgcs-dpdk
cgcs-dpdk-dev
cgcs-dpdk-staticdev
cgcs-dpdk-apps
cgts-client
cgts-client-bash-completion
cgcs-patch-controller
cgts-mtce-control
cgts-mtce-storage
cgts-mtce-common-guestAgent
cgtssys
cinder
cinder-api
cinder-scheduler
cinder-tests
cinder-volume
computeconfig-subfunction
configvalidator
controllerconfig
corosync
createrepo
d2to1
distributedcloud-dcmanager
distributedcloud-client-dcmanagerclient
distributedcloud-dcorch
drbd-tools
fm-doc
glance
glance-api
glance-registry
glance-tests
horizon
horizon-standalone
horizon-tests
heat-api-cfn
heat-api
heat-cfn
heat-common
heat-contrib-nova-flavor
heat-engine
heat-templates
heat-tests
io-monitor
isomd5sum
kernel-module-openvswitch
keystone
keystone-tests
ldapscripts
libconfig-general-perl
libssh2
lighttpd-module-access
lighttpd-module-accesslog
lighttpd-module-dirlisting
lighttpd-module-indexfile
lighttpd-module-proxy
lighttpd-module-staticfile
lighttpd
nodejs
nova-api
nova-conductor
nova-consoleauth
nova-controller
nova-network
nova-novncproxy
nova-scheduler
nova-spicehtml5proxy
nova-tests
nova-api-proxy
nova-placement-api
novnc
net-snmp
neutron-plugin-ml2
neutron-server
neutron-tests
openldap-backend-bdb
openldap-backend-dnssrv
openldap-backend-hdb
openldap-backend-ldap
openldap-backend-mdb
openldap-backend-meta
openldap-backend-monitor
openldap-backend-null
openldap-backend-passwd
openldap-backend-shell
openldap-backends
openldap-dbg
openldap-doc
openldap-overlay-proxycache
openldap-overlay-syncprov
openldap-servers
openldap-slapd
openstack-ras
pacemaker
pacemaker-cli
pacemaker-cluster-libs
pacemaker-libs
patch-alarm
patching-controller
pbr
pecan
postgresql-client
postgresql-contrib
postgresql-timezone
postgresql
pxe-network-installer
python-cephclient
python-cinder
python-django
python-django-appconf
python-django-compressor
python-django-openstack-auth
python-glance
python2-gunicorn
python-heatclient
python-heatclient-bash-completion
python-heat
python-horizon
python-keystone
python-lockfile
python-novnc
python-pam
python-passlib
python-pytz
python-swiftclient
python-wsme
fm-mgr
snmp-ext
sm
sm-api
sm-client
sm-common
sm-db
sm-tools
storageconfig
storage-topology
task-cloud-controller
tgt
nfv-plugins
nfv-vim
vm-topology
remote-clients
lighttpd-fastcgi
lighttpd-mod_geoip
lighttpd-mod_mysql_vhost
openstack-aodh-api
openstack-aodh-commmon
openstack-aodh-compat
openstack-aodh-evaluator
openstack-aodh-expirer
openstack-aodh-listener
openstack-aodh-notifier
openstack-cinder
openstack-cinder-doc
openstack-dashboard
openstack-glance
openstack-glance-doc
openstack-heat-api
openstack-heat-api-cfn
openstack-heat-api-cloudwatch
openstack-heat-common
openstack-heat-engine
openstack-ironic-api
openstack-ironic-common
openstack-ironic-conductor
python-ironic-tests
python-ironic-inspector-client
python-ironic-lib
python2-ironicclient
openstack-keystone
openstack-keystone-doc
openstack-murano-api
openstack-murano-cf-api
openstack-murano-common
openstack-murano-doc
openstack-murano-engine
openstack-murano-ui
openstack-murano-ui-doc
python2-muranoclient
python-muranoclient-doc
openstack-magnum-api
openstack-magnum-common
openstack-magnum-conductor
openstack-magnum-doc
openstack-magnum-ui
python2-magnumclient
python-magnum
python-magnumclient-doc
python-magnumclient-tests
python-magnum-tests
python-magnum-ui-doc
openstack-neutron-common
openstack-neutron-plugin-ml2
openstack-neutron-server
openstack-nova-api
openstack-nova-cells
openstack-nova-conductor
openstack-nova-console
openstack-nova-doc
openstack-nova-network
openstack-nova-novncproxy
openstack-nova-objectstore
openstack-nova-scheduler
openstack-nova-serialproxy
openstack-nova-spicehtml5proxy
openstack-nova-placement-api
openstack-panko-api
openstack-panko-common
openstack-panko-doc
python-aodh
python-aodhclient
python-ceilometerclient-doc
python-cinder
python-cinderclient-doc
python-glance
python-heatclient
python-keystone
python-novaclient-doc
python-panko
python2-pankoclient
configutilities
drbd-bash-completion
drbd-udev
drbd-utils
drbd-heartbeat
drbd-pacemaker
drbd
kmod-drbd
python-networking-odl
tis-extensions-controller
wrs-heat-templates
python-django-horizon
kernel
kernel-module-igb-uio
kmod-e1000e
kmod-i40e
kmod-i40evf
kmod-ixgbe
kmod-ixgbevf
kmod-tpm
kmod-integrity
mlnx-ofa_kernel-modules
qat17
kernel-tools
kernel-tools-libs
NaviCLI-Linux-64-x86-en_US
kmod-drbd-rt
snmp-audittrail
wrs-ssl
tpm2-tools
tss2
python2-networking-bgpvpn
python-networking-bgpvpn-dashboard
python-networking-bgpvpn-heat
python2-neutron-dynamic-routing
python2-ryu
python-ryu-common
platform-kickstarts
python-3parclient
python-lefthandclient

View File

@ -0,0 +1,52 @@
task-cloud-compute
compute-huge
computeconfig
computeconfig-standalone
computeconfig-subfunction
guest-scale-helper
heartbeat
storageconfig
kernel-module-openvswitch
openstack-neutron-sriov-nic-agent
platform-util-noncontroller
ceilometer-compute
openstack-ceilometer-compute
cgcs-dpdk
cgcs-dpdk-rt
cgcs-dpdk-dev
cgcs-dpdk-rt-dev
cgcs-dpdk-staticdev
cgcs-dpdk-rt-staticdev
cgcs-dpdk-rt-apps
cgts-mtce-compute
cgts-mtce-storage
cgts-mtce-common-guestServer
host-guest-comm
host-guest-comm-dev
nfscheck
radvd
remote-clients
config-gate-compute
kernel-rt
kernel-module-igb-uio
kernel-module-igb-uio-rt
kernel-rt-kvm
kmod-e1000e-rt
kmod-i40e-rt
kmod-ixgbe-rt
kmod-tpm-rt
kmod-integrity-rt
mlnx-ofa_kernel-rt-modules
rtctl
rt-setup
qat17-rt
kernel-rt-tools
kernel-rt-tools-libs
kmod-drbd-rt
libtpms
swtpm
swtpm-tools
swtpm-cuse
swtpm-libs
OVMF
openvswitch

View File

@ -0,0 +1,24 @@
cgcs-dpdk-rt
cgcs-dpdk-rt-apps
cgts-mtce-storage
computeconfig-standalone
kernel-module-openvswitch
platform-util-noncontroller
storageconfig
nfscheck
remote-clients
kernel-rt
kernel-module-igb-uio-rt
kernel-rt-kvm
kmod-e1000e-rt
kmod-i40e-rt
kmod-ixgbe-rt
kmod-tpm-rt
kmod-integrity-rt
mlnx-ofa_kernel-rt-modules
rtctl
rt-setup
qat17-rt
kernel-rt-tools
kernel-rt-tools-libs
kmod-drbd-rt

View File

@ -0,0 +1,23 @@
cgcs-dpdk
cgcs-dpdk-apps
cgts-mtce-storage
computeconfig-standalone
kernel-module-openvswitch
platform-util-noncontroller
storageconfig
nfscheck
remote-clients
kernel
kernel-module-igb-uio
kmod-e1000e
kmod-i40e
kmod-i40evf
kmod-ixgbe
kmod-ixgbevf
kmod-tpm
kmod-integrity
mlnx-ofa_kernel-modules
qat17
kernel-tools
kernel-tools-libs
kmod-drbd

View File

@ -0,0 +1,303 @@
ceilometer-alarm-evaluator
ceilometer-alarm-notifier
ceilometer-api
ceilometer-collector
ceilometer-compute
ceilometer-tests
ceph-manager
cgcs-dpdk
cgcs-dpdk-rt
cgcs-dpdk-dev
cgcs-dpdk-rt-dev
cgcs-dpdk-staticdev
cgcs-dpdk-rt-staticdev
cgcs-dpdk-rt-apps
cgts-client
cgts-client-bash-completion
cgcs-patch-controller
cgts-mtce-compute
cgts-mtce-control
cgts-mtce-common-guestServer
cgts-mtce-common-guestAgent
cgtssys
cinder
cinder-api
cinder-scheduler
cinder-tests
cinder-volume
compute-huge
computeconfig
computeconfig-standalone
computeconfig-subfunction
configvalidator
controllerconfig
createrepo
d2to1
distributedcloud-dcmanager
distributedcloud-client-dcmanagerclient
distributedcloud-dcorch
erlang
fm-doc
glance
glance-api
glance-registry
glance-tests
glusterfs
glusterfs-api
glusterfs-client-xlators
glusterfs-libs
guest-scale-helper
haproxy
heartbeat
heat-api
heat-api-cfn
heat-cfn
heat-common
heat-contrib-nova-flavor
heat-engine
heat-templates
heat-tests
horizon
horizon-standalone
horizon-tests
host-guest-comm
io-monitor
io-scheduler
isomd5sum
ipxe-roms-qemu
kernel-module-openvswitch
keystone
keystone-tests
libconfig-general-perl
libguestfs
libssh2
lighttpd-module-access
lighttpd-module-accesslog
lighttpd-module-dirlisting
lighttpd-module-indexfile
lighttpd-module-proxy
lighttpd-module-staticfile
lighttpd
lighttpd-mod_geoip
lighttpd-fastcgi
lighttpd-mod_mysql_vhost
libvirt
libvirt-daemon
libvirt-daemon-config-network
libvirt-daemon-config-nwfilter
libvirt-daemon-driver-interface
libvirt-daemon-driver-lxc
libvirt-daemon-driver-network
libvirt-daemon-driver-nodedev
libvirt-daemon-driver-nwfilter
libvirt-daemon-driver-qemu
libvirt-daemon-driver-qemu
libvirt-daemon-driver-secret
libvirt-daemon-driver-storage
libvirt-daemon-kvm
libvirt-docs
nodejs
nova-api
nova-common
nova-compute
nova-compute-preclean
nova-compute-setup
nova-conductor
nova-consoleauth
nova-controller
nova-network
nova-novncproxy
nova-scheduler
nova-spicehtml5proxy
nova-tests
nova-api-proxy
nova-placement-api
novnc
net-snmp
openstack-aodh-api
openstack-aodh-commmon
openstack-aodh-compat
openstack-aodh-evaluator
openstack-aodh-expirer
openstack-aodh-listener
openstack-aodh-notifier
openstack-ceilometer-alarm
openstack-ceilometer-central
openstack-ceilometer-collector
openstack-ceilometer-compute
openstack-ceilometer-ipmi
openstack-ceilometer-notification
openstack-cinder
openstack-cinder-doc
openstack-dashboard
openstack-glance
openstack-glance-doc
openstack-heat-api
openstack-heat-api-cfn
openstack-heat-api-cloudwatch
openstack-heat-common
openstack-heat-engine
openstack-ironic-api
openstack-ironic-common
openstack-ironic-conductor
python-ironic-tests
python-ironic-inspector-client
python-ironic-lib
python2-ironicclient
openstack-keystone
openstack-keystone-doc
openstack-murano-api
openstack-murano-cf-api
openstack-murano-common
openstack-murano-doc
openstack-murano-engine
openstack-murano-ui
openstack-murano-ui-doc
python2-muranoclient
python-muranoclient-doc
openstack-magnum-api
openstack-magnum-common
openstack-magnum-conductor
openstack-magnum-doc
openstack-magnum-ui
python2-magnumclient
python-magnum
python-magnumclient-doc
python-magnumclient-tests
python-magnum-tests
python-magnum-ui-doc
openstack-neutron
openstack-neutron-common
openstack-neutron-sriov-nic-agent
openstack-neutron-ml2
openstack-nova-api
openstack-nova-cells
openstack-nova-common
openstack-nova-compute
openstack-nova-conductor
openstack-nova-console
openstack-nova-doc
openstack-nova-network
openstack-nova-novncproxy
openstack-nova-objectstore
openstack-nova-scheduler
openstack-nova-serialproxy
openstack-nova-spicehtml5proxy
openstack-nova-placement-api
openstack-panko-api
openstack-panko-common
openstack-panko-doc
openstack-ras
patch-alarm
patching-controller
pbr
pecan
postgresql
postgresql-client
postgresql-contrib
postgresql-timezone
pxe-network-installer
python-aodh
python-aodhclient
python-ceilometerclient
python-cephclient
python-cinder
python-cinderclient
python-django
python-django-appconf
python-django-compressor
python-django-openstack-auth
python-glance
python-glanceclient
python2-gunicorn
python-heat
python-heatclient
python-heatclient-bash-completion
python-horizon
python-keystone
python-libguestfs
python-lockfile
python-netclient
python-neutron
python-neutron-lib
python2-neutronclient
python-nova
python2-novaclient
python-novnc
python-openstackclient
python-pam
python-panko
python2-pankoclient
python-passlib
python-pytz
python-swiftclient
python-wsme
qemu-img-ev
qemu-kvm-common-ev
qemu-kvm-ev
qemu-kvm-tools-ev
radvd
rubygem-rdoc
snmp-ext
task-cloud-compute
task-cloud-controller
tgt
fm-mgr
sm
sm-api
sm-client
sm-common
sm-db
sm-tools
storage-topology
nfv-common
nfv-plugins
nfv-vim
nfv-tools
vm-topology
remote-clients
python-networking-odl
config-gate-compute
tis-extensions-controller
wrs-heat-templates
python-django-horizon
libmlx5
kernel-rt
kernel-module-igb-uio
kernel-module-igb-uio-rt
kernel-rt-kvm
kmod-e1000e-rt
kmod-i40e-rt
kmod-ixgbe-rt
kmod-tpm-rt
kmod-integrity-rt
mlnx-ofa_kernel-rt-modules
rtctl
rt-setup
qat17-rt
kernel-rt-tools
kernel-rt-tools-libs
NaviCLI-Linux-64-x86-en_US
kmod-drbd-rt
snmp-audittrail
wrs-ssl
tpm2-tools
tss2
tpm2-openssl-engine
libtpms
swtpm
swtpm-tools
swtpm-cuse
swtpm-libs
OVMF
python2-networking-bgpvpn
python-networking-bgpvpn-dashboard
python-networking-bgpvpn-heat
python2-neutron-dynamic-routing
python2-ryu
python-ryu-common
python2-networking-sfc
openvswitch
platform-kickstarts
python-3parclient
python-lefthandclient

155
bsp-files/grub.cfg Normal file
View File

@ -0,0 +1,155 @@
default=2
timeout=-1
search --no-floppy --set=root -l 'oe_iso_boot'
# ---------------------- NOTE ----------------------
# If you are updating menus, make sure that controllerconfig/clone.py
# is in sync with your changes (only serial console ids).
# STANDARD_STANDARD = 'standard>serial>' +
# sysinv_constants.SYSTEM_SECURITY_PROFILE_STANDARD
# STANDARD_EXTENDED = 'standard>serial>' +
# sysinv_constants.SYSTEM_SECURITY_PROFILE_EXTENDED
# AIO_STANDARD = 'standard>aio>' +
# sysinv_constants.SYSTEM_SECURITY_PROFILE_STANDARD
# AIO_EXTENDED = 'standard>aio>' +
# sysinv_constants.SYSTEM_SECURITY_PROFILE_EXTENDED
# AIO_LL_STANDARD = 'standard>aio-lowlat>' +
# sysinv_constants.SYSTEM_SECURITY_PROFILE_STANDARD
# AIO_LL_EXTENDED = 'standard>aio-lowlat>' +
# sysinv_constants.SYSTEM_SECURITY_PROFILE_EXTENDED
# SUBMENUITEM_TBOOT = 'tboot'
# SUBMENUITEM_SECUREBOOT = 'secureboot'
# --------------------------------------------------
# Menu 0
menuentry 'Select kernel options and boot kernel' {
echo " "
}
# Create a space in the menu
menuentry ' ' {
echo " "
}
# Standard Controller menu
submenu 'UEFI Standard Controller Configuration' --id=standard {
submenu 'Serial Console' --id=serial {
menuentry 'STANDARD Security Profile' --id=standard {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=standard
initrdefi /initrd.img
}
submenu 'EXTENDED Security Profile' --id=extended {
menuentry 'Secure Boot Profile' --id=secureboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=false
initrdefi /initrd.img
}
menuentry 'Trusted Boot Profile' --id=tboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=true
initrdefi /initrd.img
}
}
}
submenu 'Graphical Console' --id=graphical {
menuentry 'STANDARD Security Profile' --id=standard {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=tty0 serial inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=standard
initrdefi /initrd.img
}
submenu 'EXTENDED Security Profile' --id=extended {
menuentry 'Secure Boot Profile' --id=secureboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=tty0 serial inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=false
initrdefi /initrd.img
}
menuentry 'Trusted Boot Profile' --id=tboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=tty0 serial inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=true
initrdefi /initrd.img
}
}
}
}
# Create a space in the menu
menuentry ' '{
echo " "
}
# AIO Controller menu
submenu 'UEFI All-in-one Controller Configuration' --id=aio {
submenu 'Serial Console' --id=serial {
menuentry 'STANDARD Security Profile' --id=standard {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=standard
initrdefi /initrd.img
}
submenu 'EXTENDED Security Profile' --id=extended {
menuentry 'Secure Boot Profile' --id=secureboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=false
initrdefi /initrd.img
}
menuentry 'Trusted Boot Profile' --id=tboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=true
initrdefi /initrd.img
}
}
}
submenu 'Graphical Console' --id=graphical {
menuentry 'STANDARD Security Profile' --id=standard {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=standard
initrdefi /initrd.img
}
submenu 'EXTENDED Security Profile' --id=extended {
menuentry 'Secure Boot Profile' --id=secureboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=false
initrdefi /initrd.img
}
menuentry 'Trusted Boot Profile' --id=tboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=true
initrdefi /initrd.img
}
}
}
}
# Create a space in the menu
menuentry ' '{
echo " "
}
# AIO (lowlatency) Controller menu
submenu 'UEFI All-in-one (lowlatency) Controller Configuration' --id=aio-lowlat {
submenu 'Serial Console' --id=serial {
menuentry 'STANDARD Security Profile' --id=standard {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_lowlatency_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=standard
initrdefi /initrd.img
}
submenu 'EXTENDED Security Profile' --id=extended {
menuentry 'Secure Boot Profile' --id=secureboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_lowlatency_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=false
initrdefi /initrd.img
}
menuentry 'Trusted Boot Profile' --id=tboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_lowlatency_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=ttyS0,115200 inst.text serial inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=true
initrdefi /initrd.img
}
}
}
submenu 'Graphical Console' --id=graphical {
menuentry 'STANDARD Security Profile' --id=standard {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_lowlatency_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=standard
initrdefi /initrd.img
}
submenu 'EXTENDED Security Profile' --id=extended {
menuentry 'Secure Boot Profile' --id=secureboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_lowlatency_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=false
initrdefi /initrd.img
}
menuentry 'Trusted Boot Profile' --id=tboot {
linuxefi /vmlinuz inst.ks=hd:LABEL=oe_iso_boot:/smallsystem_lowlatency_ks.cfg boot_device=sda rootfs_device=sda biosdevname=0 usbcore.autosuspend=-1 console=tty0 inst.text inst.stage2=hd:LABEL=oe_iso_boot inst.gpt security_profile=extended tboot=true
initrdefi /initrd.img
}
}
}
}

View File

@ -0,0 +1,72 @@
# This file defines functions that can be used in %pre and %post kickstart sections, by including:
# . /tmp/ks-functions.sh
#
cat <<END_FUNCTIONS >/tmp/ks-functions.sh
#
# Copyright (c) xxxYEARxxx Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
function get_by_path()
{
local disk=\$(cd /dev ; readlink -f \$1)
for p in /dev/disk/by-path/*; do
if [ "\$disk" = "\$(readlink -f \$p)" ]; then
echo \$p
return
fi
done
}
function get_disk()
{
echo \$(cd /dev ; readlink -f \$1)
}
function report_pre_failure_with_msg()
{
local msg=\$1
echo -e '\n\nInstallation failed.\n'
echo "\$msg"
exit 1
}
function report_post_failure_with_msg()
{
local msg=\$1
cat <<EOF >> /etc/motd
Installation failed.
\$msg
EOF
echo "\$msg" >/etc/platform/installation_failed
echo -e '\n\nInstallation failed.\n'
echo "\$msg"
exit 1
}
function report_post_failure_with_logfile()
{
local logfile=\$1
cat <<EOF >> /etc/motd
Installation failed.
Please see \$logfile for details of failure
EOF
echo \$logfile >/etc/platform/installation_failed
echo -e '\n\nInstallation failed.\n'
cat \$logfile
exit 1
}
END_FUNCTIONS

View File

@ -0,0 +1,41 @@
# clone post installation script
%post --nochroot
if [ -d /mnt/install/source ]; then
srcdir=/mnt/install/source
else
srcdir=/run/install/repo
fi
if [ -d $srcdir/clone-archive ]; then
cp -r $srcdir/clone-archive /mnt/sysimage/
cp $srcdir/install_clone /mnt/sysimage/usr/bin/install_clone
chmod 500 /mnt/sysimage/usr/bin/install_clone
fi
%end
# clone post installation script to start install-clone service
%post --erroronfail
# Build install-clone service file here, so that it is patchable.
cat << EOF > /usr/lib/systemd/system/install-clone.service
[Unit]
Description=Titanium install-clone service
After=hostw.service
Before=serial-getty@ttyS0.service getty@tty1.service
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
Environment=PYTHONUNBUFFERED=1
ExecStart=/usr/bin/install_clone
StandardOutput=syslog+console
[Install]
WantedBy=multi-user.target
EOF
systemctl enable install-clone
%end

View File

@ -0,0 +1,104 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Turn off locale support for i18n if is not installed
if [ ! -d /usr/share/i18n ] ; then
rm -f /etc/sysconfig/i18n
fi
# Unset the hostname
rm /etc/hostname
# If using a serial install make sure to add a getty on the tty1
conarg=`cat /proc/cmdline |xargs -n1 echo |grep console= |grep ttyS`
if [ -n "$conarg" ] ; then
echo "1:2345:respawn:/sbin/mingetty tty1" >> /etc/inittab
fi
#### SECURITY PROFILE HANDLING (Post Installation) ####
# Check if the Security profile mode is enabled
# and load the appropriate kernel modules
secprofile=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$secprofile" ]; then
echo "In Extended Security profile mode. Loading IMA kernel module"
systemctl enable auditd.service
# Add the securityfs mount for the IMA Runtime measurement list
echo "securityfs /sys/kernel/security securityfs defaults,nodev 0 0" >> /etc/fstab
else
# Disable audit daemon in the Standard Security Profile
systemctl disable auditd
fi
# Configure smart package manager channels
rm -rf /var/lib/smart
mkdir /var/lib/smart
/usr/bin/smart channel -y \
--add rpmdb type=rpm-sys name="RPM Database"
/usr/bin/smart channel -y \
--add base type=rpm-md name="Base" baseurl=http://controller/feed/rel-xxxPLATFORM_RELEASExxx
/usr/bin/smart channel -y \
--add updates type=rpm-md name="Patches" baseurl=http://controller/updates/rel-xxxPLATFORM_RELEASExxx
# Configure smart to use rpm --nolinktos option
/usr/bin/smart config --set rpm-nolinktos=true
# Configure smart to use rpm --nosignature option
/usr/bin/smart config --set rpm-check-signatures=false
# Delete the CentOS yum repo files
rm -f /etc/yum.repos.d/CentOS-*
# Persist the boot device naming as UDEV rules so that if the network device
# order changes post-install that we will still be able to DHCP from the
# correct interface to reach the active controller. For most nodes only the
# management/boot interface needs to be persisted but because we require both
# controllers to be identically configured and controller-0 and controller-1
# are installed differently (e.g., controller-0 from USB and controller-1 from
# network) it is not possible to know which interface to persist for
# controller-0. The simplest solution is to persist all interfaces.
#
mkdir -p /etc/udev/rules.d
echo "# Persisted network interfaces from anaconda installer" > /etc/udev/rules.d/70-persistent-net.rules
for dir in /sys/class/net/*; do
if [ -e ${dir}/device ]; then
dev=$(basename ${dir})
mac_address=$(cat /sys/class/net/${dev}/address)
echo "ACTION==\"add\", SUBSYSTEM==\"net\", DRIVERS==\"?*\", ATTR{address}==\"${mac_address}\", NAME=\"${dev}\"" >> /etc/udev/rules.d/70-persistent-net.rules
fi
done
# Mark the wrsroot password as expired immediately
chage -d 0 wrsroot
# Lock the root password
passwd -l root
# Enable tmpfs mount for /tmp
# delete /var/tmp so that it can similinked in
rm -rf /var/tmp
systemctl enable tmp.mount
# Disable automount of /dev/hugepages
systemctl mask dev-hugepages.mount
# Disable firewall
systemctl disable firewalld
# Disable libvirtd
systemctl disable libvirtd.service
# Enable rsyncd
systemctl enable rsyncd.service
# Allow root to run sudo from a non-tty (for scripts running as root that run sudo cmds)
echo 'Defaults:root !requiretty' > /etc/sudoers.d/root
# Make fstab just root read/writable
chmod 600 /etc/fstab
# Create first_boot flag
touch /etc/platform/.first_boot
%end

View File

@ -0,0 +1,98 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Source the generated platform.conf
. /etc/platform/platform.conf
# Update grub with custom kernel bootargs
source /etc/init.d/cpumap_functions.sh
n_cpus=$(cat /proc/cpuinfo 2>/dev/null | \
awk '/^[pP]rocessor/ { n +=1 } END { print (n>0) ? n : 1}')
n_numa=$(ls -d /sys/devices/system/node/node* 2>/dev/null | wc -l)
KERN_OPTS=" iommu=pt usbcore.autosuspend=-1"
# Add kernel options for hugepages
if grep -q pdpe1gb /proc/cpuinfo
then
KERN_OPTS="${KERN_OPTS} hugepagesz=1G hugepages=${n_numa}"
KERN_OPTS="${KERN_OPTS} hugepagesz=2M hugepages=0 default_hugepagesz=2M"
else
KERN_OPTS="${KERN_OPTS} hugepagesz=2M hugepages=0 default_hugepagesz=2M"
fi
# If this is an all-in-one system, we need at least 4 CPUs
if [ "$system_type" = "All-in-one" -a ${n_cpus} -lt 4 ]; then
report_post_failure_with_msg "ERROR: At least 4 CPUs are required for controller+compute node."
fi
# Add kernel options for cpu isolation / affinity
if [ ${n_cpus} -gt 1 ]
then
base_cpulist=$(platform_expanded_cpu_list)
base_cpumap=$(cpulist_to_cpumap ${base_cpulist} ${n_cpus})
avp_cpulist=$(vswitch_expanded_cpu_list)
norcu_cpumap=$(invert_cpumap ${base_cpumap} ${n_cpus})
norcu_cpulist=$(cpumap_to_cpulist ${norcu_cpumap} ${n_cpus})
if [[ "$subfunction" =~ lowlatency ]]; then
KERN_OPTS="${KERN_OPTS} isolcpus=${norcu_cpulist}"
KERN_OPTS="${KERN_OPTS} nohz_full=${norcu_cpulist}"
else
KERN_OPTS="${KERN_OPTS} isolcpus=${avp_cpulist}"
fi
KERN_OPTS="${KERN_OPTS} rcu_nocbs=${norcu_cpulist}"
KERN_OPTS="${KERN_OPTS} kthread_cpus=${base_cpulist}"
KERN_OPTS="${KERN_OPTS} irqaffinity=${base_cpulist}"
# Update vswitch.conf
sed -i "s/^VSWITCH_CPU_LIST=.*/VSWITCH_CPU_LIST=\"${avp_cpulist}\"/" /etc/vswitch/vswitch.conf
fi
# Add kernel options to ensure an selinux is disabled
KERN_OPTS="${KERN_OPTS} selinux=0 enforcing=0"
# Add kernel options to set NMI watchdog
if [[ "$subfunction" =~ lowlatency ]]; then
KERN_OPTS="${KERN_OPTS} nmi_watchdog=0 softlockup_panic=0"
else
KERN_OPTS="${KERN_OPTS} nmi_watchdog=panic,1 softlockup_panic=1"
fi
if [[ "$(dmidecode -s system-product-name)" =~ ^ProLiant.*Gen8$ ]]; then
KERN_OPTS="${KERN_OPTS} intel_iommu=on,eth_no_rmrr"
else
KERN_OPTS="${KERN_OPTS} intel_iommu=on"
fi
# Add kernel option to disable biosdevname if enabled
# As this may already be in GRUB_CMDLINE_LINUX, only add if it is not already present
grep -q '^GRUB_CMDLINE_LINUX=.*biosdevname=0' /etc/default/grub
if [ $? -ne 0 ]; then
KERN_OPTS="${KERN_OPTS} biosdevname=0"
fi
# Add kernel options to disable kvm-intel.eptad on Broadwell
# Broadwell: Model: 79, Model name: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
if grep -q -E "^model\s+:\s+79$" /proc/cpuinfo
then
KERN_OPTS="${KERN_OPTS} kvm-intel.eptad=0"
fi
KERN_OPTS="${KERN_OPTS} cgroup_disable=memory"
# Add kernel option to avoid jiffies_lock contention on real-time kernel
if [[ "$subfunction" =~ lowlatency ]]; then
KERN_OPTS="${KERN_OPTS} skew_tick=1"
fi
perl -pi -e 's/(GRUB_CMDLINE_LINUX=.*)\"/\1'"$KERN_OPTS"'\"/g' /etc/default/grub
if [ -d /sys/firmware/efi ] ; then
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
else
grub2-mkconfig -o /boot/grub2/grub.cfg
fi
%end

View File

@ -0,0 +1,38 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
## Custom kernel options
KERN_OPTS=" intel_iommu=off usbcore.autosuspend=-1"
## Setup the loop module to support up to 15 partitions so that we can enable the
## customer to manually resize images if needed.
##
KERN_OPTS="${KERN_OPTS} loop.max_part=15"
## Add kernel options to ensure an selinux is disabled
KERN_OPTS="${KERN_OPTS} selinux=0 enforcing=0"
# Add kernel options to ensure NMI watchdog is enabled, if supported
KERN_OPTS="${KERN_OPTS} nmi_watchdog=panic,1 softlockup_panic=1"
# Add kernel option to disable biosdevname if enabled
# As this may already be in GRUB_CMDLINE_LINUX, only add if it is not already present
grep -q '^GRUB_CMDLINE_LINUX=.*biosdevname=0' /etc/default/grub
if [ $? -ne 0 ]; then
KERN_OPTS="${KERN_OPTS} biosdevname=0"
fi
KERN_OPTS="${KERN_OPTS} cgroup_disable=memory"
perl -pi -e 's/(GRUB_CMDLINE_LINUX=.*)\"/\1'"$KERN_OPTS"'\"/g' /etc/default/grub
if [ -d /sys/firmware/efi ] ; then
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
else
grub2-mkconfig -o /boot/grub2/grub.cfg
fi
%end

View File

@ -0,0 +1,32 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
## Custom kernel options
KERN_OPTS=" intel_iommu=off usbcore.autosuspend=-1"
## Add kernel options to ensure an selinux is disabled
KERN_OPTS="${KERN_OPTS} selinux=0 enforcing=0"
# Add kernel options to ensure NMI watchdog is enabled, if supported
KERN_OPTS="${KERN_OPTS} nmi_watchdog=panic,1 softlockup_panic=1"
# Add kernel option to disable biosdevname if enabled
# As this may already be in GRUB_CMDLINE_LINUX, only add if it is not already present
grep -q '^GRUB_CMDLINE_LINUX=.*biosdevname=0' /etc/default/grub
if [ $? -ne 0 ]; then
KERN_OPTS="${KERN_OPTS} biosdevname=0"
fi
KERN_OPTS="${KERN_OPTS} cgroup_disable=memory"
perl -pi -e 's/(GRUB_CMDLINE_LINUX=.*)\"/\1'"$KERN_OPTS"'\"/g' /etc/default/grub
if [ -d /sys/firmware/efi ] ; then
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
else
grub2-mkconfig -o /boot/grub2/grub.cfg
fi
%end

View File

@ -0,0 +1,12 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# uncomment the global_filter line in lvm.conf
perl -0777 -i.bak -pe 's:(# This configuration option has an automatic default value\.\n)\t# global_filter:$1 global_filter:m' /etc/lvm/lvm.conf
# Edit the LVM config so LVM does not look for LVs (we have none on compute nodes)
sed -i "s#^\( *\)global_filter = \[.*#\1global_filter = [ \"r|.*|\" ]#" /etc/lvm/lvm.conf
%end

View File

@ -0,0 +1,17 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# uncomment the global_filter line in lvm.conf
perl -0777 -i.bak -pe 's:(# This configuration option has an automatic default value\.\n)\t# global_filter:$1 global_filter:m' /etc/lvm/lvm.conf
# Determine which disk we created our PV on (i.e. the root disk)
ROOTDISK=$(get_by_path $(pvdisplay --select 'vg_name=cgts-vg' -C -o pv_name --noheadings))
if [ -z "$ROOTDISK" ]; then
report_post_failure_with_msg "ERROR: failed to identify rootdisk via pvdisplay"
fi
# Edit the LVM config so LVM only looks for LVs on the root disk
sed -i "s#^\( *\)global_filter = \[.*#\1global_filter = [ \"a|${ROOTDISK}|\", \"r|.*|\" ]#" /etc/lvm/lvm.conf
%end

View File

@ -0,0 +1,127 @@
repo --name=base --baseurl=http://pxecontroller/feed/rel-xxxPLATFORM_RELEASExxx/
repo --name=updates --baseurl=http://pxecontroller/updates/rel-xxxPLATFORM_RELEASExxx/
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Obtain the boot interface from the PXE boot
BOOTIF=`cat /proc/cmdline |xargs -n1 echo |grep BOOTIF=`
if [ -d /sys/firmware/efi ] ; then
BOOTIF=${BOOTIF#BOOTIF=}
else
BOOTIF=${BOOTIF#BOOTIF=01-}
BOOTIF=${BOOTIF//-/:}
fi
mgmt_dev=none
mgmt_vlan=0
if [ -n "$BOOTIF" ] ; then
ndev=`ip link show |grep -B 1 $BOOTIF |head -1 |awk '{print $2}' |sed -e 's/://'`
if [ -n "$ndev" ] ; then
mgmt_dev=$ndev
# Retrieve the management VLAN from sysinv if it exists
mgmt_vlan=`curl -sf http://pxecontroller:6385/v1/isystems/mgmtvlan`
if [ $? -ne 0 ]
then
report_post_failure_with_msg "ERROR: Unable to communicate with System Inventory REST API. Aborting installation."
fi
else
report_post_failure_with_msg "ERROR: Unable to determine mgmt interface from BOOTIF=$BOOTIF."
fi
else
report_post_failure_with_msg "ERROR: BOOTIF is not set. Unable to determine mgmt interface."
fi
if [ $mgmt_vlan -eq 0 ] ; then
# Persist the boot device to the platform configuration. This will get
# overwritten later if the management_interface is on a bonded interface.
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
# Build networking scripts
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
EOF
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$mgmt_dev
DEVICE=$mgmt_dev
BOOTPROTO=dhcp
ONBOOT=yes
LINKDELAY=20
EOF
else
# Check whether to use inet or inet6
ipv6_addr=$(dig +short AAAA controller)
if [[ -n "$ipv6_addr" ]]
then
mgmt_address_family=inet6
ipv6init=yes
dhcpv6c=yes
dhclientargs=-1
else
mgmt_address_family=inet
ipv6init=no
dhcpv6c=no
dhclientargs=
fi
# Persist the boot device to the platform configuration. This will get
# overwritten later if the management_interface is on a bonded interface.
echo management_interface=$mgmt_dev.$mgmt_vlan >> /etc/platform/platform.conf
# Build networking scripts
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
EOF
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$mgmt_dev
DEVICE=$mgmt_dev
BOOTPROTO=none
ONBOOT=yes
LINKDELAY=20
EOF
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$mgmt_dev.$mgmt_vlan
DEVICE=$mgmt_dev.$mgmt_vlan
BOOTPROTO=dhcp
DHCLIENTARGS=$dhclientargs
IPV6INIT=$ipv6init
DHCPV6C=$dhcpv6c
ONBOOT=yes
VLAN=yes
LINKDELAY=20
EOF
# Reject DHCPOFFER from DHCP server that doesn't send
# wrs-install-uuid option
echo "require wrs-install-uuid;" >>/etc/dhcp/dhclient.conf
echo "require dhcp6.wrs-install-uuid;" >>/etc/dhcp/dhclient.conf
# Bring up the mgmt vlan so that a dhcp lease is acquired and an address is
# setup prior to the post-install reboot. This is so that the timing of the IP
# address allocation is similar to how normal/non-pxe installation works.
mgmt_iface=$mgmt_dev.$mgmt_vlan
dhclient_family=$([[ $mgmt_address_family == "inet" ]] && echo -4 || echo -6)
ip link add link $mgmt_dev name $mgmt_iface type vlan id $mgmt_vlan
ip link set up dev $mgmt_iface
dhclient $dhclient_family $mgmt_iface || true
fi
%end

View File

@ -0,0 +1,79 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Retrieve the installation uuid from the controller we booted from
INSTALL_UUID=`curl -sf http://pxecontroller/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
if [ $? -ne 0 ]
then
INSTALL_UUID=unknown
fi
grep -q INSTALL_UUID /etc/platform/platform.conf
if [ $? -ne 0 ]; then
echo "INSTALL_UUID=$INSTALL_UUID" >> /etc/platform/platform.conf
fi
cd /www/pages
# Sync software repository
feed_url=http://pxecontroller/feed/
anaconda_logdir=/var/log/anaconda
mkdir -p $anaconda_logdir
echo "Mirroring software repository (may take several minutes)..." >/dev/console
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --reject '*.log' $feed_url/ -o $anaconda_logdir/wget-feed-mirror.log \
|| report_post_failure_with_logfile $anaconda_logdir/wget-feed-mirror.log
# Sync patching repository
updates_url=http://pxecontroller/updates/
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --reject '*.log' $updates_url/ -o $anaconda_logdir/wget-updates-mirror.log \
|| report_post_failure_with_logfile $anaconda_logdir/wget-updates-mirror.log
echo "Done" >/dev/console
shopt -s nullglob
# Check whether a second release is installed
. /etc/build.info
CURRENT_REL_DIR=rel-${SW_VERSION}
OTHER_REL_DIR=
for REL_DIR in /www/pages/feed/*; do
if [[ ! $REL_DIR =~ "${SW_VERSION}" ]]; then
OTHER_REL_DIR=`basename $REL_DIR`
OTHER_REL_VERSION=${OTHER_REL_DIR:4}
break
fi
done
# If second release is installed, find the latest version of the installer
# RPM and install the pxeboot files we require to boot hosts with that release.
if [ ! -z "$OTHER_REL_DIR" ]; then
PATCH_RPM=`find /www/pages/updates/${OTHER_REL_DIR}/Packages -name 'pxe-network-installer*' | sort -V | tail -1`
BASE_RPM=`find /www/pages/feed/${OTHER_REL_DIR}/Packages -name 'pxe-network-installer*' | sort -V | tail -1`
if [ ! -z "$PATCH_RPM" ]; then
INSTALL_RPM=$PATCH_RPM
elif [ ! -z "$BASE_RPM" ]; then
INSTALL_RPM=$BASE_RPM
else
report_post_failure_with_msg "ERROR: Unable to find pxe-network-installer RPM for $OTHER_REL_DIR. Aborting installation."
fi
echo "Installing pxeboot files for release $OTHER_REL_DIR from $INSTALL_RPM" >/dev/console
TMP_RPM=/tmp/pxe-network-installer
mkdir $TMP_RPM
pushd $TMP_RPM
/usr/bin/rpm2cpio $INSTALL_RPM | cpio -idm \
|| report_post_failure_with_msg "Failed to extract pxe-network-installer"
cp -r $TMP_RPM/usr / \
|| report_post_failure_with_msg "Failed to copy pxe-network-installer /usr"
cp -r $TMP_RPM/pxeboot/$OTHER_REL_DIR /pxeboot/ \
|| report_post_failure_with_msg "Failed to copy pxe-network-installer /pxeboot/$OTHER_REL_DIR"
cp $TMP_RPM/pxeboot/pxelinux.cfg.files/*-$OTHER_REL_VERSION /pxeboot/pxelinux.cfg.files/ \
|| report_post_failure_with_msg "Failed to copy pxe-network-installer pxelinux.cfg files"
rm -rf $TMP_RPM
fi
%end

View File

@ -0,0 +1,22 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Set the security profile mode
secprofile="standard"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
secprofile="extended"
fi
mkdir -p -m 0775 /etc/platform
cat <<EOF > /etc/platform/platform.conf
nodetype=controller
subfunction=controller,compute
system_type=All-in-one
security_profile=$secprofile
EOF
%end

View File

@ -0,0 +1,22 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Set the security profile mode
secprofile="standard"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
secprofile="extended"
fi
mkdir -p -m 0775 /etc/platform
cat <<EOF > /etc/platform/platform.conf
nodetype=controller
subfunction=controller,compute,lowlatency
system_type=All-in-one
security_profile=$secprofile
EOF
%end

View File

@ -0,0 +1,34 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Retrieve the installation uuid from the controller we booted from
INSTALL_UUID=`curl -sf http://pxecontroller/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
if [ $? -ne 0 ]
then
INSTALL_UUID=unknown
fi
# Set the security profile mode
secprofile="standard"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
secprofile="extended"
fi
mkdir -p -m 0775 /etc/platform
cat <<EOF > /etc/platform/platform.conf
nodetype=compute
subfunction=compute
system_type=Standard
security_profile=$secprofile
INSTALL_UUID=$INSTALL_UUID
EOF
# mount the platform directory from the controller
cat >> /etc/fstab <<EOF
controller-platform-nfs:/opt/platform /opt/platform nfs timeo=30,udp,rsize=1024,wsize=1024,_netdev 0 0
EOF
%end

View File

@ -0,0 +1,34 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Retrieve the installation uuid from the controller we booted from
INSTALL_UUID=`curl -sf http://pxecontroller/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
if [ $? -ne 0 ]
then
INSTALL_UUID=unknown
fi
# Set the security profile mode
secprofile="standard"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
secprofile="extended"
fi
mkdir -p -m 0775 /etc/platform
cat <<EOF > /etc/platform/platform.conf
nodetype=compute
subfunction=compute,lowlatency
system_type=Standard
security_profile=$secprofile
INSTALL_UUID=$INSTALL_UUID
EOF
# mount the platform directory from the controller
cat >> /etc/fstab <<EOF
controller-platform-nfs:/opt/platform /opt/platform nfs timeo=30,udp,rsize=1024,wsize=1024,_netdev 0 0
EOF
%end

View File

@ -0,0 +1,22 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Set the security profile mode
secprofile="standard"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
secprofile="extended"
fi
mkdir -p -m 0775 /etc/platform
cat <<EOF > /etc/platform/platform.conf
nodetype=controller
subfunction=controller
system_type=Standard
security_profile=$secprofile
EOF
%end

View File

@ -0,0 +1,29 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Retrieve the installation uuid from the controller we booted from
INSTALL_UUID=`curl -sf http://pxecontroller/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
if [ $? -ne 0 ]
then
INSTALL_UUID=unknown
fi
# Set the security profile mode
secprofile="standard"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
secprofile="extended"
fi
mkdir -p -m 0775 /etc/platform
cat <<EOF > /etc/platform/platform.conf
nodetype=storage
subfunction=storage
system_type=Standard
security_profile=$secprofile
INSTALL_UUID=$INSTALL_UUID
EOF
%end

View File

@ -0,0 +1,114 @@
%pre --erroronfail
# Source common functions
. /tmp/ks-functions.sh
echo "repo --name=base --baseurl=xxxHTTP_URLxxx/" > /tmp/repo-include
echo "repo --name=updates --baseurl=xxxHTTP_URLxxx/patches/" > /tmp/repo-include
%end
# Repository arguments from %pre
%include /tmp/repo-include
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Obtain the boot interface from the PXE boot
BOOTIF=`cat /proc/cmdline |xargs -n1 echo |grep BOOTIF=`
if [ -d /sys/firmware/efi ] ; then
BOOTIF=${BOOTIF#BOOTIF=}
else
BOOTIF=${BOOTIF#BOOTIF=01-}
BOOTIF=${BOOTIF//-/:}
fi
mgmt_dev=none
if [ -n "$BOOTIF" ] ; then
ndev=`ip link show |grep -B 1 $BOOTIF |head -1 |awk '{print $2}' |sed -e 's/://'`
if [ -n "$ndev" ] ; then
mgmt_dev=$ndev
else
report_post_failure_with_msg "ERROR: Unable to determine mgmt interface from BOOTIF=$BOOTIF."
fi
else
report_post_failure_with_msg "ERROR: BOOTIF is not set. Unable to determine mgmt interface."
fi
# Persist the boot device to the platform configuration. This will get
# overwritten when config_controller is run.
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
# Build networking scripts
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
EOF
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$mgmt_dev
DEVICE=$mgmt_dev
BOOTPROTO=dhcp
ONBOOT=yes
EOF
%end
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
anaconda_logdir=/var/log/anaconda
mkdir -p $anaconda_logdir
cd /www/pages
mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/Packages
mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/repodata
cd feed/rel-xxxPLATFORM_RELEASExxx
feed_url=xxxHTTP_URLxxx
declare -i cut_dirs=NUM_DIRS
echo "Mirroring software repository (may take several minutes)..." >/dev/console
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$cut_dirs $feed_url/Packages/ -o $anaconda_logdir/rpmget.log \
|| report_post_failure_with_logfile $anaconda_logdir/rpmget.log
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$cut_dirs $feed_url/repodata/ -o $anaconda_logdir/rpmget_repo.log \
|| report_post_failure_with_logfile $anaconda_logdir/rpmget_repo.log
wget $feed_url/isolinux.cfg --append $anaconda_logdir/wget_kickstarts.log \
|| report_post_failure_with_logfile $anaconda_logdir/wget_kickstarts.log
echo "Done" >/dev/console
patches_url=xxxHTTP_URLxxx/patches
wget -q --spider ${patches_url}/
if [ $? -eq 0 ]; then
echo "Downloading patches..." >/dev/console
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/Packages
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/repodata
declare -i patches_cut_dirs=$((cut_dirs+1))
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/Packages/ -o $anaconda_logdir/patches_rpmget.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget.log
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/repodata/ -o $anaconda_logdir/patches_rpmget_repo.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_repo.log
mkdir -p /opt/patching/metadata
mkdir -p /opt/patching/packages/xxxPLATFORM_RELEASExxx
cd /opt/patching
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/metadata/ -o $anaconda_logdir/patches_rpmget_metadata.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_metadata.log
find /www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages -name '*.rpm' \
| xargs --no-run-if-empty -I files cp --preserve=all files /opt/patching/packages/xxxPLATFORM_RELEASExxx/
echo "Done" >/dev/console
fi
# Create a uuid specific to this installation
INSTALL_UUID=`uuidgen`
echo $INSTALL_UUID > /www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid
echo "INSTALL_UUID=$INSTALL_UUID" >> /etc/platform/platform.conf
%end

View File

@ -0,0 +1,35 @@
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Source the generated platform.conf
. /etc/platform/platform.conf
## Reserve more memory for base processes since the controller has higher
## memory requirements but cap it to better handle systems with large
## amounts of memory
TOTALMEM=$(grep MemTotal /proc/meminfo | awk '{print int($2/1024)}')
if [ -e /sys/devices/system/node/node0 ]; then
RESERVEDMEM=$(grep MemTotal /sys/devices/system/node/node0/meminfo | awk '{printf "%d\n", $4/1024}')
else
RESERVEDMEM=$(grep MemTotal /proc/meminfo | awk '{print int($2/1024/4)}')
fi
if [ ${RESERVEDMEM} -lt 6144 ]; then
RESERVEDMEM=6144
elif [ ${RESERVEDMEM} -gt 14500 ]; then
RESERVEDMEM=14500
elif [ ${RESERVEDMEM} -gt 8192 ]; then
RESERVEDMEM=8192
fi
sed -i -e "s#\(COMPUTE_BASE_RESERVED\)=.*#\1=(\"node0:${RESERVEDMEM}MB:1\" \"node1:2000MB:0\" \"node2:2000MB:0\" \"node3:2000MB:0\")#g" /etc/nova/compute_reserved.conf
# Update COMPUTE_CPU_LIST
N_CPUS=$(cat /proc/cpuinfo 2>/dev/null | awk '/^[pP]rocessor/ { n +=1 } END { print (n>0) ? n : 1}')
sed -i "s/^COMPUTE_CPU_LIST=.*/COMPUTE_CPU_LIST=\"0-$((N_CPUS-1))\"/" /etc/nova/compute_reserved.conf
%end

View File

@ -0,0 +1,80 @@
%pre --erroronfail
# Source common functions
. /tmp/ks-functions.sh
if [ -d /mnt/install/source ]; then
srcdir=/mnt/install/source
else
srcdir=/run/install/repo
fi
touch /tmp/repo-include
if [ -d ${srcdir}/patches ]; then
echo "repo --name=updates --baseurl=file://${srcdir}/patches/" > /tmp/repo-include
fi
%end
# Repository arguments from %pre
%include /tmp/repo-include
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
mgmt_dev=none
# Persist the boot device to the platform configuration. This will get
# overwritten when config_controller is run.
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
# Build networking scripts
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
EOF
%end
# Note, this section is different and replaced with a wget
# if doing the initial install off the network
%post --nochroot
if [ -d /mnt/install/source ]; then
srcdir=/mnt/install/source
else
srcdir=/run/install/repo
fi
if [ -d $srcdir/Packages ] ; then
mkdir -p /mnt/sysimage/www/pages/feed/rel-xxxPLATFORM_RELEASExxx
cp -r $srcdir/Packages /mnt/sysimage/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/Packages
cp -r $srcdir/repodata /mnt/sysimage/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/repodata
cp $srcdir/*.cfg /mnt/sysimage/www/pages/feed/rel-xxxPLATFORM_RELEASExxx
fi
if [ -d $srcdir/patches ]; then
mkdir -p /mnt/sysimage/www/pages/updates/rel-xxxPLATFORM_RELEASExxx
cp -r $srcdir/patches/Packages /mnt/sysimage/www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages
cp -r $srcdir/patches/repodata /mnt/sysimage/www/pages/updates/rel-xxxPLATFORM_RELEASExxx/repodata
mkdir -p /mnt/sysimage/opt/patching
cp -r $srcdir/patches/metadata /mnt/sysimage/opt/patching/metadata
mkdir -p /mnt/sysimage/opt/patching/packages/xxxPLATFORM_RELEASExxx
find /mnt/sysimage/www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages -name '*.rpm' \
| xargs --no-run-if-empty -I files cp --preserve=all files /mnt/sysimage/opt/patching/packages/xxxPLATFORM_RELEASExxx/
fi
# Create a uuid specific to this installation
INSTALL_UUID=`uuidgen`
echo $INSTALL_UUID > /mnt/sysimage/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid
echo "INSTALL_UUID=$INSTALL_UUID" >> /mnt/sysimage/etc/platform/platform.conf
%end

View File

@ -0,0 +1,115 @@
%pre --erroronfail
# Source common functions
. /tmp/ks-functions.sh
echo "repo --name=base --baseurl=http://xxxBOOT_SERVERxxx/umalab/`hostname`_feed/" > /tmp/repo-include
echo "repo --name=updates --baseurl=http://xxxBOOT_SERVERxxx/umalab/`hostname`_feed/patches" > /tmp/repo-include
%end
# Repository arguments from %pre
%include /tmp/repo-include
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Obtain the boot interface from the PXE boot
BOOTIF=`cat /proc/cmdline |xargs -n1 echo |grep BOOTIF=`
if [ -d /sys/firmware/efi ] ; then
BOOTIF=${BOOTIF#BOOTIF=}
else
BOOTIF=${BOOTIF#BOOTIF=01-}
BOOTIF=${BOOTIF//-/:}
fi
mgmt_dev=none
if [ -n "$BOOTIF" ] ; then
ndev=`ip link show |grep -B 1 $BOOTIF |head -1 |awk '{print $2}' |sed -e 's/://'`
if [ -n "$ndev" ] ; then
mgmt_dev=$ndev
else
report_post_failure_with_msg "ERROR: Unable to determine mgmt interface from BOOTIF=$BOOTIF."
fi
else
report_post_failure_with_msg "ERROR: BOOTIF is not set. Unable to determine mgmt interface."
fi
# Persist the boot device to the platform configuration. This will get
# overwritten when config_controller is run.
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
# Build networking scripts
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
EOF
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$mgmt_dev
DEVICE=$mgmt_dev
BOOTPROTO=dhcp
ONBOOT=yes
LINKDELAY=20
EOF
%end
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
anaconda_logdir=/var/log/anaconda
mkdir -p $anaconda_logdir
cd /www/pages
mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/Packages
mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/repodata
cd feed/rel-xxxPLATFORM_RELEASExxx
feed_url=http://xxxBOOT_SERVERxxx/umalab/`hostname`_feed
declare -i cut_dirs=2
echo "Mirroring software repository (may take several minutes)..." >/dev/console
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$cut_dirs $feed_url/Packages/ -o $anaconda_logdir/rpmget.log \
|| report_post_failure_with_logfile $anaconda_logdir/rpmget.log
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$cut_dirs $feed_url/repodata/ -o $anaconda_logdir/rpmget_repo.log \
|| report_post_failure_with_logfile $anaconda_logdir/rpmget_repo.log
wget $feed_url/isolinux.cfg --append $anaconda_logdir/wget_kickstarts.log \
|| report_post_failure_with_logfile $anaconda_logdir/wget_kickstarts.log
# Check for patches
patches_url=http://xxxBOOT_SERVERxxx/umalab/`hostname`_feed/patches
wget -q --spider ${patches_url}/
if [ $? -eq 0 ]; then
cd /www/pages
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/Packages
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/repodata
cd updates/rel-xxxPLATFORM_RELEASExxx
declare -i patches_cut_dirs=$((cut_dirs+1))
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/Packages/ -o $anaconda_logdir/patches_rpmget.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget.log
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/repodata/ -o $anaconda_logdir/patches_rpmget_repo.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_repo.log
mkdir -p /opt/patching/metadata
mkdir -p /opt/patching/packages/xxxPLATFORM_RELEASExxx
cd /opt/patching
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/metadata/ -o $anaconda_logdir/patches_rpmget_metadata.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_metadata.log
find /www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages -name '*.rpm' \
| xargs --no-run-if-empty -I files cp --preserve=all files /opt/patching/packages/xxxPLATFORM_RELEASExxx/
echo "Done" >/dev/console
fi
# Create a uuid specific to this installation
INSTALL_UUID=`uuidgen`
echo $INSTALL_UUID > /www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid
echo "INSTALL_UUID=$INSTALL_UUID" >> /etc/platform/platform.conf
%end

View File

@ -0,0 +1,72 @@
%pre --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# First, parse /proc/cmdline to find the boot args
set -- `cat /proc/cmdline`
for I in $*; do case "$I" in *=*) eval $I 2>/dev/null;; esac; done
append=
if [ -n "$console" ] ; then
append="console=$console"
fi
if [ -n "$security_profile" ]; then
append="$append security_profile=$security_profile"
fi
#### SECURITY PROFILE HANDLING (Pre Installation) ####
if [ -n "$security_profile" ] && [ "$security_profile" == "extended" ]; then
# IMA specific boot options:
# Enable Kernel auditing
append="$append audit=1"
else
# we need to blacklist the IMA and Integrity Modules
# on standard security profile
append="$append module_blacklist=integrity,ima"
# Disable Kernel auditing in Standard Security Profile mode
append="$append audit=0"
fi
if [ -n "$tboot" ]; then
append="$append tboot=$tboot"
else
append="$append tboot=false"
fi
boot_device_arg=
if [ -n "$boot_device" ] ; then
boot_device_arg="--boot-drive=$(get_by_path $boot_device)"
fi
echo "bootloader --location=mbr $boot_device_arg --timeout=5 --append=\"$append\"" > /tmp/bootloader-include
echo "timezone --nontp --utc UTC" >/tmp/timezone-include
%end
#version=DEVEL
install
lang en_US.UTF-8
keyboard us
%include /tmp/timezone-include
# set to 'x' so we can use shadow password
rootpw --iscrypted x
selinux --disabled
authconfig --enableshadow --passalgo=sha512
firewall --service=ssh
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
zerombr
# Disk layout from %pre
%include /tmp/part-include
# Bootloader parms from %pre
%include /tmp/bootloader-include
reboot --eject

View File

@ -0,0 +1,102 @@
## NOTE: updates to partition sizes need to be also reflected in
## _controller_filesystem_limits() in sysinv/api/controllers/v1/istorconfig.py
##
## NOTE: When adding partitions, we currently have a max of 4 primary partitions.
## If more than 4 partitions are required, we can use a max of 3 --asprimary,
## to allow 1 primary logical partition with extended partitions
##
## NOTE: Max default PV size must align with the default controllerfs sizes
##
## BACKUP_OVERHEAD = 20
##
## Physical install
## - DB size is doubled to allow for upgrades
##
## DEFAULT_IMAGE_STOR_SIZE = 10
## DEFAULT_DATABASE_STOR_SIZE = 20
## DEFAULT_IMG_CONVERSION_STOR_SIZE = 20
## BACKUP = DEFAULT_DATABASE_STOR_SIZE + DEFAULT_IMAGE_STOR_SIZE
## + BACKUP_OVERHEAD = 50
## LOG_VOL_SIZE = 8192
## SCRATCH_VOL_SIZE = 8192
## RABBIT = 2048
## PLATFORM = 2048
## ANCHOR = 1024
## EXTENSION = 1024
## RESERVED_PE = 16 (based on pesize=32768)
##
## CGCS_PV_SIZE = 10240 + 2*20480 + 20480 + 51200 + 8196 +
## 8196 + 2048 + 2048 + 1024 + 1024 + 16 = 145424
##
## small install - uses is_virtual check
## - DB size is doubled to allow for upgrades
##
## DEFAULT_VIRTUAL_IMAGE_STOR_SIZE = 8
## DEFAULT_VIRTUAL_DATABASE_STOR_SIZE = 5
## DEFAULT_VIRTUAL_IMG_CONVERSION_STOR_SIZE = 8
## DEFAULT_VIRTUAL_BACKUP_STOR_SIZE = 5
##
## LOG_VOL_SIZE = 4096
## SCRATCH_VOL_SIZE = 4096
## RABBIT = 2048
## PLATFORM = 2048
## ANCHOR = 1024
## EXTENSION = 1024
## RESERVED_PE = 16 (based on pesize=32768)
##
## CGCS_PV_SIZE = 8192 + 2*5120 + 8192 + 5120 + 4096 +
## 4096 + 2048 + 2048 + 1024 + 1024 +16 = 46096
##
## NOTE: To maintain upgrade compatability within the volume group, keep the
## undersized LOG_VOL_SIZE and SCRATCH_VOL_SIZE, but size the minimally size
## physical volume correctly.
##
## R4 AIO installations:
## - R4 (case #1): /boot (0.5G), / (20G),
## cgts-vg PV (239G), /local_pv (239G)
## - R4 (case #2): /boot (0.5G), / (20G),
## cgts-vg PV (239G), cgts-vg (239G)
##
## Upgrade migration will start with R5 install and create a partition to align
## above so filesystems within the volume group will be able to maintain their
## sizes in R5
## - R5 install : /boot (0.5G), / (20G),
## cgts-vg PV (142G), un-partitioned (336G)
## - R5 (case #1): /boot (0.5G), / (20G),
## cgts-vg PV (142G), cgts-vg PV (97G), unpartitioned (239G)
## - R5 (case #2): /boot (0.5G), / (20G),
## cgts-vg PV (142G), cgts-vg PV (336G)
##
sz=$(blockdev --getsize64 $(get_disk $rootfs_device))
if [ $sz -le $((161*$gb)) ] ; then
## This covers vbox or any 55g < disk < 162gb: < 55g won't install
LOG_VOL_SIZE=4000
SCRATCH_VOL_SIZE=4000
ROOTFS_SIZE=10000
CGCS_PV_SIZE=46096
else
LOG_VOL_SIZE=8000
SCRATCH_VOL_SIZE=8000
ROOTFS_SIZE=20000
CGCS_PV_SIZE=145424
fi
ROOTFS_OPTIONS="defaults"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
# Enable iversion labelling for rootfs when IMA is enabled
ROOTFS_OPTIONS="${ROOTFS_OPTIONS},iversion"
fi
cat<<EOF>>/tmp/part-include
part /boot --fstype=ext4 --asprimary --size=500 --ondrive=$(get_disk $rootfs_device) --fsoptions="$ROOTFS_OPTIONS"
part pv.253004 --grow --size=500 --maxsize=$CGCS_PV_SIZE --ondrive=$(get_disk $rootfs_device)
volgroup cgts-vg --pesize=32768 pv.253004
logvol /var/log --fstype=ext4 --vgname=cgts-vg --size=$LOG_VOL_SIZE --name=log-lv
logvol /scratch --fstype=ext4 --vgname=cgts-vg --size=$SCRATCH_VOL_SIZE --name=scratch-lv
part / --fstype=ext4 --asprimary --size=$ROOTFS_SIZE --ondrive=$(get_disk $rootfs_device) --fsoptions="$ROOTFS_OPTIONS"
EOF
%end

View File

@ -0,0 +1,31 @@
sz=$(blockdev --getsize64 $(get_disk $rootfs_device))
if [ $sz -le $((80*$gb)) ] ; then
## Less than 80GB use a 10GB root partition
LOG_VOL_SIZE=4000
SCRATCH_VOL_SIZE=4000
ROOTFS_SIZE=10000
else
## Use a 20GB root partition
LOG_VOL_SIZE=4000
SCRATCH_VOL_SIZE=4000
ROOTFS_SIZE=20000
fi
ROOTFS_OPTIONS="defaults"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
# Enable iversion labelling for rootfs when IMA is enabled
ROOTFS_OPTIONS="${ROOTFS_OPTIONS},iversion"
fi
cat<<EOF>>/tmp/part-include
part /boot --fstype=ext4 --asprimary --size=500 --ondrive=$(get_disk $rootfs_device) --fsoptions="$ROOTFS_OPTIONS"
part / --fstype=ext4 --asprimary --size=$ROOTFS_SIZE --ondrive=$(get_disk $rootfs_device) --fsoptions="$ROOTFS_OPTIONS"
part /var/log --fstype=ext4 --size=$LOG_VOL_SIZE --ondrive=$(get_disk $rootfs_device)
part /scratch --fstype=ext4 --size=$SCRATCH_VOL_SIZE --ondrive=$(get_disk $rootfs_device)
EOF
%end

View File

@ -0,0 +1,34 @@
## NOTE: updates to partition sizes need to be also reflected in
## _controller_filesystem_limits() in sysinv/api/controllers/v1/istorconfig.py
sz=$(blockdev --getsize64 $(get_disk $rootfs_device))
if [ $sz -le $((60*$gb)) ] ; then
LOG_VOL_SIZE=4000
SCRATCH_VOL_SIZE=4000
ROOTFS_SIZE=10000
else
LOG_VOL_SIZE=8000
SCRATCH_VOL_SIZE=8000
ROOTFS_SIZE=20000
fi
ROOTFS_OPTIONS="defaults"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
# Enable iversion labelling for rootfs when IMA is enabled
ROOTFS_OPTIONS="${ROOTFS_OPTIONS},iversion"
fi
cat<<EOF>>/tmp/part-include
part /boot --fstype=ext4 --asprimary --size=500 --ondrive=$(get_disk $rootfs_device) --fsoptions="$ROOTFS_OPTIONS"
part pv.253004 --grow --asprimary --size=500 --ondrive=$(get_disk $rootfs_device)
volgroup cgts-vg --pesize=32768 pv.253004
logvol /var/log --fstype=ext4 --vgname=cgts-vg --size=$LOG_VOL_SIZE --name=log-lv
logvol /scratch --fstype=ext4 --vgname=cgts-vg --size=$SCRATCH_VOL_SIZE --name=scratch-lv
part / --fstype=ext4 --asprimary --size=$ROOTFS_SIZE --ondrive=$(get_disk $rootfs_device) --fsoptions="$ROOTFS_OPTIONS"
EOF
%end

View File

@ -0,0 +1,154 @@
%pre --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# This is a really fancy way of finding the first usable disk for the
# install and not stomping on the USB device if it comes up first
# First, parse /proc/cmdline to find the boot args
set -- `cat /proc/cmdline`
for I in $*; do case "$I" in *=*) eval $I 2>/dev/null;; esac; done
# Find either the ISO or USB device first chopping off partition
ISO_DEV=`readlink /dev/disk/by-label/oe_iso_boot`
sdev=`echo $ISO_DEV | sed -e 's/.$//'`
if [ -e /dev/disk/by-label/$sdev ] ; then
ISO_DEV=$sdev
fi
USB_DEV=`readlink /dev/disk/by-label/wr_usb_boot`
sdev=`echo $USB_DEV | sed -e 's/.$//'`
if [ -e /dev/disk/by-label/$sdev ] ; then
USB_DEV=$sdev
fi
# Temporary, until lab pxelinux.cfg files are updated to specify install devices
if [ -z "$rootfs_device" -o -z "$boot_device" ]
then
INST_HDD=""
# Prefer a vd* device if this is kvm/qemu
for e in vda vdb sda sdb nvme0n1; do
if [ -e /dev/$e -a "$ISO_DEV" != "../../$e" -a "$USB_DEV" != "../../$e" ] ; then
INST_HDD=$e
break
fi
done
# Set variables to $INST_HDD if not set
rootfs_device=${rootfs_device:-$INST_HDD}
boot_device=${boot_device:-$INST_HDD}
fi
# Convert to by-path
orig_rootfs_device=$rootfs_device
rootfs_device=$(get_by_path $rootfs_device)
orig_boot_device=$boot_device
boot_device=$(get_by_path $boot_device)
if [ ! -e "$rootfs_device" -o ! -e "$boot_device" ] ; then
# Touch this file to prevent Anaconda from dying an ungraceful death
touch /tmp/part-include
report_pre_failure_with_msg "ERROR: Specified installation ($orig_rootfs_device) or boot ($orig_boot_device) device is invalid."
fi
# Ensure specified device is not a USB drive
udevadm info --query=property --name=$rootfs_device |grep -q '^ID_BUS=usb' || \
udevadm info --query=property --name=$boot_device |grep -q '^ID_BUS=usb'
if [ $? -eq 0 ]; then
# Touch this file to prevent Anaconda from dying an ungraceful death
touch /tmp/part-include
report_pre_failure_with_msg "ERROR: Specified installation ($orig_rootfs_device) or boot ($orig_boot_device) device is a USB drive."
fi
# Deactivate existing volume groups to avoid Anaconda issues with pre-existing groups
vgs --noheadings -o vg_name | xargs --no-run-if-empty -n 1 vgchange -an
ONLYUSE_HDD=""
if [ "$(curl -sf http://pxecontroller:6385/v1/upgrade/$(hostname)/in_upgrade 2>/dev/null)" = "true" ]; then
# In an upgrade, only wipe the disk with the rootfs and boot partition
echo "In upgrade, wiping only $rootfs_device"
WIPE_HDD="$(get_disk $rootfs_device)"
ONLYUSE_HDD="$(basename $(get_disk $rootfs_device))"
if [ "$(get_disk $rootfs_device)" != "$(get_disk $boot_device)" ]; then
WIPE_HDD="$WIPE_HDD,$(get_disk $boot_device)"
ONLYUSE_HDD="$ONLYUSE_HDD,$(basename $(get_disk $boot_device))"
fi
else
# Make a list of all the hard drives that are to be wiped
WIPE_HDD=""
for f in /dev/disk/by-path/*
do
dev=$(readlink -f $f)
lsblk --nodeps --pairs $dev | grep -q 'TYPE="disk"'
if [ $? -ne 0 ]
then
continue
fi
# Avoid wiping USB drives
udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue
devname=$(basename $dev)
if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ] ; then
if [ -n "$WIPE_HDD" ] ; then
WIPE_HDD=$WIPE_HDD,$dev
else
WIPE_HDD=$dev
fi
fi
done
echo "Not in upgrade, wiping all disks: $WIPE_HDD"
fi
for dev in ${WIPE_HDD//,/ }
do
# Clearing previous GPT tables or LVM data
# Delete the first few bytes at the start and end of the partition. This is required with
# GPT partitions, they save partition info at the start and the end of the block.
# Do this for each partition on the disk, as well.
partitions=$(lsblk -rip $dev -o TYPE,NAME |awk '$1 == "part" {print $2}')
for p in $partitions $dev
do
echo "Pre-wiping $p from kickstart"
dd if=/dev/zero of=$p bs=512 count=34
dd if=/dev/zero of=$p bs=512 count=34 seek=$((`blockdev --getsz $p` - 34))
done
done
# Check for remaining cgts-vg PVs, which could potentially happen
# in an upgrade where we're not wiping all disks.
# If we ever create other volume groups from kickstart in the future,
# include them in this search as well.
partitions=$(pvs --select 'vg_name=cgts-vg' -o pv_name --noheading | grep -v '\[unknown\]')
for p in $partitions
do
echo "Pre-wiping $p from kickstart (cgts-vg present)"
dd if=/dev/zero of=$p bs=512 count=34
dd if=/dev/zero of=$p bs=512 count=34 seek=$((`blockdev --getsz $p` - 34))
done
let -i gb=1024*1024*1024
cat<<EOF>/tmp/part-include
clearpart --all --drives=$WIPE_HDD --initlabel
EOF
if [ -n "$ONLYUSE_HDD" ]; then
cat<<EOF>>/tmp/part-include
ignoredisk --only-use=$ONLYUSE_HDD
EOF
fi
if [ -d /sys/firmware/efi ] ; then
cat<<EOF>>/tmp/part-include
part /boot/efi --fstype=efi --size=300 --ondrive=$(get_disk $boot_device)
EOF
else
cat<<EOF>>/tmp/part-include
part biosboot --asprimary --fstype=biosboot --size=1 --ondrive=$(get_disk $boot_device)
EOF
fi

View File

@ -0,0 +1,31 @@
sz=$(blockdev --getsize64 $(get_disk $rootfs_device))
if [ $sz -le $((60*$gb)) ] ; then
LOG_VOL_SIZE=4000
SCRATCH_VOL_SIZE=4000
ROOTFS_SIZE=10000
else
LOG_VOL_SIZE=8000
SCRATCH_VOL_SIZE=8000
ROOTFS_SIZE=20000
fi
ROOTFS_OPTIONS="defaults"
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
if [ -n "$profile_mode" ]; then
# Enable iversion labelling for rootfs when IMA is enabled
ROOTFS_OPTIONS="${ROOTFS_OPTIONS},iversion"
fi
cat<<EOF>>/tmp/part-include
part /boot --fstype=ext4 --asprimary --size=500 --ondrive=$(get_disk $rootfs_device) --fsoptions="$ROOTFS_OPTIONS"
part pv.253004 --grow --asprimary --size=500 --ondrive=$(get_disk $rootfs_device)
volgroup cgts-vg --pesize=32768 pv.253004
logvol /var/log --fstype=ext4 --vgname=cgts-vg --size=$LOG_VOL_SIZE --name=log-lv
logvol /scratch --fstype=ext4 --vgname=cgts-vg --size=$SCRATCH_VOL_SIZE --name=scratch-lv
part / --fstype=ext4 --asprimary --size=$ROOTFS_SIZE --ondrive=$(get_disk $rootfs_device) --fsoptions="$ROOTFS_OPTIONS"
EOF
%end

View File

@ -0,0 +1,6 @@
%packages
@core
@base
xxxPACKAGE_LISTxxx
%end

View File

@ -0,0 +1,8 @@
%packages
@core
@base
-kernel
-kernel-tools
xxxPACKAGE_LISTxxx
%end

34
bsp-files/pkg-list.pl Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/perl
use strict;
#my $file_in = `ls -tr bitbake_build/tmp/work/*/*/*/installed_pkgs.txt |tail -1`;
my $file_in = `ls -tr bitbake_build/tmp/work/intel_x86_64-wrs-linux/wrlinux-image-cgcs-base/*/installed_pkgs.txt |tail -1`;
$file_in = $ARGV[0] if ($ARGV[0] ne "");
open(FILES_IN, $file_in) || die "Could not open list of files";
my %pkgs;
while (<FILES_IN>) {
chop;
my @v = split();
my $pkg = $v[0];
my $arch = $v[1];
# Fix up any lib32 packages
if ($pkg =~ /lib32-(.*)$/) {
$pkg = "$1";
$arch = "lib32_x86";
}
$pkgs{"$pkg.$arch"} = "1";
}
close(FILES_IN);
# Print all packages in sorted unique order with architecture
foreach (sort keys %pkgs) {
if (/(.*)\.(.*)/) {
my $pkg = $1;
my $arch = $2;
print "$pkg $arch\n";
}
}
exit 0;

137
bsp-files/platform_comps.py Normal file
View File

@ -0,0 +1,137 @@
#!/usr/bin/env python
"""
Copyright (c) 2018 Wind River Systems, Inc.
SPDX-License-Identifier: Apache-2.0
"""
import getopt
import os
import platform
import subprocess
import sys
import xml.etree.ElementTree as ElementTree
def usage():
print "Usage: %s --groups <groups.xml> --pkgdir <pkgdir>" \
% os.path.basename(sys.argv[0])
exit(1)
def add_text_tag_to_xml(parent,
name,
text):
"""
Utility function for adding a text tag to an XML object
:param parent: Parent element
:param name: Element name
:param text: Text value
:return:The created element
"""
tag = ElementTree.SubElement(parent, name)
tag.text = text
tag.tail = '\n '
return tag
def add_group(comps, personality, rpmlist=None, filter_dir=None, filter=None):
"""
Add a software group to the comps.xml
:param comps: comps element
:param personality: Personality of node for group
:param rpmlist: List of all rpms in the base load
:param filter_dir: Path to filter files
:param filter: Name of filter file to use
"""
if rpmlist is not None:
# Define a base platform group
groupname = "platform-%s" % personality
desc = "Platform packages for %s" % personality
else:
# Define an empty patch group
groupname = "updates-%s" % personality
desc = "Patches for %s" % personality
group = ElementTree.SubElement(comps, 'group')
group.tail = '\n'
add_text_tag_to_xml(group, 'id', groupname)
add_text_tag_to_xml(group, 'default', "false")
add_text_tag_to_xml(group, 'uservisible', "true")
add_text_tag_to_xml(group, 'display_order', "1024")
add_text_tag_to_xml(group, 'name', groupname)
add_text_tag_to_xml(group, 'description', desc)
package_element = ElementTree.SubElement(group,
'packagelist')
package_element.tail = '\n '
if rpmlist is not None:
# Read the filter file
f = open(os.path.join(filter_dir, filter), 'r')
filtered = f.read().split()
f.close()
for pkg in sorted(rpmlist):
if pkg not in filtered:
tag = ElementTree.SubElement(package_element,
'packagereq',
type="mandatory")
tag.text = pkg
tag.tail = '\n '
def main():
try:
opts, remainder = getopt.getopt(sys.argv[1:],
'',
['pkgdir=',
'groups='])
except getopt.GetoptError:
usage()
pkgdir = None
groups_file = None
# Filters are colocated with this script
filter_dir = os.path.dirname(sys.argv[0])
for opt, arg in opts:
if opt == "--pkgdir":
pkgdir = arg
elif opt == "--groups":
groups_file = arg
if pkgdir is None or groups_file is None:
usage()
# Get the pkglist
cmd = "find %s -name '*.rpm' | xargs rpm -qp --queryformat '%%{NAME}\n'" % pkgdir
rpmlist = subprocess.check_output(cmd, shell=True).split()
tree = ElementTree.parse(groups_file)
comps = tree.getroot()
comps.tail = '\n'
add_group(comps, 'controller', rpmlist, filter_dir, 'filter_out_from_controller')
add_group(comps, 'controller-compute', rpmlist, filter_dir, 'filter_out_from_smallsystem')
add_group(comps, 'controller-compute-lowlatency', rpmlist, filter_dir, 'filter_out_from_smallsystem_lowlatency')
add_group(comps, 'compute', rpmlist, filter_dir, 'filter_out_from_compute')
add_group(comps, 'compute-lowlatency', rpmlist, filter_dir, 'filter_out_from_compute_lowlatency')
add_group(comps, 'storage', rpmlist, filter_dir, 'filter_out_from_storage')
add_group(comps, 'controller')
add_group(comps, 'controller-compute')
add_group(comps, 'controller-compute-lowlatency')
add_group(comps, 'compute')
add_group(comps, 'compute-lowlatency')
add_group(comps, 'storage')
tree.write(groups_file, encoding="UTF-8")
if __name__ == "__main__":
main()

180
bsp-files/pxeboot.cfg Normal file
View File

@ -0,0 +1,180 @@
SERIAL 0 115200
TIMEOUT 100
DEFAULT menu.c32
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
PROMPT 0
NOESCAPE 1
NOCOMPLETE 1
ALLOWOPTIONS 0
label 0
menu label ^1) Boot from hard drive
COM32 chain.c32
APPEND hd0
# Standard Controller menu
menu begin
menu title Standard Controller Configuration
# Serial Console submenu
menu begin
menu title Serial Console
label 1
menu label STANDARD Security Boot Profile
text help
Standard Controller, console=ttyS0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_controller.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text serial console=ttyS0,115200n8 inst.gpt security_profile=standard
ipappend 2
label S1
menu label EXTENDED Security Boot Profile
text help
Standard Controller, console=ttyS0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_controller.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text serial console=ttyS0,115200n8 inst.gpt security_profile=extended
ipappend 2
menu end
# Graphical Console submenu
menu begin
menu title Graphical Console
label 2
menu label STANDARD Security Boot Profile
text help
Standard Controller, console=tty0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_controller.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=standard
ipappend 2
label S2
menu label EXTENDED Security Boot Profile
text help
Standard Controller, console=tty0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_controller.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=extended
ipappend 2
menu end
menu end
# AIO Controller menu
menu begin
menu title All-in-one Controller Configuration
# Serial Console submenu
menu begin
menu title Serial Console
label 3
menu label STANDARD Security Boot Profile
text help
All-in-one Controller, console=ttyS0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text serial console=ttyS0,115200n8 inst.gpt security_profile=standard
ipappend 2
label S3
menu label EXTENDED Security Boot Profile
text help
All-in-one Controller, console=ttyS0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text serial console=ttyS0,115200n8 inst.gpt security_profile=extended
ipappend 2
menu end
# Graphical Console submenu
menu begin
menu title Graphical Console
label 4
menu label STANDARD Security Boot Profile
text help
All-in-one Controller, console=tty0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=standard
ipappend 2
label S4
menu label EXTENDED Security Boot Profile
text help
All-in-one Controller, console=tty0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=extended
ipappend 2
menu end
menu end
# AIO (Low Latency) Controller menu
menu begin
menu title All-in-one (lowlatency) Controller Configuration
# Serial Console submenu
menu begin
menu title Serial Console
label 5
menu label STANDARD Security Boot Profile
text help
All-in-one (lowlatency) Controller, console=ttyS0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem_lowlatency.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=ttyS0,115200n8 inst.gpt security_profile=standard
ipappend 2
label S5
menu label EXTENDED Security Boot Profile
text help
All-in-one (lowlatency) Controller, console=ttyS0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem_lowlatency.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=ttyS0,115200n8 inst.gpt security_profile=extended
ipappend 2
menu end
# Graphical Console submenu
menu begin
menu title Graphical Console
label 6
menu label STANDARD Security Boot Profile
text help
All-in-one (lowlatency) Controller, console=tty0
Standard Security Profile Enabled (default setting)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem_lowlatency.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=standard
ipappend 2
label S6
menu label EXTENDED Security Boot Profile
text help
All-in-one (lowlatency) Controller, console=tty0
Extended Security Profile Enabled (will impact performance)
endtext
kernel vmlinuz
append initrd=initrd.img bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem_lowlatency.cfg boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=extended
ipappend 2
menu end
menu end

104
bsp-files/pxeboot_grub.cfg Normal file
View File

@ -0,0 +1,104 @@
timeout=10
default=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
pxe_root=${root}
menuentry '1) UEFI Boot from hard drive' {
insmod part_gpt
insmod chain
# The EFI bootloader is located in /boot/efi/EFI/centos/
# /boot/efi being the mount
# /dev/sda1 307016 9680 297336 4% /boot/efi
set root=(hd0,gpt1)
chainloader /EFI/centos/grubx64.efi
}
# Standard Controller menu
submenu 'UEFI Standard Controller' {
submenu 'Serial Console' {
menuentry 'STANDARD Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_controller.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text serial console=ttyS0,115200n8 inst.gpt security_profile=standard
initrdefi initrd.img
}
menuentry 'EXTENDED Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_controller.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text serial console=ttyS0,115200n8 inst.gpt security_profile=extended tboot=true
initrdefi initrd.img
}
}
submenu 'Graphical Console' {
menuentry 'STANDARD Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_controller.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=standard
initrdefi initrd.img
}
menuentry 'EXTENDED Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_controller.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=extended tboot=true
initrdefi initrd.img
}
}
}
# AIO Controller menu
submenu 'UEFI All-in-one Controller' {
submenu 'Serial Console' {
menuentry 'STANDARD Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text serial console=ttyS0,115200n8 inst.gpt security_profile=standard
initrdefi initrd.img
}
menuentry 'EXTENDED Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text serial console=ttyS0,115200n8 inst.gpt security_profile=extended tboot=true
initrdefi initrd.img
}
}
submenu 'Graphical Console' {
menuentry 'STANDARD Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=standard
initrdefi initrd.img
}
menuentry 'EXTENDED Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=extended tboot=true
initrdefi initrd.img
}
}
}
# AIO (lowlatency) Controller menu
submenu 'UEFI All-in-one (lowlatency) Controller' {
submenu 'Serial Console' {
menuentry 'STANDARD Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem_lowlatency.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text serial console=ttyS0,115200n8 inst.gpt security_profile=standard
initrdefi initrd.img
}
menuentry 'EXTENDED Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem_lowlatency.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text serial console=ttyS0,115200n8 inst.gpt security_profile=extended tboot=true
initrdefi initrd.img
}
}
submenu 'Graphical Console' {
menuentry 'STANDARD Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem_lowlatency.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=standard
initrdefi initrd.img
}
menuentry 'EXTENDED Security Boot Profile' {
set root=${pxe_root}
linuxefi vmlinuz bootifonly=1 devfs=nomount inst.repo=xxxHTTP_URLxxx inst.ks=xxxHTTP_URLxxx/pxeboot_smallsystem_lowlatency.cfg ksdevice=$net_default_mac BOOTIF=$net_default_mac boot_device=sda rootfs_device=sda biosdevname=0 inst.text console=tty0 inst.gpt security_profile=extended tboot=true
initrdefi initrd.img
}
}
}

111
bsp-files/pxeboot_setup.sh Executable file
View File

@ -0,0 +1,111 @@
#!/bin/bash
OPTIND=1
BASE_URL=""
TFTP_DIR=""
WORKING_DIR=""
COPY_DIR=""
ISODIR=$(dirname `readlink -f $0`)
usage() {
echo "Usage: $0 -u <http base URL> [-t <tftp pxeboot directory>] or [-w <working directory>]" 1>&2;
exit 0;
}
while getopts ":u:t:w:" opt; do
case "$opt" in
u)
BASE_URL=${OPTARG}
;;
t)
TFTP_DIR=${OPTARG}
;;
w)
WORKING_DIR=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "$BASE_URL" ]; then
echo "HTTP base URL is required: -u <http base URL>"
exit 0
fi
if [ -z "$TFTP_DIR" ] && [ -z "$WORKING_DIR" ]; then
echo "Either tftp pxeboot directory or working directory has to be specified:"
echo "-t <tftp pxeboot directory> or -w <working directory>"
exit 0
elif [ -n "$TFTP_DIR" ]; then
if [ -n "$WORKING_DIR" ]; then
echo "tftp pxeboot directory is supplied, working directory will be ignored."
fi
COPY_DIR=$TFTP_DIR
elif [ -n "$WORKING_DIR" ]; then
COPY_DIR=$WORKING_DIR
fi
if [ ! -d ${COPY_DIR} ] ; then
if [ -w "$(dirname $COPY_DIR)" ]; then
echo "Create ${COPY_DIR}"
mkdir ${COPY_DIR}
chmod +w ${COPY_DIR}
if [ $? -ne 0 ]; then
echo "Can't create ${COPY_DIR}"
exit 1
fi
else
echo "$COPY_DIR parent directory is not writeable."
exit 0
fi
else
echo "$COPY_DIR already exists"
exit 0
fi
#Copy the vmlinuz and initrd files to the destination directory
cp ${ISODIR}/vmlinuz ${COPY_DIR}/
cp ${ISODIR}/initrd.img ${COPY_DIR}/
#Copy the contents of distribution to the destination directory
cp -r ${ISODIR}/* ${COPY_DIR}/
#Find the number of directories in the URL
dirpath=$(echo ${BASE_URL#"http://"})
DIRS=$(grep -o "/" <<< "$dirpath" | wc -l)
#Escape path for sed
BASE_URL="${BASE_URL//\//\\/}"
#Copy pxeboot files
mkdir -p ${COPY_DIR}/EFI/centos/x86_64-efi/
cp -Rf ${COPY_DIR}/pxeboot/* ${COPY_DIR}/
#Rename the UEFI grub config
mv ${COPY_DIR}/pxeboot_grub.cfg ${COPY_DIR}/grub.cfg
#Variable replacement
sed -i "s#xxxHTTP_URLxxx#${BASE_URL}#g;
s#xxxHTTP_URL_PATCHESxxx#${BASE_URL}/patches#g;
s#NUM_DIRS#${DIRS}#g" \
${COPY_DIR}/pxeboot.cfg \
${COPY_DIR}/grub.cfg \
${COPY_DIR}/pxeboot_controller.cfg \
${COPY_DIR}/pxeboot_smallsystem.cfg \
${COPY_DIR}/pxeboot_smallsystem_lowlatency.cfg
# Delete unnecessary files
rm -Rf ${COPY_DIR}/EFI/BOOT
rm -Rf ${COPY_DIR}/pxeboot
if [ -n "$TFTP_DIR" ]; then
#Create pxelinux.cfg directory and default link
mkdir ${TFTP_DIR}/pxelinux.cfg
chmod 755 ${TFTP_DIR}/pxelinux.cfg
ln -s ../pxeboot.cfg ${TFTP_DIR}/pxelinux.cfg/default
fi

View File

@ -0,0 +1,64 @@
#!/bin/bash
# Copyright (c) 2015-2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# This script is run during the load-import command
# It is used to copy the required files from the iso to the
# controller.
set -e
exec 2>>/var/log/load-import.log
set -x
echo "$(date): Starting execution: $0 $@"
cleanup() {
rm -rf $TMP_RPM
}
rollback() {
rm -rf $FEED_DIR
}
error() {
local parent_lineno="$1"
local err_code="${2}"
echo "Error executing import script at line: ${parent_lineno} with error code: ${err_code}"
rollback
exit "${err_code}"
}
trap 'error ${LINENO} $?' ERR
trap cleanup 0
SCRIPT_DIR=$(dirname $0)
ISO_DIR=$(dirname $SCRIPT_DIR)
source $SCRIPT_DIR/version
source /etc/build.info
FEED_DIR=/www/pages/feed/rel-$VERSION
CURRENT_FEED_DIR=/www/pages/feed/rel-$SW_VERSION
TMP_RPM=/tmp/cpio
rm -rf $TMP_RPM
rm -rf $FEED_DIR
mkdir -p $FEED_DIR
cp -rp $ISO_DIR/Packages $ISO_DIR/repodata $ISO_DIR/LiveOS $FEED_DIR/
cp -p $CURRENT_FEED_DIR/install_uuid $FEED_DIR/
if [ -d $ISO_DIR/patches ]; then
mkdir -p /www/pages/updates/rel-${VERSION}
cp -r ${ISO_DIR}/patches/Packages ${ISO_DIR}/patches/repodata /www/pages/updates/rel-${VERSION}/
rsync -ac ${ISO_DIR}/patches/metadata/ /opt/patching/metadata/
mkdir -p /opt/patching/packages/${VERSION}
find /www/pages/updates/rel-${VERSION}/Packages -name '*.rpm' \
| xargs --no-run-if-empty -I files cp --preserve=all files /opt/patching/packages/${VERSION}/
fi

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<build>
<version>xxxSW_VERSIONxxx</version>
<supported_upgrades>
<upgrade>
<version>17.06</version>
<required_patch>TC_17.06_PATCH_0001</required_patch>
<required_patch>TC_17.06_PATCH_0002</required_patch>
<required_patch>TC_17.06_PATCH_0003</required_patch>
<required_patch>TC_17.06_PATCH_0004</required_patch>
<required_patch>TC_17.06_PATCH_0005</required_patch>
<required_patch>TC_17.06_PATCH_0006</required_patch>
<required_patch>TC_17.06_PATCH_0007</required_patch>
<required_patch>TC_17.06_PATCH_0008</required_patch>
<required_patch>TC_17.06_PATCH_0009</required_patch>
<required_patch>TC_17.06_PATCH_0010</required_patch>
<required_patch>TC_17.06_PATCH_0011</required_patch>
<required_patch>TC_17.06_PATCH_0012</required_patch>
<required_patch>TC_17.06_PATCH_0013</required_patch>
<required_patch>TC_17.06_PATCH_0014</required_patch>
<required_patch>TC_17.06_PATCH_0015</required_patch>
</upgrade>
</supported_upgrades>
</build>

254
installer/initrd/README Normal file
View File

@ -0,0 +1,254 @@
There are three prebuilt files that we can update when we need to make changes
to the installer:
- vmlinuz - The kernel
- initrd.img - Initial initrd loaded when the installer boots. Has kernel
modules, etc, and loads the squashfs.img
- squashfs.img - Provides the rootfs for the installer, which includes
components like anaconda
The original stock CentOS files are found:
/import/mirrors/CentOS/7.4.1708/os/x86_64/isolinux/initrd.img
/import/mirrors/CentOS/7.4.1708/os/x86_64/LiveOS/squashfs.img
# NOTE: before updating these files, assure that you've had a successful build
for the necessary files used in "kernel-rpms" and "rootfs-rpms".
# here are build procedures:
# kernel, kernel modules will be generated by this step
build-pkgs
# anaconda-*.tis.*.rpm rpm-*.tis*.rpm will be generated by this step
build-srpms --installer && build-rpms --installer
# systemd-*.tis.*.rpm and bind-utils-9.9.4-61.el7.x86_64.rpm, ima-evm-utils-1.0-1.el7.x86_64.rpm
# will be available after this step done
build-iso
===========
vmlinuz:
We're using the runtime kernel for this, so when we update the installer, we
just grab the kernel from build server or your own build environment.
Note -- The kernel to be used should be signed. The Jenkins builds will
produce signed kernels, but if you are concerned about the signature (for
example, if you are concerned that a developer kernel is being used or if
the signing server is behaving odd) then you can verify the integrity of
the kernel by going onto yow-cgts3-lx and using the command:
sbverify --cert [CERT] vmlinuz
The certificate specfied as the argument can be found in
$MY_REPO/addons/wr-cgcs/layers/cgcs/recipes-extended/shim-unsigned/files/tis-shim.crt
===========
initrd.img:
When we update the kernel and kernel modules for the installer, we need to
update the initrd.img. This is a manual procedure currently, and must be done
as **root**.
# First, extract the initrd.img:
ORIG_INITRD=$PWD/initrd.img
mkdir initrd.work
cd initrd.work
xzcat $ORIG_INITRD | cpio -i
# Make the necessary changes, and rebuild the initrd
# We want to include our kernel and required modules in the initrd. Copy their RPMs from
# the Jenkins build or local build folders (~/export/dist/isolinux/Packages/ and ~/std/rpmbuild/RPMS/)
# to ../kernel-rpms, to be extracted with rpm2cpio:
# kernel
# kmod-i40e
# kmod-ixgbe
# kmod-e1000e
# kmod-tpm
# mlnx-ofa_kernel-modules
#
# Also adding in dmidecode for debug purposes
# Delete the old kernel files:
rm -rf boot/ etc/modules-load.d/ etc/ld.so.conf.d/kernel-3.10.0-693.2.2.el7.tis.29.x86_64.conf lib/modules/3.10.0-693.2.2.el7.tis.29.x86_64/
# Extract the RPMs from the build system
# FYI, here are RPMs in "kernel-rpms":
# ls kernel-rpms/
kernel-3.10.0-693.2.2.el7.33.tis.x86_64.rpm kmod-i40e-rt-2.4.3-0.tis.6.x86_64.rpm mlnx-ofa_kernel-4.3-OFED.4.3.1.0.1.1.g8509e41.tis.1.x86_64.rpm
kernel-rt-3.10.0-693.2.2.rt56.623.el7.tis.39.x86_64.rpm kmod-ixgbe-5.2.3-0.tis.2.x86_64.rpm mlnx-ofa_kernel-devel-4.3-OFED.4.3.1.0.1.1.g8509e41.tis.1.x86_64.rpm
kmod-e1000e-3.3.6-0.tis.1.x86_64.rpm kmod-ixgbe-rt-5.2.3-0.tis.2.x86_64.rpm mlnx-ofa_kernel-modules-4.3-OFED.4.3.1.0.1.1.g8509e41.tis.1.x86_64.rpm
kmod-e1000e-rt-3.3.6-0.tis.1.x86_64.rpm kmod-tpm-4.12-0.tis.5.x86_64.rpm
kmod-i40e-2.4.3-0.tis.6.x86_64.rpm kmod-tpm-rt-4.12-0.tis.5.x86_64.rpm
for f in ../kernel-rpms/*.rpm ; do rpm2cpio $f | cpio -idu; done
# In a chroot, run depmods. The command is available from the kmod-i40e for syntax/args:
# [root@yow-cgts4-lx initrd.work]# rpm -qp --scripts ../kernel-rpms/kmod-i40e-* |grep depmod
# /usr/sbin/depmod -aeF "/boot/System.map-3.10.0-327.36.2.el7.9.tis.x86_64" "3.10.0-327.36.2.el7.9.tis.x86_64" > /dev/null || :
# /usr/sbin/depmod -aeF "/boot/System.map-3.10.0-327.36.2.el7.9.tis.x86_64" "3.10.0-327.36.2.el7.9.tis.x86_64" > /dev/null || :
chroot .
# <actual-kernel-version> need be replaced, for example, 3.10.0-693.2.2.el7.33.tis.x86_64
/usr/sbin/depmod -aeF "/boot/System.map-<actual-kernel-version>" "<actual-kernel-version>"
exit
# Remove the bisodevname package from initrd and squashfs
rm -f ./usr/lib/udev/rules.d/71-biosdevname.rules ./usr/sbin/biosdevname
# Rebuild the initrd
find . \
| cpio -o -H newc \
| xz --check=crc32 --x86 --lzma2=dict=512KiB \
> ../new-initrd.img
===========
squashfs.img:
If we want to make changes to the rootfs of the installer (ie. update anaconda),
we need to update the squashfs.img file. This file can be mounted, and contains
a rootfs image: LiveOS/rootfs.img
# Build the TIS-modified installer RPMs first (see anaconda jiggery-pokery at end of this file):
build-srpms --installer && build-rpms --installer
# We also need TIS-built systemd for NVME support, so copy the following from Jenkins build:
systemd-219-42.el7_4.1.tis.10.x86_64.rpm
systemd-libs-219-42.el7_4.1.tis.10.x86_64.rpm
systemd-sysv-219-42.el7_4.1.tis.10.x86_64.rpm
# We need to update the following RPMs in the rootfs
ima-evm-utils-1.0-1.el7.x86_64.rpm
rpm-4.14.0-1.tis.1.x86_64.rpm
rpm-build-4.14.0-1.tis.1.x86_64.rpm
rpm-build-libs-4.14.0-1.tis.1.x86_64.rpm
rpm-libs-4.14.0-1.tis.1.x86_64.rpm
rpm-plugin-systemd-inhibit-4.14.0-1.tis.1.x86_64.rpm
rpm-python-4.14.0-1.tis.1.x86_64.rpm
# We also now need bind-utils in the squashfs, due to the anaconda-preexec we've added.
bind-utils-9.9.4-51.el7.x86_64.rpm
# Mount the squashfs.img and copy the rootfs out:
ORIG_SQUASHFS=$PWD/squashfs.img
mkdir squashfs.mnt
mount -o loop -t squashfs $ORIG_SQUASHFS squashfs.mnt
mkdir LiveOS
cp squashfs.mnt/LiveOS/rootfs.img LiveOS/
umount squashfs.mnt
# Now mount the rootfs.img file:
mkdir squashfs.work
mount -o loop LiveOS/rootfs.img squashfs.work
cd squashfs.work
# You can now make changes as needed, and they're reflected in the rootfs.img
# For anaconda, ignore these RPMs that are built:
# anaconda-debuginfo
# anaconda-dracut
# anaconda-widgets-devel
# anaconda-gui
#
# FYI, here are RPMs from "rootfs-rpms":
ls rootfs-rpms/
anaconda-21.48.22.121-1.el7.centos.tis.5.x86_64.rpm rpm-4.14.0-1.tis.1.x86_64.rpm
anaconda-core-21.48.22.121-1.el7.centos.tis.5.x86_64.rpm rpm-build-4.14.0-1.tis.1.x86_64.rpm
anaconda-debuginfo-21.48.22.121-1.el7.centos.tis.5.x86_64.rpm rpm-build-libs-4.14.0-1.tis.1.x86_64.rpm
anaconda-dracut-21.48.22.121-1.el7.centos.tis.5.x86_64.rpm rpm-libs-4.14.0-1.tis.1.x86_64.rpm
anaconda-gui-21.48.22.121-1.el7.centos.tis.5.x86_64.rpm rpm-plugin-systemd-inhibit-4.14.0-1.tis.1.x86_64.rpm
anaconda-tui-21.48.22.121-1.el7.centos.tis.5.x86_64.rpm rpm-python-4.14.0-1.tis.1.x86_64.rpm
anaconda-widgets-21.48.22.121-1.el7.centos.tis.5.x86_64.rpm systemd-219-42.el7_4.1.tis.10.x86_64.rpm
anaconda-widgets-devel-21.48.22.121-1.el7.centos.tis.5.x86_64.rpm systemd-libs-219-42.el7_4.1.tis.10.x86_64.rpm
bind-utils-9.9.4-61.el7.x86_64.rpm systemd-sysv-219-42.el7_4.1.tis.10.x86_64.rpm
ima-evm-utils-1.0-1.el7.x86_64.rpm
# IMPORTANT Note: when copying “systemd-219-42.el7_4.1.tis.10.x86_64.rpm” from build target folders to “rootfs-rpms”,
# we need to get it from “../export/dist/isolinux/Packages/systemd-219-42.el7_4.1.tis.10.x86_64.rpm”, instead of other
# folders (for example, ../std/rpmbuild/RPMS/systemd-219-42.el7_4.1.tis.10.x86_64.rpm), they are actually having
# different sizes and delta in contents.
# Extract the rest into the squashfs
rm -rf usr/lib64/python2.7/site-packages/pyanaconda/
rm -rf usr/lib64/python2.7/site-packages/rpm/
# get files from RPMs and copy them into corresponding folders
for f in ../rootfs-rpms/*.rpm ; do rpm2cpio $f | cpio -idu; done
#find old .pyo files and delete them
find usr/lib64/python2.7/site-packages/pyanaconda/ usr/lib64/python2.7/site-packages/rpm/ -name *.pyo | xargs rm
# IMPORTANT Note, please do NOT forget the following step:
# MUST HAVE!!! Update the kernel and related kernel modules, same as what was done for "initrd.img" updating
for f in ../kernel-rpms/*.rpm ; do rpm2cpio $f | cpio -idu; done
# Remove the bisodevname package from initrd and squashfs
rm -f ./usr/lib/udev/rules.d/71-biosdevname.rules ./usr/sbin/biosdevname
cd ..
umount squashfs.work
# Build/rebuild a new squashfs.img (output file is test.squashfs.img in this
# example)
# Note: You may need to install "squashfs-tools" in advance
#remove the old version named test.squashfs.img
rm -f test.squashfs.img
#make the new squashfs image named "test.squashfs.img" or another name
mksquashfs LiveOS test.squashfs.img -keep-as-directory -comp xz -b 1M
===========
To test with design build, update the following files with paths to your test
files and filenames:
recipes-installer/pxe-network-installer/centos/build_srpm.data
recipes-installer/pxe-network-installer/centos/pxe-network-installer.spec
===========
Delivering changes:
Copy the updated vmlinuz (from kernel rpm), initrd.img, and squashfs.img files,
with appropriate version suffixes, to mirror folder where you placethese files.
Update the pxe-network-installer files to point to the new versions.
===========
NOTE: The following jiggery-pokery is no longer required after recent mirror updates.
I'm keeping the text here, though, for future reference. Just in case.
Jiggery-pokery required to build anaconda after rebase to 7.3:
The anaconda build reports a dependency error:
12:45:41 Error: Package: libgudev1-219-19.el7_2.13.x86_64 (TisCentos7Distro)
12:45:41 Requires: systemd-libs = 219-19.el7_2.13
12:45:41 Installed: systemd-libs-219-30.el7_3.6.x86_64 (@TisCentos7Distro)
12:45:41 systemd-libs = 219-30.el7_3.6
12:45:41 Available: systemd-libs-219-19.el7_2.13.x86_64 (TisCentos7Distro)
12:45:41 systemd-libs = 219-19.el7_2.13
12:45:41 You could try using --skip-broken to work around the problem
12:45:41 You could try running: rpm -Va --nofiles --nodigest
Our build system is setup to install the highest versions of packages, but there's a dependency
that has a version-specific dependency to an older version of the RPM, so it requires a little
massaging to get the anaconda RPM to build.
Step 1: Add a symlink into the cgcs-centos-repo dir:
ln -s /import/mirrors/CentOS/tis-r4-CentOS/mitaka/Binary/x86_64/systemd-libs-219-19.el7_2.13.x86_64.rpm \
$MY_REPO/cgcs-centos-repo/Binary/x86_64/
Step 2: Try to build, so the repodata is updated (this will still fail)
build-srpms --installer && build-rpms --installer
Step 3: Short-circuit the update_cgcs_repo function in build-rpms to avoid repodata update and mock env clearout
Step 4: Manually install RPM in mock env
mock -r installer/${MY_BUILD_ENVIRONMENT}-installer.cfg --copyin systemd-libs-219-19.el7_2.13.x86_64.rpm systemd-libs-219-19.el7_2.13.x86_64.rpm
mock -r installer/${MY_BUILD_ENVIRONMENT}-installer.cfg --shell
rpm -i --force systemd-libs-219-19.el7_2.13.x86_64.rpm
Step 5: Build with success!
build-srpms --installer && build-rpms --installer

View File

@ -0,0 +1,12 @@
COPY_LIST="pxe-network-installer//* \
$CGCS_BASE/mwa-beas/bsp-files/grub.cfg \
$CGCS_BASE/mwa-beas/bsp-files/kickstarts/post_clone_iso_ks.cfg \
$SRC_BASE/cgcs-centos-repo/Binary/images/efiboot.img \
/import/mirrors/CentOS/tis-installer/initrd.img-stx-0.1 \
/import/mirrors/CentOS/tis-installer/squashfs.img-stx-0.1 \
/import/mirrors/CentOS/tis-installer/vmlinuz-stx-0.1 \
"
TIS_PATCH_VER=25
BUILD_IS_BIG=4
BUILD_IS_SLOW=4

View File

@ -0,0 +1,155 @@
Summary: TIS Network Installation
Name: pxe-network-installer
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
%define tis_image_version stx-0.1
Source0: LICENSE
Source001: vmlinuz-%{tis_image_version}
Source002: initrd.img-%{tis_image_version}
Source003: squashfs.img-%{tis_image_version}
Source010: pxeboot-update.sh
Source011: grub.cfg
Source012: efiboot.img
Source013: post_clone_iso_ks.cfg
Source030: default
Source031: default.static
Source032: centos-pxe-controller-install
Source033: centos-pxe-compute-install
Source034: centos-pxe-smallsystem-install
Source035: centos-pxe-storage-install
Source036: centos-pxe-compute_lowlatency-install
Source037: centos-pxe-smallsystem_lowlatency-install
Source050: pxe-grub.cfg
Source051: pxe-grub.cfg.static
Source052: efi-centos-pxe-controller-install
Source053: efi-centos-pxe-compute-install
Source054: efi-centos-pxe-smallsystem-install
Source055: efi-centos-pxe-storage-install
Source056: efi-centos-pxe-compute_lowlatency-install
Source057: efi-centos-pxe-smallsystem_lowlatency-install
BuildRequires: syslinux
BuildRequires: grub2
Requires: grub2-efi-pxeboot
%description
TIS Network Installation
%files
%defattr(-,root,root,-)
%install
install -v -d -m 755 %{buildroot}/pxeboot
install -v -d -m 755 %{buildroot}/pxeboot/pxelinux.cfg.files
install -v -d -m 755 %{buildroot}/pxeboot/rel-%{platform_release}
install -v -d -m 755 %{buildroot}/pxeboot/EFI
install -v -d -m 755 %{buildroot}/pxeboot/EFI/centos
install -v -d -m 755 %{buildroot}/pxeboot/EFI/centos/x86_64-efi
install -v -m 644 %{_sourcedir}/vmlinuz-%{tis_image_version} \
%{buildroot}/pxeboot/rel-%{platform_release}/installer-bzImage_1.0
install -v -m 644 %{_sourcedir}/initrd.img-%{tis_image_version} \
%{buildroot}/pxeboot/rel-%{platform_release}/installer-intel-x86-64-initrd_1.0
ln -s installer-bzImage_1.0 %{buildroot}/pxeboot/rel-%{platform_release}/installer-bzImage
ln -s installer-intel-x86-64-initrd_1.0 %{buildroot}/pxeboot/rel-%{platform_release}/installer-initrd
install -v -D -m 644 %{_sourcedir}/squashfs.img-%{tis_image_version} \
%{buildroot}/www/pages/feed/rel-%{platform_release}/LiveOS/squashfs.img
install -v -d -m 755 %{buildroot}%{_sbindir}
install -v -m 755 %{_sourcedir}/pxeboot-update.sh %{buildroot}%{_sbindir}/pxeboot-update-%{platform_release}.sh
install -v -m 644 %{_sourcedir}/post_clone_iso_ks.cfg \
%{buildroot}/pxeboot/post_clone_iso_ks.cfg
install -v -m 644 %{_sourcedir}/default \
%{buildroot}/pxeboot/pxelinux.cfg.files/default
install -v -m 644 %{_sourcedir}/default.static \
%{buildroot}/pxeboot/pxelinux.cfg.files/default.static
install -v -m 644 %{_sourcedir}/centos-pxe-controller-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/pxe-controller-install-%{platform_release}
install -v -m 644 %{_sourcedir}/centos-pxe-compute-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/pxe-compute-install-%{platform_release}
install -v -m 644 %{_sourcedir}/centos-pxe-smallsystem-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/pxe-smallsystem-install-%{platform_release}
install -v -m 644 %{_sourcedir}/centos-pxe-storage-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/pxe-storage-install-%{platform_release}
install -v -m 644 %{_sourcedir}/centos-pxe-compute_lowlatency-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/pxe-compute_lowlatency-install-%{platform_release}
install -v -m 644 %{_sourcedir}/centos-pxe-smallsystem_lowlatency-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/pxe-smallsystem_lowlatency-install-%{platform_release}
# UEFI support
install -v -m 644 %{_sourcedir}/pxe-grub.cfg \
%{buildroot}/pxeboot/pxelinux.cfg.files/grub.cfg
install -v -m 644 %{_sourcedir}/pxe-grub.cfg.static \
%{buildroot}/pxeboot/pxelinux.cfg.files/grub.cfg.static
# Copy EFI boot image. It will be used to create ISO on the Controller.
install -v -m 644 %{_sourcedir}/efiboot.img \
%{buildroot}/pxeboot/rel-%{platform_release}/
install -v -m 644 %{_sourcedir}/efi-centos-pxe-controller-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/efi-pxe-controller-install-%{platform_release}
install -v -m 644 %{_sourcedir}/efi-centos-pxe-compute-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/efi-pxe-compute-install-%{platform_release}
install -v -m 644 %{_sourcedir}/efi-centos-pxe-smallsystem-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/efi-pxe-smallsystem-install-%{platform_release}
install -v -m 644 %{_sourcedir}/efi-centos-pxe-storage-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/efi-pxe-storage-install-%{platform_release}
install -v -m 644 %{_sourcedir}/efi-centos-pxe-compute_lowlatency-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/efi-pxe-compute_lowlatency-install-%{platform_release}
install -v -m 644 %{_sourcedir}/efi-centos-pxe-smallsystem_lowlatency-install \
%{buildroot}/pxeboot/pxelinux.cfg.files/efi-pxe-smallsystem_lowlatency-install-%{platform_release}
sed -i "s/xxxSW_VERSIONxxx/%{platform_release}/g" \
%{buildroot}/pxeboot/pxelinux.cfg.files/pxe-* \
%{buildroot}/pxeboot/pxelinux.cfg.files/efi-pxe-*
# Copy files from the syslinux pkg
install -v -m 0644 \
%{_datadir}/syslinux/menu.c32 \
%{_datadir}/syslinux/vesamenu.c32 \
%{_datadir}/syslinux/chain.c32 \
%{_datadir}/syslinux/linux.c32 \
%{_datadir}/syslinux/reboot.c32 \
%{_datadir}/syslinux/pxechain.com \
%{_datadir}/syslinux/pxelinux.0 \
%{_datadir}/syslinux/gpxelinux.0 \
%{buildroot}/pxeboot
# Copy files from grub2. Centos UEFI bootloader expect these files
install -v -m 0644 \
%{_prefix}/lib/grub/i386-pc/command.lst \
%{_prefix}/lib/grub/i386-pc/fs.lst \
%{_prefix}/lib/grub/i386-pc/crypto.lst \
%{_prefix}/lib/grub/i386-pc/terminal.lst \
%{buildroot}/pxeboot/EFI/centos/x86_64-efi
# Copy Titanium grub.cfg. It will be used to create ISO on the Controller.
install -v -m 0644 %{_sourcedir}/grub.cfg \
%{buildroot}/pxeboot/EFI/
# UEFI bootloader expect the grub.cfg file to be in /pxeboot/ so create a symlink for it
ln -s pxelinux.cfg/grub.cfg %{buildroot}/pxeboot/grub.cfg
%files
%license ../SOURCES/LICENSE
%defattr(-,root,root,-)
%dir /pxeboot
/pxeboot/*
%{_sbindir}/pxeboot-update-%{platform_release}.sh
/www/pages/feed/rel-%{platform_release}/LiveOS/squashfs.img

View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,27 @@
SERIAL 0 115200
TIMEOUT 50
DEFAULT menu.c32
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
PROMPT 0
NOESCAPE 1
NOCOMPLETE 1
ALLOWOPTIONS 0
LABEL 1
MENU LABEL ^1) Compute
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_compute_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -0,0 +1,27 @@
SERIAL 0 115200
TIMEOUT 50
DEFAULT menu.c32
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
PROMPT 0
NOESCAPE 1
NOCOMPLETE 1
ALLOWOPTIONS 0
LABEL 1
MENU LABEL ^1) Lowlatency Compute
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_compute_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -0,0 +1,27 @@
SERIAL 0 115200
TIMEOUT 50
DEFAULT menu.c32
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
PROMPT 0
NOESCAPE 1
NOCOMPLETE 1
ALLOWOPTIONS 0
LABEL 1
MENU LABEL ^1) Standard Controller
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_controller_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -0,0 +1,27 @@
SERIAL 0 115200
TIMEOUT 50
DEFAULT menu.c32
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
PROMPT 0
NOESCAPE 1
NOCOMPLETE 1
ALLOWOPTIONS 0
LABEL 1
MENU LABEL ^1) All-in-one
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -0,0 +1,27 @@
SERIAL 0 115200
TIMEOUT 50
DEFAULT menu.c32
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
PROMPT 0
NOESCAPE 1
NOCOMPLETE 1
ALLOWOPTIONS 0
LABEL 1
MENU LABEL ^1) All-in-one (lowlatency)
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -0,0 +1,27 @@
SERIAL 0 115200
TIMEOUT 50
DEFAULT menu.c32
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
PROMPT 0
NOESCAPE 1
NOCOMPLETE 1
ALLOWOPTIONS 0
LABEL 1
MENU LABEL ^1) Storage
MENU DEFAULT
KERNEL rel-xxxSW_VERSIONxxx/installer-bzImage
APPEND initrd=rel-xxxSW_VERSIONxxx/installer-initrd bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_storage_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 xxxAPPEND_OPTIONSxxx
IPAPPEND 2

View File

@ -0,0 +1,38 @@
SERIAL 0 115200
TIMEOUT 100
DEFAULT menu.c32
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
MENU AUTOBOOT Automatic retry in # seconds
MENU COLOR UNSEL 36;44
MENU COLOR SEL 36;44
MENU COLOR DISABLED 36;44
PROMPT 0
NOESCAPE 1
NOCOMPLETE 1
ALLOWOPTIONS 0
MENU SEPARATOR
LABEL Waiting for this node to be configured.
MENU DISABLE
MENU SEPARATOR
LABEL Please configure the personality for this node from the
MENU DISABLE
LABEL controller node in order to proceed.
MENU DEFAULT
KERNEL pxelinux.0

View File

@ -0,0 +1,47 @@
SERIAL 0 115200
TIMEOUT 100
DEFAULT menu.c32
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
MENU AUTOBOOT Automatic retry in # seconds
MENU COLOR UNSEL 36;44
MENU COLOR SEL 36;44
MENU COLOR DISABLED 36;44
PROMPT 0
NOESCAPE 1
NOCOMPLETE 1
ALLOWOPTIONS 0
MENU SEPARATOR
LABEL Waiting for this node to be configured.
MENU DISABLE
MENU SEPARATOR
LABEL This system has been configured with static management
MENU DISABLE
LABEL and infrastructure IP address allocation. This requires
MENU DISABLE
LABEL that the node be manually provisioned in System
MENU DISABLE
LABEL Inventory using the 'system host-add' CLI, GUI, or
MENU DISABLE
LABEL sysinv-api equivalent.
MENU DISABLE
KERNEL pxelinux.0

View File

@ -0,0 +1,9 @@
default=0
timeout=10
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI Compute' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_compute_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -0,0 +1,9 @@
default=0
timeout=10
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI Lowlatency Compute' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_compute_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -0,0 +1,9 @@
default=0
timeout=10
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI Standard Controller' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_controller_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -0,0 +1,9 @@
default=0
timeout=10
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI All-in-one' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -0,0 +1,9 @@
default=0
timeout=10
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI All-in-one (lowlatency)' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_smallsystem_lowlatency_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -0,0 +1,9 @@
default=0
timeout=10
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
menuentry '1) UEFI Storage' {
linuxefi rel-xxxSW_VERSIONxxx/installer-bzImage bootifonly=1 devfs=nomount inst.repo=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/ inst.ks=http://pxecontroller/feed/rel-xxxSW_VERSIONxxx/net_storage_ks.cfg usbcore.autosuspend=-1 biosdevname=0 rd.net.timeout.dhcp=120 ksdevice=$net_default_mac BOOTIF=$net_default_mac xxxAPPEND_OPTIONSxxx
initrdefi rel-xxxSW_VERSIONxxx/installer-initrd
}

View File

@ -0,0 +1,56 @@
default=0
# If the default menu fails then menu entry 5 is used.
fallback=5
timeout=10
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
mac=$net_default_mac
# net_default_mac is the network interface that was used to load grub.
# We need to convert from 01:00:1e:67:56:9d:c1 to 01-00-1e-67-56-9d-c1 to
# match the config file format.
regexp --set=new '(^..)' "$mac"
conf=$new
regexp --set=new '^.{3}(.{2})' "$mac"
conf=$conf-$new
regexp --set=new '^.{6}(.{2})' "$mac"
conf=$conf-$new
regexp --set=new '^.{9}(.{2})' "$mac"
conf=$conf-$new
regexp --set=new '^.{12}(.{2})' "$mac"
conf=$conf-$new
regexp --set=new '^.{15}(.{2})' "$mac"
conf=$conf-$new
# First try to load the mac config, if it does not exist yet (its created when a
# personality is assigned to a node) then grub.conf is loaded again. We timeout
# for 10 sec between re-tries.
# Menu 0
menuentry 'Waiting for this node to be configured.' {
insmod net
insmod efinet
configfile pxelinux.cfg/efi-01-$conf
}
menuentry ' ' {
echo " "
}
menuentry 'Please configure the personality for this node from the' {
echo " "
}
menuentry 'controller node in order to proceed.' {
echo " "
}
menuentry ' ' {
echo " "
}
# Menu 5
menuentry 'Node not configured.' {
insmod net
insmod efinet
configfile grub.cfg
}

View File

@ -0,0 +1,70 @@
default=0
# If the default menu fails then menu entry 8 is used.
fallback=8
timeout=10
GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT_STYLE='countdown'
mac=$net_default_mac
# net_default_mac is the network interface that was used to load grub.
# We need to convert from 01:00:1e:67:56:9d:c1 to 01-00-1e-67-56-9d-c1 to
# match the config file format.
regexp --set=new '(^..)' "$mac"
conf=$new
regexp --set=new '^.{3}(.{2})' "$mac"
conf=$conf-$new
regexp --set=new '^.{6}(.{2})' "$mac"
conf=$conf-$new
regexp --set=new '^.{9}(.{2})' "$mac"
conf=$conf-$new
regexp --set=new '^.{12}(.{2})' "$mac"
conf=$conf-$new
regexp --set=new '^.{15}(.{2})' "$mac"
conf=$conf-$new
# First try to load the mac config, if it does not exist yet (its created when a
# personality is assigned to a node) then grub.conf is loaded again. We timeout
# for 10 sec between re-tries.
# Menu 0
menuentry 'Waiting for this node to be configured.' {
insmod net
insmod efinet
configfile pxelinux.cfg/efi-01-$conf
}
menuentry ' ' {
echo " "
}
menuentry 'This system has been configured with static management' {
echo " "
}
menuentry 'and infrastructure IP address allocation. This requires' {
echo " "
}
menuentry 'that the node be manually provisioned in System' {
echo " "
}
menuentry "Inventory using the 'system host-add' CLI, GUI, or" {
echo " "
}
# Menu 6
menuentry 'sysinv-api equivalent.' {
echo " "
}
# Menu 7
menuentry ' ' {
echo " "
}
# Menu 8
menuentry 'Node not configured.' {
insmod net
insmod efinet
configfile grub.cfg
}

View File

@ -0,0 +1,172 @@
#!/bin/bash
#
# Copyright (c) 2016-2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# Using a specified template, generate a node-specific pxeboot.cfg file
# for BIOS and UEFI mode. This script logs to user.log
#
# Command example;
# /usr/sbin/pxeboot-update-18.03.sh -i /pxeboot/pxelinux.cfg.files/pxe-controller-install-18.03
# -o /pxeboot/pxelinux.cfg/01-08-00-27-3e-f8-05 -b sda -r sda -t -c ttyS0,115200
#
function usage()
{
cat >&2 <<EOF
$0: This utility is used to generate a node-specific pxeboot.cfg file
Arguments:
-i <input template> : Specify template to use
-o <output file> : Specify output filename
-t : Use text install (optional)
-g : Use graphical install (optional)
-c <console> : Specify serial console (optional)
-b <boot device> : Specify boot device
-r <rootfs device> : Specify rootfs device
-u <tisnotify url> : Base url for TIS install progress notification
-s <mode> : Specify Security Profile mode (optional)
-T <tboot value> : Specify whether or not to use tboot (optional)
EOF
}
declare text_install="inst.text"
function generate_config()
{
input=$1
output=$2
if [ ! -f "$input" ]
then
logger --stderr -t $0 "Error: Input file $input does not exist"
exit 1
fi
if [ ! -w $(dirname $output) ]
then
logger --stderr -t $0 "Error: Destination directory $(dirname $output) not writeable"
exit 1
fi
if [ -e $output -a ! -w $output ]
then
logger --stderr -t $0 "Error: Destination file $output_file_efi exists and is not writeable"
exit 1
fi
sed -e "s#xxxAPPEND_OPTIONSxxx#$APPEND_OPTIONS#" $input > $output
if [ $? -ne 0 -o ! -f $output ]
then
logger --stderr -t $0 "Error: Failed to generate pxeboot file $output"
exit 1
fi
}
parms=$@
logger -t $0 " $parms"
while getopts "i:o:tgc:b:r:u:s:T:h" opt
do
case $opt in
i)
input_file=$OPTARG
input_file_efi=$(dirname $input_file)/efi-$(basename $input_file)
;;
o)
output_file=$OPTARG
output_file_efi=$(dirname $output_file)/efi-$(basename $output_file)
;;
t)
text_install="inst.text"
;;
g)
# We currently do not support Graphics install with Centos. Enforce
# the text install.
# text_install="inst.graphical"
text_install="inst.text"
;;
c)
console=$OPTARG
;;
b)
boot_device=$OPTARG
;;
r)
rootfs_device=$OPTARG
;;
u)
tisnotify=$OPTARG
;;
s)
security_profile=$OPTARG
;;
T)
tboot=$OPTARG
;;
h)
usage
exit 1
;;
*)
usage
exit 1
;;
esac
done
# Validate parameters
if [ -z "$input_file" \
-o -z "$input_file_efi" \
-o -z "$output_file" \
-o -z "$output_file_efi" \
-o -z "$boot_device" \
-o -z "$rootfs_device" ]
then
logger --stderr -t $0 "Error: One or more mandatory options not specified: $@"
usage
exit 1
fi
APPEND_OPTIONS="boot_device=$boot_device rootfs_device=$rootfs_device"
if [ -n "$text_install" ]
then
APPEND_OPTIONS="$APPEND_OPTIONS $text_install"
fi
if [ -n "$console" ]
then
APPEND_OPTIONS="$APPEND_OPTIONS console=$console"
fi
if [ -n "$tisnotify" ]
then
APPEND_OPTIONS="$APPEND_OPTIONS tisnotify=$tisnotify"
fi
# We now require GPT partitions for all disks regardless of size
APPEND_OPTIONS="$APPEND_OPTIONS inst.gpt"
if [ -n "$security_profile" ]
then
APPEND_OPTIONS="$APPEND_OPTIONS security_profile=$security_profile"
fi
generate_config $input_file $output_file
# for extended security profile UEFI boot only,
# a tboot option will be passed to target boot option menu
if [ "$security_profile" == "extended" -a -n "$tboot" ]
then
APPEND_OPTIONS="$APPEND_OPTIONS tboot=$tboot"
fi
generate_config $input_file_efi $output_file_efi
exit 0

202
kickstart/LICENSE Executable file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,3 @@
SRC_DIR="${CGCS_BASE}/mwa-beas/bsp-files"
COPY_LIST="$PKG_BASE/LICENSE"
TIS_PATCH_VER=0

View File

@ -0,0 +1,64 @@
Name: platform-kickstarts
Version: 1.0.0
Release: %{tis_patch_ver}%{?_tis_dist}
Summary: Platform Kickstarts
License: Apache-2.0
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: %{name}-%{version}.tar.gz
Source1: LICENSE
BuildArch: noarch
%description
Platform kickstart files
BuildRequires: perl
BuildRequires: perl(Getopt::Long)
BuildRequires: perl(POSIX)
%define feed_dir /www/pages/feed/rel-%{platform_release}
%prep
%setup
%build
./centos-ks-gen.pl --release %{platform_release}
cp %{SOURCE1} .
%install
install -d -m 0755 %{buildroot}%{feed_dir}
install -m 0444 generated/* %{buildroot}%{feed_dir}/
install -d -m 0755 %{buildroot}/pxeboot
install -D -m 0444 pxeboot/* %{buildroot}/pxeboot
install -d -m 0755 %{buildroot}/extra_cfgs
install -D -m 0444 extra_cfgs/* %{buildroot}/extra_cfgs
%files
%defattr(-,root,root,-)
%license LICENSE
%{feed_dir}
%package pxeboot
Summary: Kickstarts for pxeboot server
%description pxeboot
Kickstarts for pxeboot server
%files pxeboot
%defattr(-,root,root,-)
/pxeboot/
%package extracfgs
Summary: Extra lab-usage kickstarts
%description extracfgs
Extra lab-usage kickstarts
%files extracfgs
%defattr(-,root,root,-)
/extra_cfgs/

202
mtce-common/LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

16
mtce-common/PKG-INFO Normal file
View File

@ -0,0 +1,16 @@
Metadata-Version: 1.1
Name: cgts-mtce-common
Version: 1.0
Summary: Titanium Cloud Platform Common Node Maintenance Package
Home-page:
Author: Windriver
Author-email: info@windriver.com
License: Apache-2.0
Description: Maintenance common package containing host maintenace and heatbeat
agent/client daemons as well as the hardware and process monitor
daemons, hardware watchdog process, guest heartbeat agent/client
daemons, resource and file system daemons as well as initialization
and support files for each.
Platform: UNKNOWN

View File

@ -0,0 +1,3 @@
SRC_DIR="cgts-mtce-common-1.0"
TIS_PATCH_VER=133
BUILD_IS_SLOW=5

View File

@ -0,0 +1,768 @@
Summary: Titanuim Server Common Maintenance Package
Name: cgts-mtce-common
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: %{name}-%{version}.tar.gz
BuildRequires: libssh2
BuildRequires: libssh2-devel
BuildRequires: json-c
BuildRequires: json-c-devel
BuildRequires: fm-common
BuildRequires: fm-common-dev
BuildRequires: openssl
BuildRequires: openssl-devel
BuildRequires: libevent
BuildRequires: libevent-devel
BuildRequires: fm-mgr
BuildRequires: expect
BuildRequires: postgresql
BuildRequires: libuuid-devel
BuildRequires: guest-client-devel
BuildRequires: systemd-devel
BuildRequires: cppcheck
Requires: util-linux
Requires: /bin/bash
Requires: /bin/systemctl
Requires: dpkg
Requires: time
Requires: cgts-mtce-common-rmon >= 1.0
Requires: libevent-2.0.so.5()(64bit)
Requires: expect
Requires: libfmcommon.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.14)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.9)(64bit)
Requires: fm-common >= 1.0
Requires: libamon.so.1()(64bit)
Requires: libc.so.6(GLIBC_2.2.5)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
Requires: /bin/sh
Requires: cgts-mtce-common-pmon >= 1.0
Requires: librt.so.1()(64bit)
Requires: libc.so.6(GLIBC_2.3)(64bit)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Requires: libjson-c.so.2()(64bit)
Requires: libpthread.so.0(GLIBC_2.2.5)(64bit)
Requires: librmonapi.so.1()(64bit)
Requires: librt.so.1(GLIBC_2.3.3)(64bit)
Requires: libgcc_s.so.1(GCC_3.0)(64bit)
Requires: libstdc++.so.6(CXXABI_1.3)(64bit)
Requires: libevent >= 2.0.21
Requires: librt.so.1(GLIBC_2.2.5)(64bit)
Requires: libuuid.so.1()(64bit)
Requires: libm.so.6()(64bit)
Requires: rtld(GNU_HASH)
Requires: libstdc++.so.6()(64bit)
Requires: libc.so.6(GLIBC_2.4)(64bit)
Requires: libc.so.6()(64bit)
Requires: libssh2.so.1()(64bit)
Requires: libgcc_s.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Requires: libpthread.so.0()(64bit)
Requires: /usr/bin/expect
Requires: python-rtslib
%description
Titanium Cloud Host Maintenance services. A suite of daemons that provide
host maintainability and a high level of fault detection with automatic
notification and recovery.The Maintenance Service (mtcAgent/mtcClient)
manages hosts according to an abbreviated version of the CCITT X.731 ITU
specification. The Heartbeat Service (hbsAgent/hbsClient) adds fast failure
detection over the management and infstructure networks. The Process
Monitor service (pmond) add both passive and active process monitoring and
automatic recovery of stopped or killed processes. The File System Monitor
Service (fsmond) adds detection and reporting of local file system
problems. The Hardware Monitor Service (hwmond) adds present and predictive
hardware failure detection, reporting and recovery. The Resource Monitor
Service (rmond) adds resource monitoring with present and predictive
failure and overload detection and reporting. The Guest Services
(guestAgent/guestServer) daemons control access into and heartbeat of guest
VMs on the compute. The Host Watchdog (hostwd) daemon watches for errors in
pmond and logs system information on error. All of these maintenance
services improve MTTD of node failures as well as resource overload and out
of spec operating conditions that can reduce outage time through automated
notification and recovery thereby improving overall platform availability
for the customer.
%package -n cgts-mtce-common-pmon
Summary: Titanuim Server Maintenance Process Monitor Package
Group: base
BuildRequires: cppcheck
Requires: util-linux
Requires: /bin/bash
Requires: /bin/systemctl
Requires: dpkg
Requires: time
Requires: libstdc++.so.6(CXXABI_1.3)(64bit)
Requires: libfmcommon.so.1()(64bit)
Requires: libc.so.6(GLIBC_2.7)(64bit)
Requires: fm-common >= 1.0
Requires: libc.so.6(GLIBC_2.2.5)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
Requires: /bin/sh
Requires: librt.so.1()(64bit)
Requires: libc.so.6(GLIBC_2.3)(64bit)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Requires: libpthread.so.0(GLIBC_2.2.5)(64bit)
Requires: librt.so.1(GLIBC_2.3.3)(64bit)
Requires: libgcc_s.so.1(GCC_3.0)(64bit)
Requires: librt.so.1(GLIBC_2.2.5)(64bit)
Requires: libm.so.6()(64bit)
Requires: rtld(GNU_HASH)
Requires: libstdc++.so.6()(64bit)
Requires: libc.so.6(GLIBC_2.4)(64bit)
Requires: libc.so.6()(64bit)
Requires: libgcc_s.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Requires: libpthread.so.0()(64bit)
Provides: libamon.so.1()(64bit)
%description -n cgts-mtce-common-pmon
Titanium Cloud Maintenance Process Monitor service (pmond) with
passive (pid), active (msg) and status (qry) process monitoring with
automatic recovery and failure reporting of registered failed processes.
%package -n cgts-mtce-common-rmon
Summary: Titanuim Server Maintenance Resource Monitor Package
Group: base
Requires: /bin/bash
Requires: util-linux
Requires: /bin/systemctl
Requires: dpkg
Requires: time
Requires: libjson-c.so.2()(64bit)
Requires: libstdc++.so.6(CXXABI_1.3)(64bit)
Requires: libevent-2.0.so.5()(64bit)
Requires: libfmcommon.so.1()(64bit)
Requires: librmonapi.so.1()(64bit)
Requires: fm-common >= 1.0
Requires: libc.so.6(GLIBC_2.2.5)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
Requires: /bin/sh
Requires: librt.so.1()(64bit)
Requires: libc.so.6(GLIBC_2.3)(64bit)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Requires: libpthread.so.0(GLIBC_2.2.5)(64bit)
Requires: librt.so.1(GLIBC_2.3.3)(64bit)
Requires: libgcc_s.so.1(GCC_3.0)(64bit)
Requires: libevent >= 2.0.21
Requires: librt.so.1(GLIBC_2.2.5)(64bit)
Requires: libuuid.so.1()(64bit)
Requires: libm.so.6()(64bit)
Requires: rtld(GNU_HASH)
Requires: libstdc++.so.6()(64bit)
Requires: libc.so.6()(64bit)
Requires: libgcc_s.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Requires: libpthread.so.0()(64bit)
Provides: librmonapi.so.1()(64bit)
%description -n cgts-mtce-common-rmon
Titanium Cloud Host Maintenance Resource Monitor Service (rmond) adds
threshold based monitoring with predictive severity level alarming for
out of tolerance utilization of critical resourses such as memory, cpu
file system, interface state, etc.
%package -n cgts-mtce-common-hwmon
Summary: Titanuim Server Maintenance Hardware Monitor Package
Group: base
Requires: dpkg
Requires: time
Requires: /bin/bash
Requires: libjson-c.so.2()(64bit)
Requires: libstdc++.so.6(CXXABI_1.3)(64bit)
Requires: librt.so.1(GLIBC_2.2.5)(64bit)
Requires: libfmcommon.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.14)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.9)(64bit)
Requires: fm-common >= 1.0
Requires: libc.so.6(GLIBC_2.2.5)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
Requires: /bin/sh
Requires: librt.so.1()(64bit)
Requires: libc.so.6(GLIBC_2.3)(64bit)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Requires: libpthread.so.0(GLIBC_2.2.5)(64bit)
Requires: librt.so.1(GLIBC_2.3.3)(64bit)
Requires: libgcc_s.so.1(GCC_3.0)(64bit)
Requires: libevent >= 2.0.21
Requires: libevent-2.0.so.5()(64bit)
Requires: libm.so.6()(64bit)
Requires: rtld(GNU_HASH)
Requires: libstdc++.so.6()(64bit)
Requires: libc.so.6()(64bit)
Requires: libssh2.so.1()(64bit)
Requires: libgcc_s.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Requires: libpthread.so.0()(64bit)
%description -n cgts-mtce-common-hwmon
Titanium Cloud Host Maintenance Hardware Monitor Service (hwmond) adds
in and out of service hardware sensor monitoring, alarming and recovery
handling.
%package -n cgts-mtce-common-guestAgent
Summary: Titanuim Server Maintenance Guest Agent Package
Group: base
Requires: dpkg
Requires: time
Requires: libjson-c.so.2()(64bit)
Requires: libstdc++.so.6(CXXABI_1.3)(64bit)
Requires: librt.so.1(GLIBC_2.2.5)(64bit)
Requires: libfmcommon.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.9)(64bit)
Requires: fm-common >= 1.0
Requires: libc.so.6(GLIBC_2.2.5)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
Requires: /bin/sh
Requires: librt.so.1()(64bit)
Requires: libc.so.6(GLIBC_2.3)(64bit)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Requires: libpthread.so.0(GLIBC_2.2.5)(64bit)
Requires: librt.so.1(GLIBC_2.3.3)(64bit)
Requires: libgcc_s.so.1(GCC_3.0)(64bit)
Requires: libevent >= 2.0.21
Requires: libevent-2.0.so.5()(64bit)
Requires: libuuid.so.1()(64bit)
Requires: libm.so.6()(64bit)
Requires: rtld(GNU_HASH)
Requires: libstdc++.so.6()(64bit)
Requires: libc.so.6()(64bit)
Requires: libgcc_s.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Requires: libpthread.so.0()(64bit)
%description -n cgts-mtce-common-guestAgent
Titanium Cloud Host Maintenance Guest Agent Service assists in
VM guest heartbeat control and failure reporting at the controller
level.
%package -n cgts-mtce-common-guestServer
Summary: Titanuim Server Maintenance Guest Server Package
Group: base
Requires: util-linux
Requires: /bin/bash
Requires: /bin/systemctl
Requires: dpkg
Requires: libjson-c.so.2()(64bit)
Requires: libstdc++.so.6(CXXABI_1.3)(64bit)
Requires: librt.so.1(GLIBC_2.2.5)(64bit)
Requires: libfmcommon.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.9)(64bit)
Requires: fm-common >= 1.0
Requires: libc.so.6(GLIBC_2.2.5)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
Requires: /bin/sh
Requires: librt.so.1()(64bit)
Requires: libc.so.6(GLIBC_2.3)(64bit)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Requires: libpthread.so.0(GLIBC_2.2.5)(64bit)
Requires: librt.so.1(GLIBC_2.3.3)(64bit)
Requires: libgcc_s.so.1(GCC_3.0)(64bit)
Requires: libevent >= 2.0.21
Requires: libevent-2.0.so.5()(64bit)
Requires: libuuid.so.1()(64bit)
Requires: libm.so.6()(64bit)
Requires: rtld(GNU_HASH)
Requires: libstdc++.so.6()(64bit)
Requires: libc.so.6(GLIBC_2.4)(64bit)
Requires: libc.so.6()(64bit)
Requires: libgcc_s.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Requires: libpthread.so.0()(64bit)
%description -n cgts-mtce-common-guestServer
Titanium Cloud Maintenance Guest Server assists in VM guest
heartbeat control and failure reporting at the compute level.
%package -n cgts-mtce-common-hostw
Summary: Titanuim Server Common Maintenance Package
Group: base
Requires: util-linux
Requires: /bin/bash
Requires: /bin/systemctl
Requires: dpkg
Requires: libstdc++.so.6(CXXABI_1.3)(64bit)
Requires: libc.so.6(GLIBC_2.2.5)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
Requires: librt.so.1()(64bit)
Requires: libc.so.6(GLIBC_2.3)(64bit)
Requires: libpthread.so.0(GLIBC_2.2.5)(64bit)
Requires: librt.so.1(GLIBC_2.3.3)(64bit)
Requires: libgcc_s.so.1(GCC_3.0)(64bit)
Requires: librt.so.1(GLIBC_2.2.5)(64bit)
Requires: libm.so.6()(64bit)
Requires: rtld(GNU_HASH)
Requires: libstdc++.so.6()(64bit)
Requires: libc.so.6()(64bit)
Requires: libgcc_s.so.1()(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4)(64bit)
Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Requires: libpthread.so.0()(64bit)
%description -n cgts-mtce-common-hostw
Titanium Cloud Host Maintenance services. A suite of daemons that provide
host maintainability and a high level of fault detection with automatic
notification and recovery.The Maintenance Service (mtcAgent/mtcClient)
manages hosts according to an abbreviated version of the CCITT X.731 ITU
specification. The Heartbeat Service (hbsAgent/hbsClient) adds fast failure
detection over the management and infstructure networks. The Process
Monitor service (pmond) add both passive and active process monitoring and
automatic recovery of stopped or killed processes. The File System Monitor
Service (fsmond) adds detection and reporting of local file system
problems. The Hardware Monitor Service (hwmond) adds present and predictive
hardware failure detection, reporting and recovery. The Resource Monitor
Service (rmond) adds resource monitoring with present and predictive
failure and overload detection and reporting. The Guest Services
(guestAgent/guestServer) daemons control access into and heartbeat of guest
VMs on the compute. The Host Watchdog (hostwd) daemon watches for errors in
pmond and logs system information on error. All of these maintenance
services improve MTTD of node failures as well as resource overload and out
of spec operating conditions that can reduce outage time through automated
notification and recovery thereby improving overall platform availability
for the customer.
%define local_dir /usr/local
%define local_bindir %{local_dir}/bin
%define local_sbindir %{local_dir}/sbin
%define local_etc_pmond %{_sysconfdir}/pmon.d
%define local_etc_rmond %{_sysconfdir}/rmon.d
%define local_etc_goenabledd %{_sysconfdir}/goenabled.d
%define local_etc_servicesd %{_sysconfdir}/services.d
%define local_etc_logrotated %{_sysconfdir}/logrotate.d
%define bmc_profilesd %{_sysconfdir}/bmc/server_profiles.d
%define ocf_resourced /usr/lib/ocf/resource.d
%prep
%setup
# Build for main cgts-mtce-common package
%build
VER=%{version}
MAJOR=`echo $VER | awk -F . '{print $1}'`
MINOR=`echo $VER | awk -F . '{print $2}'`
make MAJOR=$MAJOR MINOR=$MINOR %{?_smp_mflags} build
%global _buildsubdir %{_builddir}/%{name}-%{version}
# Install for main cgts-mtce-common package
%install
VER=%{version}
MAJOR=`echo $VER | awk -F . '{print $1}'`
MINOR=`echo $VER | awk -F . '{print $2}'`
install -m 755 -d %{buildroot}%{_sysconfdir}
install -m 755 -d %{buildroot}/usr
install -m 755 -d %{buildroot}/%{_bindir}
install -m 755 -d %{buildroot}/usr/local
install -m 755 -d %{buildroot}%{local_bindir}
install -m 755 -d %{buildroot}/usr/local/sbin
install -m 755 -d %{buildroot}/%{_sbindir}
install -m 755 -d %{buildroot}/lib
install -m 755 -d %{buildroot}%{_sysconfdir}/mtc
install -m 755 -d %{buildroot}%{_sysconfdir}/mtc/tmp
# Resource Agent Stuff
install -m 755 -d %{buildroot}/usr/lib
install -m 755 -d %{buildroot}/usr/lib/ocf
install -m 755 -d %{buildroot}/usr/lib/ocf/resource.d
install -m 755 -d %{buildroot}/usr/lib/ocf/resource.d/platform
install -m 755 -p -D %{_buildsubdir}/scripts/mtcAgent %{buildroot}/usr/lib/ocf/resource.d/platform/mtcAgent
install -m 755 -p -D %{_buildsubdir}/scripts/hbsAgent %{buildroot}/usr/lib/ocf/resource.d/platform/hbsAgent
install -m 755 -p -D %{_buildsubdir}/hwmon/scripts/ocf/hwmon %{buildroot}/usr/lib/ocf/resource.d/platform/hwmon
install -m 755 -p -D %{_buildsubdir}/guest/scripts/guestAgent.ocf %{buildroot}/usr/lib/ocf/resource.d/platform/guestAgent
# config files
install -m 644 -p -D %{_buildsubdir}/scripts/mtc.ini %{buildroot}%{_sysconfdir}/mtc.ini
install -m 644 -p -D %{_buildsubdir}/scripts/mtc.conf %{buildroot}%{_sysconfdir}/mtc.conf
install -m 644 -p -D %{_buildsubdir}/fsmon/scripts/fsmond.conf %{buildroot}%{_sysconfdir}/mtc/fsmond.conf
install -m 644 -p -D %{_buildsubdir}/hwmon/scripts/hwmond.conf %{buildroot}%{_sysconfdir}/mtc/hwmond.conf
install -m 644 -p -D %{_buildsubdir}/pmon/scripts/pmond.conf %{buildroot}%{_sysconfdir}/mtc/pmond.conf
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/rmond.conf %{buildroot}%{_sysconfdir}/mtc/rmond.conf
install -m 644 -p -D %{_buildsubdir}/guest/scripts/guest.ini %{buildroot}%{_sysconfdir}/mtc/guestAgent.ini
install -m 644 -p -D %{_buildsubdir}/guest/scripts/guest.ini %{buildroot}%{_sysconfdir}/mtc/guestServer.ini
install -m 644 -p -D %{_buildsubdir}/hostw/scripts/hostwd.conf %{buildroot}%{_sysconfdir}/mtc/hostwd.conf
install -m 755 -d %{buildroot}/%{_sysconfdir}/etc/bmc/server_profiles.d
install -m 644 -p -D %{_buildsubdir}/scripts/sensor_hp360_v1_ilo_v4.profile %{buildroot}/%{_sysconfdir}/bmc/server_profiles.d/sensor_hp360_v1_ilo_v4.profile
install -m 644 -p -D %{_buildsubdir}/scripts/sensor_hp380_v1_ilo_v4.profile %{buildroot}/%{_sysconfdir}/bmc/server_profiles.d/sensor_hp380_v1_ilo_v4.profile
install -m 644 -p -D %{_buildsubdir}/scripts/sensor_quanta_v1_ilo_v4.profile %{buildroot}/%{_sysconfdir}/bmc/server_profiles.d/sensor_quanta_v1_ilo_v4.profile
# binaries
install -m 755 -p -D %{_buildsubdir}/maintenance/mtcAgent %{buildroot}/%{local_bindir}/mtcAgent
install -m 755 -p -D %{_buildsubdir}/maintenance/mtcClient %{buildroot}/%{local_bindir}/mtcClient
install -m 755 -p -D %{_buildsubdir}/heartbeat/hbsAgent %{buildroot}/%{local_bindir}/hbsAgent
install -m 755 -p -D %{_buildsubdir}/heartbeat/hbsClient %{buildroot}/%{local_bindir}/hbsClient
install -m 755 -p -D %{_buildsubdir}/guest/guestServer %{buildroot}/%{local_bindir}/guestServer
install -m 755 -p -D %{_buildsubdir}/guest/guestAgent %{buildroot}/%{local_bindir}/guestAgent
install -m 755 -p -D %{_buildsubdir}/pmon/pmond %{buildroot}/%{local_bindir}/pmond
install -m 755 -p -D %{_buildsubdir}/hostw/hostwd %{buildroot}/%{local_bindir}/hostwd
install -m 755 -p -D %{_buildsubdir}/rmon/rmond %{buildroot}/%{local_bindir}/rmond
install -m 755 -p -D %{_buildsubdir}/fsmon/fsmond %{buildroot}/%{local_bindir}/fsmond
install -m 755 -p -D %{_buildsubdir}/hwmon/hwmond %{buildroot}/%{local_bindir}/hwmond
install -m 755 -p -D %{_buildsubdir}/mtclog/mtclogd %{buildroot}/%{local_bindir}/mtclogd
install -m 755 -p -D %{_buildsubdir}/alarm/mtcalarmd %{buildroot}/%{local_bindir}/mtcalarmd
install -m 755 -p -D %{_buildsubdir}/rmon/rmon_resource_notify/rmon_resource_notify %{buildroot}/%{local_bindir}/rmon_resource_notify
install -m 755 -p -D %{_buildsubdir}/scripts/wipedisk %{buildroot}/%{local_bindir}/wipedisk
install -m 755 -p -D %{_buildsubdir}/common/fsync %{buildroot}/%{_sbindir}/fsync
install -m 700 -p -D %{_buildsubdir}/pmon/scripts/pmon-restart %{buildroot}/%{local_sbindir}/pmon-restart
install -m 700 -p -D %{_buildsubdir}/pmon/scripts/pmon-start %{buildroot}/%{local_sbindir}/pmon-start
install -m 700 -p -D %{_buildsubdir}/pmon/scripts/pmon-stop %{buildroot}/%{local_sbindir}/pmon-stop
# test tools
install -m 755 %{_buildsubdir}/hwmon/scripts/show_hp360 %{buildroot}/%{_sbindir}/show_hp360
install -m 755 %{_buildsubdir}/hwmon/scripts/show_hp380 %{buildroot}/%{_sbindir}/show_hp380
install -m 755 %{_buildsubdir}/hwmon/scripts/show_quanta %{buildroot}/%{_sbindir}/show_quanta
# init script files
install -m 755 -p -D %{_buildsubdir}/scripts/mtcClient %{buildroot}%{_sysconfdir}/init.d/mtcClient
install -m 755 -p -D %{_buildsubdir}/scripts/hbsClient %{buildroot}%{_sysconfdir}/init.d/hbsClient
install -m 755 -p -D %{_buildsubdir}/guest/scripts/guestServer %{buildroot}%{_sysconfdir}/init.d/guestServer
install -m 755 -p -D %{_buildsubdir}/guest/scripts/guestAgent %{buildroot}%{_sysconfdir}/init.d/guestAgent
install -m 755 -p -D %{_buildsubdir}/hwmon/scripts/lsb/hwmon %{buildroot}%{_sysconfdir}/init.d/hwmon
install -m 755 -p -D %{_buildsubdir}/fsmon/scripts/fsmon %{buildroot}%{_sysconfdir}/init.d/fsmon
install -m 755 -p -D %{_buildsubdir}/scripts/mtclog %{buildroot}%{_sysconfdir}/init.d/mtclog
install -m 755 -p -D %{_buildsubdir}/pmon/scripts/pmon %{buildroot}%{_sysconfdir}/init.d/pmon
install -m 755 -p -D %{_buildsubdir}/rmon/scripts/rmon %{buildroot}%{_sysconfdir}/init.d/rmon
install -m 755 -p -D %{_buildsubdir}/hostw/scripts/hostw %{buildroot}%{_sysconfdir}/init.d/hostw
install -m 755 -p -D %{_buildsubdir}/alarm/scripts/mtcalarm.init %{buildroot}%{_sysconfdir}/init.d/mtcalarm
# install -m 755 -p -D %{_buildsubdir}/scripts/config %{buildroot}%{_sysconfdir}/init.d/config
# TODO: Init hack. Should move to proper module
install -m 755 -p -D %{_buildsubdir}/scripts/hwclock.sh %{buildroot}%{_sysconfdir}/init.d/hwclock.sh
install -m 644 -p -D %{_buildsubdir}/scripts/hwclock.service %{buildroot}%{_unitdir}/hwclock.service
# systemd service files
install -m 644 -p -D %{_buildsubdir}/fsmon/scripts/fsmon.service %{buildroot}%{_unitdir}/fsmon.service
install -m 644 -p -D %{_buildsubdir}/hwmon/scripts/hwmon.service %{buildroot}%{_unitdir}/hwmon.service
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/rmon.service %{buildroot}%{_unitdir}/rmon.service
install -m 644 -p -D %{_buildsubdir}/pmon/scripts/pmon.service %{buildroot}%{_unitdir}/pmon.service
install -m 644 -p -D %{_buildsubdir}/hostw/scripts/hostw.service %{buildroot}%{_unitdir}/hostw.service
install -m 644 -p -D %{_buildsubdir}/guest/scripts/guestServer.service %{buildroot}%{_unitdir}/guestServer.service
install -m 644 -p -D %{_buildsubdir}/guest/scripts/guestAgent.service %{buildroot}%{_unitdir}/guestAgent.service
install -m 644 -p -D %{_buildsubdir}/scripts/mtcClient.service %{buildroot}%{_unitdir}/mtcClient.service
install -m 644 -p -D %{_buildsubdir}/scripts/hbsClient.service %{buildroot}%{_unitdir}/hbsClient.service
install -m 644 -p -D %{_buildsubdir}/scripts/mtclog.service %{buildroot}%{_unitdir}/mtclog.service
install -m 644 -p -D %{_buildsubdir}/scripts/goenabled.service %{buildroot}%{_unitdir}/goenabled.service
install -m 644 -p -D %{_buildsubdir}/scripts/runservices.service %{buildroot}%{_unitdir}/runservices.service
install -m 644 -p -D %{_buildsubdir}/alarm/scripts/mtcalarm.service %{buildroot}%{_unitdir}/mtcalarm.service
# go enabled stuff
install -m 755 -d %{buildroot}%{local_etc_goenabledd}
install -m 755 -p -D %{_buildsubdir}/scripts/goenabled %{buildroot}%{_sysconfdir}/init.d/goenabled
# start or stop services test script
install -m 755 -d %{buildroot}%{local_etc_servicesd}
install -m 755 -d %{buildroot}%{local_etc_servicesd}/controller
install -m 755 -d %{buildroot}%{local_etc_servicesd}/compute
install -m 755 -d %{buildroot}%{local_etc_servicesd}/storage
install -m 755 -p -D %{_buildsubdir}/scripts/mtcTest %{buildroot}/%{local_etc_servicesd}/compute
install -m 755 -p -D %{_buildsubdir}/scripts/mtcTest %{buildroot}/%{local_etc_servicesd}/controller
install -m 755 -p -D %{_buildsubdir}/scripts/mtcTest %{buildroot}/%{local_etc_servicesd}/storage
install -m 755 -p -D %{_buildsubdir}/scripts/runservices %{buildroot}%{_sysconfdir}/init.d/runservices
# test tools
install -m 755 -p -D %{_buildsubdir}/scripts/dmemchk.sh %{buildroot}%{local_sbindir}
# process monitor config files
install -m 755 -d %{buildroot}%{local_etc_pmond}
install -m 644 -p -D %{_buildsubdir}/scripts/mtcClient.conf %{buildroot}%{local_etc_pmond}/mtcClient.conf
install -m 644 -p -D %{_buildsubdir}/scripts/hbsClient.conf %{buildroot}%{local_etc_pmond}/hbsClient.conf
install -m 644 -p -D %{_buildsubdir}/pmon/scripts/acpid.conf %{buildroot}%{local_etc_pmond}/acpid.conf
install -m 644 -p -D %{_buildsubdir}/pmon/scripts/sshd.conf %{buildroot}%{local_etc_pmond}/sshd.conf
install -m 644 -p -D %{_buildsubdir}/pmon/scripts/ntpd.conf %{buildroot}%{local_etc_pmond}/ntpd.conf
install -m 644 -p -D %{_buildsubdir}/pmon/scripts/syslog-ng.conf %{buildroot}%{local_etc_pmond}/syslog-ng.conf
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/rmon.conf %{buildroot}%{local_etc_pmond}/rmon.conf
install -m 644 -p -D %{_buildsubdir}/fsmon/scripts/fsmon.conf %{buildroot}%{local_etc_pmond}/fsmon.conf
install -m 644 -p -D %{_buildsubdir}/scripts/mtclogd.conf %{buildroot}%{local_etc_pmond}/mtclogd.conf
install -m 644 -p -D %{_buildsubdir}/guest/scripts/guestServer.pmon %{buildroot}%{local_etc_pmond}/guestServer.conf
install -m 644 -p -D %{_buildsubdir}/alarm/scripts/mtcalarm.pmon.conf %{buildroot}%{local_etc_pmond}/mtcalarm.conf
# resource monitor config files
install -m 755 -d %{buildroot}%{local_etc_rmond}
install -m 755 -d %{buildroot}%{_sysconfdir}/rmonapi.d
install -m 755 -d %{buildroot}%{_sysconfdir}/rmonfiles.d
install -m 755 -d %{buildroot}%{_sysconfdir}/rmon_interfaces.d
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/remotelogging_resource.conf %{buildroot}%{local_etc_rmond}/remotelogging_resource.conf
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/cpu_resource.conf %{buildroot}%{local_etc_rmond}/cpu_resource.conf
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/memory_resource.conf %{buildroot}%{local_etc_rmond}/memory_resource.conf
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/filesystem_resource.conf %{buildroot}%{local_etc_rmond}/filesystem_resource.conf
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/cinder_virtual_resource.conf %{buildroot}%{local_etc_rmond}/cinder_virtual_resource.conf
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/nova_virtual_resource.conf %{buildroot}%{local_etc_rmond}/nova_virtual_resource.conf
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/oam_resource.conf %{buildroot}%{_sysconfdir}/rmon_interfaces.d/oam_resource.conf
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/management_resource.conf %{buildroot}%{_sysconfdir}/rmon_interfaces.d/management_resource.conf
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/infrastructure_resource.conf %{buildroot}%{_sysconfdir}/rmon_interfaces.d/infrastructure_resource.conf
install -m 755 -p -D %{_buildsubdir}/rmon/scripts/query_ntp_servers.sh %{buildroot}%{_sysconfdir}/rmonfiles.d/query_ntp_servers.sh
install -m 755 -p -D %{_buildsubdir}/rmon/scripts/rmon_reload_on_cpe.sh %{buildroot}%{local_etc_goenabledd}/rmon_reload_on_cpe.sh
# log rotation
install -m 755 -d %{buildroot}%{_sysconfdir}/logrotate.d
install -m 644 -p -D %{_buildsubdir}/scripts/mtce.logrotate %{buildroot}%{local_etc_logrotated}/mtce.logrotate
install -m 644 -p -D %{_buildsubdir}/hostw/scripts/hostw.logrotate %{buildroot}%{local_etc_logrotated}/hostw.logrotate
install -m 644 -p -D %{_buildsubdir}/pmon/scripts/pmon.logrotate %{buildroot}%{local_etc_logrotated}/pmon.logrotate
install -m 644 -p -D %{_buildsubdir}/rmon/scripts/rmon.logrotate %{buildroot}%{local_etc_logrotated}/rmon.logrotate
install -m 644 -p -D %{_buildsubdir}/fsmon/scripts/fsmon.logrotate %{buildroot}%{local_etc_logrotated}/fsmon.logrotate
install -m 644 -p -D %{_buildsubdir}/hwmon/scripts/hwmon.logrotate %{buildroot}%{local_etc_logrotated}/hwmon.logrotate
install -m 644 -p -D %{_buildsubdir}/guest/scripts/guestAgent.logrotate %{buildroot}%{local_etc_logrotated}/guestAgent.logrotate
install -m 644 -p -D %{_buildsubdir}/guest/scripts/guestServer.logrotate %{buildroot}%{local_etc_logrotated}/guestServer.logrotate
install -m 644 -p -D %{_buildsubdir}/alarm/scripts/mtcalarm.logrotate %{buildroot}%{local_etc_logrotated}/mtcalarm.logrotate
install -m 755 -p -D %{_buildsubdir}/public/libamon.so.$MAJOR %{buildroot}%{_libdir}/libamon.so.$MAJOR
cd %{buildroot}%{_libdir} ; ln -s libamon.so.$MAJOR libamon.so.$MAJOR.$MINOR
cd %{buildroot}%{_libdir} ; ln -s libamon.so.$MAJOR libamon.so
install -m 755 -p -D %{_buildsubdir}/rmon/rmonApi/librmonapi.so.$MAJOR %{buildroot}%{_libdir}/librmonapi.so.$MAJOR
cd %{buildroot}%{_libdir} ; ln -s librmonapi.so.$MAJOR librmonapi.so.$MAJOR.$MINOR
cd %{buildroot}%{_libdir} ; ln -s librmonapi.so.$MAJOR librmonapi.so
install -m 755 -d %{buildroot}/var
install -m 755 -d %{buildroot}/var/run
# Enable all services in systemd
%post
/bin/systemctl enable fsmon.service
/bin/systemctl enable mtcClient.service
/bin/systemctl enable hbsClient.service
/bin/systemctl enable mtclog.service
/bin/systemctl enable iscsid.service
/bin/systemctl enable rsyncd.service
/bin/systemctl enable goenabled.service
/bin/systemctl enable mtcalarm.service
%post -n cgts-mtce-common-hostw
/bin/systemctl enable hostw.service
%post -n cgts-mtce-common-pmon
/bin/systemctl enable pmon.service
%post -n cgts-mtce-common-guestServer
/bin/systemctl enable guestServer.service
%post -n cgts-mtce-common-rmon
/bin/systemctl enable rmon.service
###############################
# Maintenance Common RPM Files
###############################
%files
%license LICENSE
%defattr(-,root,root,-)
# create the mtc and its tmp dir
%dir %{_sysconfdir}/mtc
%dir %{_sysconfdir}/mtc/tmp
# SM OCF Start/Stop/Monitor Scripts
%{ocf_resourced}/platform/mtcAgent
%{ocf_resourced}/platform/hbsAgent
# Config files
%config(noreplace)/etc/mtc.ini
# Config files - Non-Modifiable
%{_sysconfdir}/mtc.conf
%{_sysconfdir}/mtc/fsmond.conf
# Mainteance Process Monitor Config Files
%{local_etc_pmond}/sshd.conf
%{local_etc_pmond}/ntpd.conf
%{local_etc_pmond}/mtcClient.conf
%{local_etc_pmond}/acpid.conf
%{local_etc_pmond}/hbsClient.conf
%{local_etc_pmond}/syslog-ng.conf
%{local_etc_pmond}/fsmon.conf
%{local_etc_pmond}/mtclogd.conf
%{local_etc_pmond}/mtcalarm.conf
# Mainteance log rotation config files
%{local_etc_logrotated}/fsmon.logrotate
%{local_etc_logrotated}/mtce.logrotate
%{local_etc_logrotated}/mtcalarm.logrotate
# Maintenance start/stop services scripts
%{local_etc_servicesd}/controller/mtcTest
%{local_etc_servicesd}/storage/mtcTest
%{local_etc_servicesd}/compute/mtcTest
# BMC profile Files
%{bmc_profilesd}/sensor_hp360_v1_ilo_v4.profile
%{bmc_profilesd}/sensor_quanta_v1_ilo_v4.profile
%{bmc_profilesd}/sensor_hp380_v1_ilo_v4.profile
# Init scripts
%{_sysconfdir}/init.d/runservices
%{_sysconfdir}/init.d/goenabled
%{_sysconfdir}/init.d/fsmon
%{_sysconfdir}/init.d/mtclog
%{_sysconfdir}/init.d/hbsClient
%{_sysconfdir}/init.d/mtcClient
%{_sysconfdir}/init.d/mtcalarm
%{_sysconfdir}/init.d/hwclock.sh
%{_unitdir}/runservices.service
%{_unitdir}/goenabled.service
%{_unitdir}/mtclog.service
%{_unitdir}/mtcalarm.service
%{_unitdir}/fsmon.service
%{_unitdir}/mtcClient.service
%{_unitdir}/hbsClient.service
%{_unitdir}/hwclock.service
# Binaries
%{local_bindir}/mtcAgent
%{local_bindir}/fsmond
%{local_bindir}/hbsAgent
%{local_bindir}/mtclogd
%{local_bindir}/mtcalarmd
%{local_bindir}/hbsClient
%{local_bindir}/mtcClient
%{local_bindir}/wipedisk
%{local_sbindir}/dmemchk.sh
%{_sbindir}/fsync
###############################
# Process Monitor RPM Files
###############################
%files -n cgts-mtce-common-pmon
%defattr(-,root,root,-)
# Config files - Non-Modifiable
%{_sysconfdir}/mtc/pmond.conf
%{local_etc_logrotated}/pmon.logrotate
%{_unitdir}/pmon.service
%{local_sbindir}/pmon-restart
%{local_sbindir}/pmon-start
%{local_sbindir}/pmon-stop
/usr/lib64/libamon.so.1.0
/usr/lib64/libamon.so.1
/usr/lib64/libamon.so
%{_sysconfdir}/init.d/pmon
%{local_bindir}/pmond
###############################
# Resource Monitor RPM Files
###############################
%files -n cgts-mtce-common-rmon
%defattr(-,root,root,-)
# Config files - Non-Modifiable
%{_sysconfdir}/mtc/rmond.conf
%{local_etc_pmond}/rmon.conf
%{local_etc_logrotated}/rmon.logrotate
%{_unitdir}/rmon.service
%{local_etc_rmond}/filesystem_resource.conf
%{local_etc_rmond}/cpu_resource.conf
%{local_etc_rmond}/remotelogging_resource.conf
%{local_etc_rmond}/memory_resource.conf
%{local_etc_rmond}/cinder_virtual_resource.conf
%{local_etc_rmond}/nova_virtual_resource.conf
%{_sysconfdir}/rmon_interfaces.d/management_resource.conf
%{_sysconfdir}/rmon_interfaces.d/oam_resource.conf
%{_sysconfdir}/rmon_interfaces.d/infrastructure_resource.conf
%{_sysconfdir}/rmonfiles.d/query_ntp_servers.sh
/usr/lib64/librmonapi.so.1.0
/usr/lib64/librmonapi.so.1
/usr/lib64/librmonapi.so
%dir %{_sysconfdir}/rmonapi.d
%{_sysconfdir}/init.d/rmon
%{local_bindir}/rmond
%{local_bindir}/rmon_resource_notify
%{local_etc_goenabledd}/rmon_reload_on_cpe.sh
###############################
# Hardware Monitor RPM Files
###############################
%files -n cgts-mtce-common-hwmon
%defattr(-,root,root,-)
# Config files - Non-Modifiable
%{_sysconfdir}/mtc/hwmond.conf
%{_unitdir}/hwmon.service
%{local_etc_logrotated}/hwmon.logrotate
%{ocf_resourced}/platform/hwmon
%{_sbindir}/show_hp380
%{_sbindir}/show_hp360
%{_sbindir}/show_quanta
%{_sysconfdir}/init.d/hwmon
%{local_bindir}/hwmond
###############################
# Guest Agent RPM Files
###############################
%files -n cgts-mtce-common-guestAgent
%defattr(-,root,root,-)
# Config files - Non-Modifiable
%{_sysconfdir}/mtc/guestAgent.ini
%{_unitdir}/guestAgent.service
%{local_etc_logrotated}/guestAgent.logrotate
%{ocf_resourced}/platform/guestAgent
%{_sysconfdir}/init.d/guestAgent
%{local_bindir}/guestAgent
###############################
# Guest Server RPM Files
###############################
%files -n cgts-mtce-common-guestServer
%defattr(-,root,root,-)
# Config files - Non-Modifiable
%{_sysconfdir}/mtc/guestServer.ini
%{local_etc_pmond}/guestServer.conf
%{local_etc_logrotated}/guestServer.logrotate
%{_unitdir}/guestServer.service
%{_sysconfdir}/init.d/guestServer
%{local_bindir}/guestServer
###############################
# Host Watchdog RPM Files
###############################
%files -n cgts-mtce-common-hostw
%defattr(-,root,root,-)
# Config files - Non-Modifiable
%{_sysconfdir}/mtc/hostwd.conf
%{local_etc_logrotated}/hostw.logrotate
%{_unitdir}/hostw.service
%{_sysconfdir}/init.d/hostw
%{local_bindir}/hostwd

View File

@ -0,0 +1,4 @@
*.swp
*.o
*.a
*~

View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,47 @@
#
# Copyright (c) 2013-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
VER=1
VER_MJR=1
build:
@(cd public ; make lib VER=$(VER) VER_MJR=$(VER_MJR))
@(cd rmon/rmonApi ; make lib VER=$(VER) VER_MJR=$(VER_MJR))
@(cd daemon ; make lib VER=$(VER) VER_MJR=$(VER_MJR))
@(cd common ; make lib fsync VER=$(VER) VER_MJR=$(VER_MJR))
@(cd alarm ; make build VER=$(VER) VER_MJR=$(VER_MJR))
@(cd heartbeat ; make build VER=$(VER) VER_MJR=$(VER_MJR))
@(cd maintenance ; make build VER=$(VER) VER_MJR=$(VER_MJR))
@(cd hwmon ; make build VER=$(VER) VER_MJR=$(VER_MJR))
@(cd mtclog ; make build VER=$(VER) VER_MJR=$(VER_MJR))
@(cd pmon ; make build VER=$(VER) VER_MJR=$(VER_MJR))
@(cd guest ; make build VER=$(VER) VER_MJR=$(VER_MJR))
@(cd fsmon ; make build VER=$(VER) VER_MJR=$(VER_MJR))
@(cd rmon ; make build VER=$(VER) VER_MJR=$(VER_MJR))
@(cd rmon/rmon_resource_notify ; make build VER=$(VER) VER_MJR=$(VER_MJR))
@(cd hostw ; make build VER=$(VER) VER_MJR=$(VER_MJR))
clean:
@( cd public ; make clean )
@( cd rmon/rmonApi ; make clean )
@( cd daemon ; make clean )
@( cd common ; make clean )
@( cd alarm ; make clean )
@( cd mtclog ; make clean )
@( cd hwmon ; make clean )
@( cd pmon ; make clean )
@( cd guest ; make clean )
@( cd fsmon ; make clean )
@( cd heartbeat ; make clean )
@( cd maintenance ; make clean )
@( cd rmon ; make clean )
@( cd rmon/rmon_resource_notify ; make clean )
@( cd hostw ; make clean )
@( rm -rf release )
backup: clean
mkdir -p ~/mtce
cp -a * ~/mtce

View File

@ -0,0 +1,44 @@
SRCS = alarmInit.cpp alarmData.cpp alarmHdlr.cpp alarmMgr.cpp alarmUtil.cpp alarm.cpp
OBJS = $(SRCS:.cpp=.o)
LDLIBS = -lstdc++ -ldaemon -lcommon -lfmcommon -ljson-c -lrt -lcrypto -luuid
INCLUDES = -I../daemon -I../common -I../smash -I../maintenance -I../public -I. -I..
CCFLAGS = -g -O2 -Wall -Wextra -Werror
STATIC_ANALYSIS_TOOL = cppcheck
STATIC_ANALYSIS_TOOL_EXISTS = $(shell [[ -e `which $(STATIC_ANALYSIS_TOOL)` ]] && echo 1 || echo 0)
BINS = mtcalarmd
.cpp.o:
$(CXX) $(INCLUDES) $(CCFLAGS) $(EXTRACCFLAGS) -c $< -o $@
all: clean_bins static_analysis common daemon process library
static_analysis:
ifeq ($(STATIC_ANALYSIS_TOOL_EXISTS), 1)
$(STATIC_ANALYSIS_TOOL) --language=c++ --enable=warning -U__AREA__ -DWANT_FIT_TESTING *.cpp *.h
else
echo "Warning: '$(STATIC_ANALYSIS_TOOL)' static analysis tool not installed ; bypassing ..."
endif
build: clean_bins static_analysis ${OBJS} library process
common:
( cd ../common ; make clean ; make lib VER=$(VER) VER_MJR=$(VER_MJR))
daemon:
( cd ../daemon ; make clean ; make lib VER=$(VER) VER_MJR=$(VER_MJR))
library:
ar rcs libalarm.a alarm.o $(EXTRAARFLAGS)
process: $(OBJS)
$(CXX) $(CCFLAGS) ${OBJS} -L../daemon -L../common $(LDLIBS) -o mtcalarmd
clean_bins:
@rm -f $(BINS)
clean:
@rm -f $(OBJ) $(BINS) *.o *.a

View File

@ -0,0 +1,189 @@
/*
* Copyright (c) 2015-2017 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River Titanium Cloud 'Heartbeat Agent' Alarm Module
*/
#include <sys/types.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
#ifdef __AREA__
#undef __AREA__
#endif
#define __AREA__ "alm"
#include "daemon_common.h"
#include "nodeBase.h" /* for ... fail codes */
#include "jsonUtil.h"
#include "alarm.h" /* for ... module header */
static msgClassSock * user_sock_ptr = NULL ;
/* A call to this API is required in advance of sending an alarm request */
int alarm_register_user ( msgClassSock * sock_ptr )
{
int rc = PASS ;
if ( sock_ptr && sock_ptr->getFD() && sock_ptr->sock_ok() )
{
ilog ("Registered with maintenance alarm service\n");
user_sock_ptr = sock_ptr ;
}
else
{
elog ("Failed to register with maintenance alarm service\n");
rc = FAIL_SOCKET_BIND ;
}
return (rc);
}
/* Construct an alarm request json string in the following form
{\"mtcalarm\":[{\"alarmid\":\"200.009\",\"hostname\":\"compute-3\",\"operation\":\"set\",\"severity\":\"major\",\"entity\":\"Infrastructure\",\"prefix\":\"service=heartbeat\"}, {\"alarmid\":\"200.005\",\"hostname\":\"compute-3\",\"operation\":\"set\",\"severity\":\"major\",\"entity\":\"Management\",\"prefix\":\"service=heartbeat\"}]}"
or
{ \"mtcalarm\":
[
{
\"alarmid\":\"200.009\",
\"hostname\":\"compute-3\",
\"operation\":\"set\",
\"severity\":\"major\",
\"entity\":\"Infrastructure\",
\"prefix\":\"service=heartbeat\"
}
]
}
*/
int alarm_ ( string hostname, const char * id, EFmAlarmStateT state, EFmAlarmSeverityT severity, const char * entity, string prefix )
{
int rc = PASS ;
char request [MAX_ALARM_REQ_MSG_SIZE] ;
string msg_type ;
string sev ;
if ( state == FM_ALARM_STATE_MSG )
msg_type = "msg" ;
else if ( state == FM_ALARM_STATE_SET )
msg_type = "set" ;
else
msg_type = "clear" ;
switch ( severity )
{
case FM_ALARM_SEVERITY_CLEAR:
sev = "clear" ;
break ;
case FM_ALARM_SEVERITY_WARNING:
sev = "warning";
break ;
case FM_ALARM_SEVERITY_MINOR:
sev = "minor";
break ;
case FM_ALARM_SEVERITY_MAJOR:
sev = "major";
break ;
case FM_ALARM_SEVERITY_CRITICAL:
sev = "critical";
break ;
default :
sev = "unknown";
break ;
}
snprintf ( request, MAX_ALARM_REQ_MSG_SIZE, "{\"mtcalarm\":[{\"alarmid\":\"%s\",\"hostname\":\"%s\",\"operation\":\"%s\",\"severity\":\"%s\",\"entity\":\"%s\",\"prefix\":\"%s\"}]}",
id,
hostname.data(),
msg_type.data(),
sev.data(),
entity,
prefix.data());
size_t len = strlen(request) ;
/* Retrying up to 3 times if the send fails */
for ( int i = 0 ; i < 3 ; i++ )
{
int bytes = user_sock_ptr->write((char*)&request[0], len );
if ( bytes <= 0 )
{
elog("%s failed to send alarm request (%d:%m)\n", hostname.c_str(), errno );
elog("... %s\n", request);
rc = FAIL_SOCKET_SENDTO ;
}
else if ( ((int)len) != bytes )
{
elog ("%s failed to send complete alarm message (%d:%ld)\n", hostname.c_str(), bytes, len );
}
else
{
ilog ("%s %s\n", hostname.c_str(), request);
return ( PASS ) ;
}
daemon_signal_hdlr ();
usleep (1000);
}
return (rc);
}
int alarm_clear ( string hostname, const char * alarm_id_ptr , string entity )
{
string prefix = "" ;
return (alarm_ ( hostname, alarm_id_ptr, FM_ALARM_STATE_CLEAR, FM_ALARM_SEVERITY_CLEAR, entity.data(), prefix.data() ));
}
int alarm_warning ( string hostname, const char * alarm_id_ptr , string entity )
{
string prefix = "" ;
return (alarm_ ( hostname, alarm_id_ptr, FM_ALARM_STATE_SET, FM_ALARM_SEVERITY_WARNING, entity.data(), prefix.data() ));
}
int alarm_minor ( string hostname, const char * alarm_id_ptr , string entity )
{
string prefix = "" ;
return (alarm_ ( hostname, alarm_id_ptr, FM_ALARM_STATE_SET, FM_ALARM_SEVERITY_MINOR, entity.data(), prefix.data() ));
}
int alarm_major ( string hostname, const char * alarm_id_ptr , string entity )
{
string prefix = "" ;
return (alarm_ ( hostname, alarm_id_ptr, FM_ALARM_STATE_SET, FM_ALARM_SEVERITY_MAJOR, entity.data(), prefix.data() ));
}
int alarm_critical ( string hostname, const char * alarm_id_ptr , string entity )
{
string prefix = "" ;
return (alarm_ ( hostname, alarm_id_ptr, FM_ALARM_STATE_SET, FM_ALARM_SEVERITY_CRITICAL, entity.data(), prefix.data() ));
}
int alarm_warning_log ( string hostname, const char * alarm_id_ptr , string entity , string prefix )
{
return (alarm_ ( hostname, alarm_id_ptr, FM_ALARM_STATE_MSG, FM_ALARM_SEVERITY_WARNING, entity.data(), prefix.data() ));
}
int alarm_minor_log ( string hostname, const char * alarm_id_ptr , string entity , string prefix )
{
return (alarm_ ( hostname, alarm_id_ptr, FM_ALARM_STATE_MSG, FM_ALARM_SEVERITY_MINOR, entity.data(), prefix.data() ));
}
int alarm_major_log ( string hostname, const char * alarm_id_ptr , string entity , string prefix )
{
return (alarm_ ( hostname, alarm_id_ptr, FM_ALARM_STATE_MSG, FM_ALARM_SEVERITY_MAJOR, entity.data(), prefix.data() ));
}
int alarm_critical_log ( string hostname, const char * alarm_id_ptr , string entity , string prefix )
{
return (alarm_ ( hostname, alarm_id_ptr, FM_ALARM_STATE_MSG, FM_ALARM_SEVERITY_CRITICAL, entity.data(), prefix.data() ));
}

View File

@ -0,0 +1,166 @@
#ifndef __INCLUDE_ALARM_H__
#define __INCLUDE_ALARM_H__
/*
* Copyright (c) 2016-2017 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River Titanium Cloud Maintenance Alarm Service Header
*/
#include "nodeBase.h"
#include "nodeUtil.h" /* for ... common utilities */
#include "msgClass.h" /* for ... msgClassSock type definition */
/* external APIs */
#include "fmAPI.h"
#define ENTITY_PREFIX ((const char *)"host=")
#define MAX_ALARMS (10)
#define MAX_ALARM_REQ_PER_MSG (4)
#define MAX_ALARM_REQ_MSG_SIZE (500)
#define MAX_ALARM_REQ_SIZE (MAX_ALARM_REQ_PER_MSG*MAX_ALARM_REQ_MSG_SIZE)
#define SWERR_ALARM_ID ((const char *)"200.000") /* Do No Use */
#define LOCK_ALARM_ID ((const char *)"200.001")
#define ENABLE_ALARM_ID ((const char *)"200.004")
#define MGMNT_HB_ALARM_ID ((const char *)"200.005")
#define PMOND_ALARM_ID ((const char *)"200.006")
#define SENSOR_ALARM_ID ((const char *)"200.007") /* Sensor read alarm ; i.e. the sensor read value bad */
#define INFRA_HB_ALARM_ID ((const char *)"200.009")
#define BM_ALARM_ID ((const char *)"200.010")
#define CONFIG_ALARM_ID ((const char *)"200.011")
#define CH_CONT_ALARM_ID ((const char *)"200.012") /* Combo Host Controller Failure - with Active Compute */
#define CH_COMP_ALARM_ID ((const char *)"200.013") /* Combo Host Compute Failure - on last Controller */
#define SENSORCFG_ALARM_ID ((const char *)"200.014") /* Sensor configuration alarm ; i.e. could not add */
#define SENSORGROUP_ALARM_ID ((const char *)"200.015") /* Sensor Group Read Error */
#define EVENT_LOG_ID ((const char *)"200.020")
#define COMMAND_LOG_ID ((const char *)"200.021")
#define STATECHANGE_LOG_ID ((const char *)"200.022")
#define SERVICESTATUS_LOG_ID ((const char *)"200.023") /* log used to report service failure events against */
/** Heartbeat Alarm Abstract Reference IDs */
typedef enum
{
HBS_ALARM_ID__HB_MGMNT = 0,
HBS_ALARM_ID__HB_INFRA = 1,
HBS_ALARM_ID__PMOND = 2,
HBS_ALARM_ID__SERVICE = 3,
HBS_ALARM_ID__LAST = 4,
} alarm_id_enum ;
string alarmUtil_getId_str ( alarm_id_enum alarm_id_num );
int alarmUtil_getId_enum ( string alarm_id_str, alarm_id_enum & alarm_id_num );
/** Converts FM severity to representative string */
string alarmUtil_getSev_str ( EFmAlarmSeverityT severity );
EFmAlarmSeverityT alarmUtil_getSev_enum ( string severity );
#ifndef __MODULE_PRIVATE__
int alarm_register_user ( msgClassSock * sock_ptr );
/* Public API */
int alarm_ ( string hostname, const char * id, EFmAlarmStateT state, EFmAlarmSeverityT severity, const char * entity, string prefix );
int alarm_clear ( string hostname, const char * id_ptr, string entity );
int alarm_warning ( string hostname, const char * id_ptr, string entity );
int alarm_minor ( string hostname, const char * id_ptr, string entity );
int alarm_major ( string hostname, const char * id_ptr, string entity );
int alarm_critical ( string hostname, const char * id_ptr, string entity );
int alarm_critical_log ( string hostname, const char * id_ptr, string entity );
int alarm_major_log ( string hostname, const char * id_ptr, string entity );
int alarm_minor_log ( string hostname, const char * id_ptr, string entity );
int alarm_warning_log ( string hostname, const char * id_ptr, string entity, string prefix );
int alarm_log ( string hostname, const char * id_ptr, string entity );
#else
typedef struct
{
SFmAlarmDataT alarm ;
string name ;
string instc_prefix ; /* Instance prefix i.e. "=sensor." or "=process." */
string critl_reason ;
string minor_reason ;
string major_reason ;
string clear_reason ;
} alarmUtil_type ;
#define MAX_FAILED_B2B_RECEIVES_B4_RESTART (5)
/* Test Commandss
*
STR="{\"mtcalarm\":[{\"alarmid\":\"200.009\",\"hostname\":\"compute-3\",\"operation\":\"clear\",\"severity\":\"clear\",\"entity\":\"Infrastructure\",\"prefix\":\"service=heartbeat\"}, {\"alarmid\":\"200.005\",\"hostname\":\"compute-3\",\"operation\":\"set\",\"severity\":\"major\",\"entity\":\"Management\",\"prefix\":\"service=heartbeat\"}]}"
PROTOCOL="UDP4-DATAGRAM"
ADDRESS="127.0.0.1"
port="2122"
echo "${STR}" | socat - ${PROTOCOL}:${ADDRESS}:${port}
*/
#define MTCALARM_REQ_LABEL ((const char *)"mtcalarm")
#define MTCALARM_REQ_KEY__OPERATION ((const char *)"operation")
#define MTCALARM_REQ_KEY__HOSTNAME ((const char *)"hostname")
#define MTCALARM_REQ_KEY__ALARMID ((const char *)"alarmid")
#define MTCALARM_REQ_KEY__SEVERITY ((const char *)"severity")
#define MTCALARM_REQ_KEY__ENTITY ((const char *)"entity")
#define MTCALARM_REQ_KEY__PREFIX ((const char *)"prefix")
/* in alarmData.cpp */
void alarmData_init ( void );
alarmUtil_type * alarmData_getAlarm_ptr ( string alarm_id_str );
/* in alarmUtil.cpp */
// EFmAlarmSeverityT mtcAlarm_state ( string hostname, alarm_id_enum id );
/* in alarmHdlr.cpp */
int alarmHdlr_request_handler ( char * msg_ptr );
/* in alarmMgr.cpp */
int alarmMgr_manage_alarm ( string alarmid ,
string hostname,
string operation,
string severity,
string entity,
string prefix);
/* Clear all alarms against this host */
void alarmUtil_clear_all ( string hostname );
/**
* Query the specified alarm severity level.
* Severity levels are specified in fmAPI.h
**/
EFmAlarmSeverityT alarmUtil_query ( string hostname,
string identity,
string instance );
int alarmUtil_query_identity ( string identity,
SFmAlarmDataT * alarm_list_ptr,
unsigned int alarms_max );
int alarmUtil_clear ( string hostname, string alarm_id, string entity );
int alarmUtil_critical ( string hostname, string alarm_id, string entity );
int alarmUtil_major ( string hostname, string alarm_id, string entity );
int alarmUtil_minor ( string hostname, string alarm_id, string entity );
int alarmUtil_warning ( string hostname, string alarm_id, string entity );
int alarmUtil_critical_log ( string hostname, string alarm_id, string entity );
int alarmUtil_major_log ( string hostname, string alarm_id, string entity );
int alarmUtil_minor_log ( string hostname, string alarm_id, string entity );
int alarmUtil_warning_log ( string hostname, string alarm_id, string entity, string prefix );
#endif // _MODULE_PRIVATE_
#endif // __INCLUDE_ALARM_H__

View File

@ -0,0 +1,195 @@
/*
* Copyright (c) 2016-2017 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River Titanium Cloud Maintenance Alarm Daemon Utility
**/
#include <sys/types.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
#ifdef __AREA__
#undef __AREA__
#endif
#define __AREA__ "alm"
#define __MODULE_PRIVATE__
#include "daemon_common.h" /* */
#include "alarm.h" /* for ... this module header */
/* TODO: Replace this with YAML Parsing */
static alarmUtil_type alarm_list[HBS_ALARM_ID__LAST] ;
alarmUtil_type * alarmData_getAlarm_ptr ( string alarm_id_str )
{
alarm_id_enum id = HBS_ALARM_ID__LAST ;
if ( alarmUtil_getId_enum ( alarm_id_str, id ) == PASS )
{
if ( id < HBS_ALARM_ID__LAST )
{
return (&alarm_list[id]) ;
}
}
wlog ("failed to find alarm data for '%s'\n", alarm_id_str.c_str() );
return (NULL);
}
typedef struct
{
const char * identity_str ;
alarm_id_enum identity_num ;
} alarm_id_table_type ;
alarm_id_table_type alarm_id_table[HBS_ALARM_ID__LAST];
void alarmData_init ( void )
{
alarmUtil_type * ptr ;
alarm_id_table[HBS_ALARM_ID__HB_MGMNT].identity_str = MGMNT_HB_ALARM_ID ;
alarm_id_table[HBS_ALARM_ID__HB_MGMNT].identity_num = HBS_ALARM_ID__HB_MGMNT ;
alarm_id_table[HBS_ALARM_ID__HB_INFRA].identity_str = INFRA_HB_ALARM_ID;
alarm_id_table[HBS_ALARM_ID__HB_INFRA].identity_num = HBS_ALARM_ID__HB_INFRA;
alarm_id_table[HBS_ALARM_ID__PMOND].identity_str = PMOND_ALARM_ID;
alarm_id_table[HBS_ALARM_ID__PMOND].identity_num = HBS_ALARM_ID__PMOND;
alarm_id_table[HBS_ALARM_ID__SERVICE].identity_str = SERVICESTATUS_LOG_ID;
alarm_id_table[HBS_ALARM_ID__SERVICE].identity_num = HBS_ALARM_ID__SERVICE;
/** Management Network Heartbeat Alarm ************************************/
ptr = &alarm_list[HBS_ALARM_ID__HB_MGMNT];
memset (&ptr->alarm, 0, (sizeof(SFmAlarmDataT)));
snprintf(&ptr->alarm.alarm_id[0], FM_MAX_BUFFER_LENGTH, "%s", MGMNT_HB_ALARM_ID);
ptr->name = "Management Network' Heartbeat" ;
ptr->instc_prefix = "network=" ;
ptr->critl_reason = "experienced a persistent critical 'Management Network' "
"communication failure.";
ptr->major_reason =
ptr->minor_reason = "is experiencing intermittent 'Management Network' "
"communication failures that have exceeded its lower alarming threshold.";
ptr->clear_reason = "'Management Network' Heartbeat has 'resumed' if host is 'unlocked' "
"or 'stopped' if host is 'locked or deleted'";
ptr->alarm.alarm_type = FM_ALARM_COMM ;
ptr->alarm.probable_cause = FM_ALARM_LOSS_OF_SIGNAL ;
ptr->alarm.inhibit_alarms = FM_FALSE;
ptr->alarm.service_affecting = FM_TRUE ;
ptr->alarm.suppression = FM_TRUE ;
ptr->alarm.severity = FM_ALARM_SEVERITY_CLEAR ; /* Dynamic */
ptr->alarm.alarm_state = FM_ALARM_STATE_CLEAR ; /* Dynamic */
snprintf( ptr->alarm.proposed_repair_action, FM_MAX_BUFFER_LENGTH,
"Check 'Management Network' connectivity and support for multicast messaging."
"If problem consistently occurs after that and Host is reset, then"
"contact next level of support or lock and replace failing Host.");
/** Infrastructure Network Heartbeat Alarm ************************************/
ptr = &alarm_list[HBS_ALARM_ID__HB_INFRA];
memset (&ptr->alarm, 0, (sizeof(SFmAlarmDataT)));
snprintf(&ptr->alarm.alarm_id[0], FM_MAX_BUFFER_LENGTH, "%s", INFRA_HB_ALARM_ID);
ptr->name = "Infrastructure Network' Heartbeat" ;
ptr->instc_prefix = "network=" ;
ptr->critl_reason = "experienced a persistent critical 'Infrastructure Network' "
"communication failure.";
ptr->major_reason =
ptr->minor_reason = "is experiencing intermittent 'Infrastructure Network' "
"communication failures that have exceeded its lower alarming threshold.";
ptr->clear_reason = "'Infrastructure Network' Heartbeat has 'resumed' if host is 'unlocked' "
"or 'stopped' if host is 'locked or deleted'";
ptr->alarm.alarm_type = FM_ALARM_COMM ;
ptr->alarm.probable_cause = FM_ALARM_LOSS_OF_SIGNAL ;
ptr->alarm.inhibit_alarms = FM_FALSE;
ptr->alarm.service_affecting = FM_TRUE ;
ptr->alarm.suppression = FM_TRUE ;
ptr->alarm.severity = FM_ALARM_SEVERITY_CLEAR ; /* Dynamic */
ptr->alarm.alarm_state = FM_ALARM_STATE_CLEAR ; /* Dynamic */
snprintf( ptr->alarm.proposed_repair_action, FM_MAX_BUFFER_LENGTH,
"Check 'Infrastructure Network' connectivity and support for multicast messaging."
"If problem consistently occurs after that and Host is reset, then"
"contact next level of support or lock and replace failing Host.");
/** Process Failure Alarm ****************************************************/
ptr = &alarm_list[HBS_ALARM_ID__PMOND];
memset (&ptr->alarm, 0, (sizeof(SFmAlarmDataT)));
snprintf(&ptr->alarm.alarm_id[0], FM_MAX_BUFFER_LENGTH, "%s", PMOND_ALARM_ID);
ptr->name = "Process Monitor Failure" ;
ptr->instc_prefix = "process=" ;
ptr->critl_reason =
ptr->minor_reason =
ptr->major_reason = "'Process Monitor' (pmond) process is not running or functioning properly. "
"The system is trying to recover this process." ;
ptr->clear_reason = "Process Monitor has been successfully recovered and is functioning properly.";
ptr->alarm.alarm_type = FM_ALARM_OPERATIONAL ;
ptr->alarm.probable_cause = FM_ALARM_CAUSE_UNKNOWN;
ptr->alarm.inhibit_alarms = FM_FALSE;
ptr->alarm.service_affecting = FM_FALSE;
ptr->alarm.suppression = FM_TRUE ;
ptr->alarm.severity = FM_ALARM_SEVERITY_CLEAR ; /* Dynamic */
ptr->alarm.alarm_state = FM_ALARM_STATE_CLEAR ; /* Dynamic */
snprintf (ptr->alarm.proposed_repair_action, FM_MAX_BUFFER_LENGTH,
"If this alarm does not automatically clear after some time and "
"continues to be asserted after Host is locked and unlocked then "
"contact next level of support for root cause analysis and recovery.");
/** Service Status Log ****************************************************/
ptr = &alarm_list[HBS_ALARM_ID__SERVICE];
memset (&ptr->alarm, 0, (sizeof(SFmAlarmDataT)));
snprintf(&ptr->alarm.alarm_id[0], FM_MAX_BUFFER_LENGTH, "%s", SERVICESTATUS_LOG_ID);
ptr->name = "Service Status" ;
ptr->minor_reason =
ptr->major_reason =
ptr->critl_reason =
ptr->clear_reason = "";
ptr->alarm.alarm_type = FM_ALARM_TYPE_UNKNOWN ;
ptr->alarm.probable_cause = FM_ALARM_CAUSE_UNKNOWN ;
ptr->alarm.inhibit_alarms = FM_FALSE ;
ptr->alarm.service_affecting = FM_FALSE ;
ptr->alarm.suppression = FM_FALSE ;
ptr->alarm.severity = FM_ALARM_SEVERITY_CLEAR ; /* Dynamic */
ptr->alarm.alarm_state = FM_ALARM_STATE_MSG ; /* Dynamic */
snprintf ( ptr->alarm.proposed_repair_action, FM_MAX_BUFFER_LENGTH, "%s", "");
}
/* Translate alarm identity enum to alarm identity string */
string _getIdentity ( alarm_id_enum id )
{
if ( id < HBS_ALARM_ID__LAST )
return ( alarm_id_table[id].identity_str) ;
return ("200.000");
}

View File

@ -0,0 +1,134 @@
/*
* Copyright (c) 2016-2017 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River Titanium Cloud Maintenance Alarm Manager Daemon Handler
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h> /* for close and usleep */
#include <json-c/json.h> /* for ... json-c json string parsing */
using namespace std;
#define __MODULE_PRIVATE__
#include "alarm.h" /* module header */
#include "jsonUtil.h" /* for ... jsonUtil_ utiltiies */
#include "nodeTimers.h" /* for ... maintenance timers */
#include "daemon_common.h" /* for UNUSED() */
void daemon_sigchld_hdlr ( void ) { ; }
/** Daemon timer handler */
void _timer_handler ( int sig, siginfo_t *si, void *uc)
{
timer_t * tid_ptr = (void**)si->si_value.sival_ptr ;
UNUSED(sig);
UNUSED(uc);
if ( !(*tid_ptr) )
{
return ;
}
else
{
mtcTimer_stop_tid_int_safe (tid_ptr);
}
}
int alarmHdlr_request_handler ( char * msg_ptr )
{
int rc = FAIL_JSON_PARSE ;
struct json_object *raw_obj = json_tokener_parse( msg_ptr );
jlog ("Alarm Request: %s\n", msg_ptr );
if ( raw_obj )
{
int elements ;
/* Check response sanity */
rc = jsonUtil_array_elements ( msg_ptr, MTCALARM_REQ_LABEL, elements );
if ( elements )
{
#define PARSE_FAILURE ((const char *)"failed to parse value for key")
string alarmid = "" ;
string hostname = "" ;
string operation = "" ;
string severity = "" ;
string entity = "" ;
string prefix = "" ;
string alarm_req = "" ;
for ( int i = 0 ; i < elements ; i++ )
{
if ( ( rc = jsonUtil_get_array_idx ( msg_ptr, MTCALARM_REQ_LABEL, i, alarm_req ) ) == PASS )
{
if (( rc = jsonUtil_get_key_val ( (char*)alarm_req.data(), MTCALARM_REQ_KEY__ALARMID, alarmid )) != PASS )
{
elog ("%s '%s'\n", PARSE_FAILURE, MTCALARM_REQ_KEY__ALARMID);
}
else if (( rc = jsonUtil_get_key_val ( (char*)alarm_req.data(), MTCALARM_REQ_KEY__HOSTNAME, hostname )) != PASS )
{
elog ("%s '%s'\n", PARSE_FAILURE, MTCALARM_REQ_KEY__HOSTNAME);
}
else if (( rc = jsonUtil_get_key_val ( (char*)alarm_req.data(), MTCALARM_REQ_KEY__OPERATION, operation )) != PASS )
{
elog ("%s '%s'\n", PARSE_FAILURE, MTCALARM_REQ_KEY__OPERATION);
}
else if (( rc = jsonUtil_get_key_val ( (char*)alarm_req.data(), MTCALARM_REQ_KEY__SEVERITY, severity)) != PASS )
{
elog ("%s '%s'\n", PARSE_FAILURE, MTCALARM_REQ_KEY__SEVERITY);
}
else if (( rc = jsonUtil_get_key_val ( (char*)alarm_req.data(), MTCALARM_REQ_KEY__ENTITY, entity )) != PASS )
{
elog ("%s '%s'\n", PARSE_FAILURE, MTCALARM_REQ_KEY__ENTITY);
}
else if (( rc = jsonUtil_get_key_val ( (char*)alarm_req.data(), MTCALARM_REQ_KEY__PREFIX, prefix)) != PASS )
{
elog ("%s '%s'\n", PARSE_FAILURE, MTCALARM_REQ_KEY__PREFIX);
}
else
{
jlog ("Alarm Message has %d requests\n", elements );
rc = alarmMgr_manage_alarm ( alarmid,
hostname,
tolowercase(operation),
tolowercase(severity),
entity,
prefix);
}
if ( rc ) break ;
}
else
{
wlog ("failed to get index '%d of %d' from alarm request", i, elements);
}
} /* for loop */
}
else
{
elog ("failed to find '%s' label in json object\n", MTCALARM_REQ_LABEL );
elog (" ... %s\n", msg_ptr );
rc = FAIL_JSON_OBJECT ;
}
}
else
{
elog ("failed to parse json request\n");
elog (" ... %s\n", msg_ptr );
rc = FAIL_JSON_OBJECT ;
}
if (raw_obj) json_object_put(raw_obj);
return (rc);
}

View File

@ -0,0 +1,305 @@
/*
* Copyright (c) 2016-2017 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River Titanium Cloud Maintenance Alarm Manager Daemon Initialization
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h> /* for close and usleep */
using namespace std;
#define __MODULE_PRIVATE__
#include "daemon_ini.h" /* Ini Parser Header */
#include "daemon_common.h" /* Common definitions and types for daemons */
#include "daemon_option.h" /* Common options for daemons */
#include "alarm.h" /* module header */
#include "msgClass.h" /* for ... socket message setup */
/** Local Identity */
static string my_hostname = "" ;
static string my_local_ip = "" ;
static string my_float_ip = "" ;
/** Maintenance Alarm request socket and port - UDP over lo */
msgClassSock * mtcalarm_req_sock_ptr = NULL ;
int mtcalarm_req_port = 0 ;
/** Common Daemon Config Struct */
static daemon_config_type _config ;
daemon_config_type * daemon_get_cfg_ptr () { return &_config ; }
/* Cleanup exit handler */
void daemon_exit ( void )
{
daemon_dump_info ();
daemon_files_fini ();
/* Close sockets */
if ( mtcalarm_req_sock_ptr )
{
delete (mtcalarm_req_sock_ptr );
mtcalarm_req_sock_ptr = NULL ;
mtcalarm_req_port = 0 ;
}
exit (0);
}
/** Client Config mask */
#define CONFIG_CLIENT_MASK (CONFIG_CLIENT_PULSE_PORT)
/* Startup config read */
static int _config_handler ( void * user,
const char * section,
const char * name,
const char * value)
{
daemon_config_type* config_ptr = (daemon_config_type*)user;
if (MATCH("client", "mtcalarm_req_port"))
{
config_ptr->mtcalarm_req_port = atoi(value);
config_ptr->mask |= CONFIG_CLIENT_PULSE_PORT ;
}
else
{
return (PASS);
}
return (FAIL);
}
/* Configure the daemon */
int daemon_configure ( void )
{
int rc = FAIL ;
if (ini_parse(MTCE_CONF_FILE, _config_handler, &_config) < 0)
{
elog("Failed to load '%s'\n", MTCE_CONF_FILE );
return(FAIL_LOAD_INI);
}
get_debug_options ( MTCE_CONF_FILE, &_config );
/* Verify loaded config against an expected mask
* as an ini file fault detection method */
if ( _config.mask != CONFIG_CLIENT_MASK )
{
elog ("Client configuration failed (%x)\n",
(( -1 ^ _config.mask ) & CONFIG_CLIENT_MASK) );
rc = FAIL_INI_CONFIG ;
}
else
{
ilog("Alarm Port : %d\n", _config.mtcalarm_req_port );
rc = PASS ;
}
return (rc);
}
/****************************/
/* Initialization Utilities */
/****************************/
int daemon_socket_init ( void )
{
int rc = PASS ;
/***********************************************************/
/* Setup the Alarm Request Receiver Socket */
/***********************************************************/
mtcalarm_req_sock_ptr = new msgClassRx ( LOOPBACK_IP, _config.mtcalarm_req_port, IPPROTO_UDP);
if (rc)
return (rc) ;
if (mtcalarm_req_sock_ptr)
mtcalarm_req_sock_ptr->sock_ok(true);
return (rc);
}
/* The main heartbeat service loop */
int daemon_init ( string iface, string nodeType_str )
{
int rc = PASS ;
UNUSED(nodeType_str);
/* Assign interface to config */
_config.mgmnt_iface = (char*)iface.data() ;
if ((rc = daemon_files_init ()) != PASS)
{
elog ("daemon_files_init failed (rc:%d)\n", rc );
return ( FAIL_FILES_INIT );
}
/* Bind signal handlers */
if ((rc = daemon_signal_init ()) != PASS)
{
elog ("daemon_signal_init failed (rc:%d)\n", rc );
return ( FAIL_SIGNAL_INIT );
}
/************************************************************************
* There is no point continuing with init ; i.e. running daemon_configure,
* initializing sockets and trying to query for an ip address until the
* daemon's configuration requirements are met. Here we wait for those
* flag files to be present before continuing.
************************************************************************
* Wait for /etc/platform/.initial_config_complete & /var/run/.goenabled */
daemon_wait_for_file ( CONFIG_COMPLETE_FILE , 0);
daemon_wait_for_file ( GOENABLED_MAIN_READY , 0);
/* Configure the client */
if ((rc = daemon_configure ()) != PASS)
{
elog ("daemon_configure failed (rc:%d)\n", rc );
rc = FAIL_DAEMON_CONFIG ;
}
/* Setup messaging sockets */
else if ((rc = daemon_socket_init ()) != PASS)
{
elog ("daemon_socket_init failed (rc:%d)\n", rc );
rc = FAIL_SOCKET_INIT;
}
alarmData_init ();
return (rc);
}
void daemon_service_run ( void )
{
int rc = PASS ;
if (( mtcalarm_req_sock_ptr ) && ( mtcalarm_req_sock_ptr->getFD() ))
{
std::list<int> socks ;
/* For select dispatch */
struct timeval waitd ;
fd_set readfds;
int failed_receiver_log_throttle = 0 ;
int failed_receiver_b2b_count = 0 ;
int failed_socket_log_throttle = 0 ;
socks.clear();
socks.push_front (mtcalarm_req_sock_ptr->getFD());
socks.sort();
/* Run service forever */
for ( ; ; )
{
daemon_signal_hdlr ();
waitd.tv_sec = 0;
waitd.tv_usec = SOCKET_WAIT;
/* Initialize the master fd_set */
FD_ZERO(&readfds);
FD_SET( mtcalarm_req_sock_ptr->getFD(), &readfds);
rc = select( socks.back()+1, &readfds, NULL, NULL, &waitd);
if (( rc < 0 ) || ( rc == 0 ))
{
if (( rc < 0 ) && ( errno != EINTR ))
{
wlog_throttled ( failed_socket_log_throttle, 100,
"Socket Select Failed (%d:%m)\n", errno);
}
}
if ( FD_ISSET(mtcalarm_req_sock_ptr->getFD(), &readfds))
{
failed_socket_log_throttle = 0 ;
if ( mtcalarm_req_sock_ptr && ( mtcalarm_req_sock_ptr->sock_ok() == true ))
{
char msg [MAX_ALARM_REQ_SIZE] ;
memset ( &msg , 0, MAX_ALARM_REQ_MSG_SIZE );
int bytes = mtcalarm_req_sock_ptr->read((char*)&msg, MAX_ALARM_REQ_SIZE-1 );
if ( bytes > 0 )
{
failed_receiver_b2b_count = 0 ;
failed_receiver_log_throttle = 0 ;
if ( ( rc = alarmHdlr_request_handler ( msg )) != PASS )
{
wlog ("failed to handle alarm request (rc:%d)\n", rc );
}
}
else if ( bytes < 0 )
{
failed_receiver_b2b_count++ ;
wlog_throttled ( failed_receiver_log_throttle, 20, "alarm request receive error ; thresholeded ; (%d:%m)\n", errno );
}
else
{
failed_receiver_b2b_count++ ;
wlog_throttled ( failed_receiver_log_throttle, 20, "alarm request receive ; no data\n" );
}
}
else
{
elog ("alarm request socket error ; fatal\n");
failed_receiver_b2b_count = MAX_FAILED_B2B_RECEIVES_B4_RESTART ;
}
if ( failed_receiver_b2b_count >= MAX_FAILED_B2B_RECEIVES_B4_RESTART )
{
/* exit and allow process restart by pmond */
elog ("max (%d) alarm request receive errors reached ; forcing process restart\n", MAX_FAILED_B2B_RECEIVES_B4_RESTART );
break ;
}
}
}
}
else
{
elog ("alarm request socket error ; not initialized ; exiting\n");
}
daemon_exit();
}
/* Push daemon state to log file */
void daemon_dump_info ( void )
{
daemon_dump_membuf_banner ();
daemon_dump_membuf();
}
const char MY_DATA [100] = { "eieio\n" } ;
const char * daemon_stream_info ( void )
{
return (&MY_DATA[0]);
}
/***************************************************************************
* *
* Module Test Head *
* *
***************************************************************************/
/** Teat Head Entry */
int daemon_run_testhead ( void )
{
int rc = PASS;
return (rc);
}

View File

@ -0,0 +1,106 @@
/*
* Copyright (c) 2016-2017 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River Titanium Cloud Maintenance Alarm Manager Daemon Manager
*/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
#define __MODULE_PRIVATE__
#include "alarm.h" /* module header */
int alarmMgr_manage_alarm ( string alarmid,
string hostname,
string operation,
string severity,
string entity,
string prefix)
{
int rc = PASS ;
string action = operation ;
action.append (" alarm");
EFmAlarmSeverityT sev ;
ilog ("Alarm: alarmid:%s hostname:%s operation:%s severity:%s entity:%s prefix:%s\n",
alarmid.c_str(),
hostname.c_str(),
operation.c_str(),
severity.c_str(),
entity.c_str(),
prefix.c_str());
sev = alarmUtil_getSev_enum ( severity );
if (!operation.compare("msg"))
{
if ( sev == FM_ALARM_SEVERITY_WARNING )
{
//if ( prefix.compare("none"))
alarmUtil_warning_log ( hostname, alarmid, entity, prefix );
//else
// mtcAlarm_warning_log ( hostname, id, entity );
}
else if ( sev == FM_ALARM_SEVERITY_MINOR )
{
rc = alarmUtil_minor_log ( hostname, alarmid, entity );
}
else if ( sev == FM_ALARM_SEVERITY_MAJOR)
{
rc = alarmUtil_major_log ( hostname, alarmid, entity );
}
else if ( sev == FM_ALARM_SEVERITY_CRITICAL )
{
rc = alarmUtil_critical_log ( hostname, alarmid, entity );
}
else
{
rc = FAIL_INVALID_OPERATION ;
wlog ("Unsupported log severity '%d:%s'\n", sev, severity.c_str());
}
action="create log" ;
}
/* Get the state */
else if ( !operation.compare("clear"))
{
rc = alarmUtil_clear ( hostname, alarmid, entity );
}
else if ( !operation.compare("set") )
{
if ( sev == FM_ALARM_SEVERITY_WARNING )
rc = alarmUtil_warning ( hostname, alarmid, entity );
else if ( sev == FM_ALARM_SEVERITY_MINOR )
rc = alarmUtil_minor ( hostname, alarmid, entity );
else if ( sev == FM_ALARM_SEVERITY_MAJOR )
rc = alarmUtil_major ( hostname, alarmid, entity );
else if ( sev == FM_ALARM_SEVERITY_CRITICAL )
rc = alarmUtil_critical ( hostname, alarmid, entity );
else
{
rc = FAIL_INVALID_OPERATION ;
}
}
else
{
rc = FAIL_BAD_CASE ;
}
if ( rc )
{
elog ("%s failed to %s '%s:%s'\n", hostname.c_str(), action.c_str(), alarmid.c_str(), entity.c_str() )
}
return (rc);
}

View File

@ -0,0 +1,500 @@
/*
* Copyright (c) 2013 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River CGCS Platform common Alarm utilities
*/
#define __MODULE_PRIVATE__
#include "daemon_common.h" /* for ... daemon_is_file_present */
#include "nodeBase.h"
#include "nodeUtil.h" /* for ... get_mtclogd_sockPtr */
#include "alarm.h" /* for ... alarm Utilities */
string alarmUtil_getSev_str ( EFmAlarmSeverityT sev )
{
switch ( sev )
{
case FM_ALARM_SEVERITY_CLEAR: return ("clear");
case FM_ALARM_SEVERITY_WARNING: return ("warning");
case FM_ALARM_SEVERITY_MINOR: return ("minor");
case FM_ALARM_SEVERITY_MAJOR: return ("major");
case FM_ALARM_SEVERITY_CRITICAL:return ("critical");
default : return ("unknown");
}
}
EFmAlarmSeverityT alarmUtil_getSev_enum ( string sev )
{
if ( !sev.compare("clear")) return (FM_ALARM_SEVERITY_CLEAR) ;
if ( !sev.compare("warning")) return (FM_ALARM_SEVERITY_WARNING);
if ( !sev.compare("minor")) return (FM_ALARM_SEVERITY_MINOR);
if ( !sev.compare("major")) return (FM_ALARM_SEVERITY_MAJOR);
if ( !sev.compare("critical")) return (FM_ALARM_SEVERITY_CRITICAL);
wlog ("Unsupported severity '%s'\n", sev.c_str() );
return (FM_ALARM_SEVERITY_CLEAR) ;
}
int alarmUtil_getId_enum ( string alarmid, alarm_id_enum & id )
{
/* Get the ID */
if ( alarmid.compare(INFRA_HB_ALARM_ID) == 0 )
{
id = HBS_ALARM_ID__HB_INFRA ;
}
else if ( alarmid.compare(MGMNT_HB_ALARM_ID) == 0 )
{
id = HBS_ALARM_ID__HB_MGMNT ;
}
else if ( alarmid.compare(PMOND_ALARM_ID) == 0 )
{
id = HBS_ALARM_ID__PMOND ;
}
else if ( alarmid.compare(SERVICESTATUS_LOG_ID) == 0 )
{
id = HBS_ALARM_ID__SERVICE ;
}
else
{
wlog ("Unsupported alarm id '%s'\n", alarmid.c_str());
return (FAIL_BAD_PARM);
}
return (PASS);
}
/* update the passed in alarm struct's instance_id entity path for the specified host */
void _build_entity_path ( string & hostname, string & instance, SFmAlarmDataT & alarm )
{
snprintf ( &alarm.entity_type_id[0], FM_MAX_BUFFER_LENGTH, "system.host" );
if ( instance.empty() )
{
snprintf ( &alarm.entity_instance_id[0], FM_MAX_BUFFER_LENGTH, "%s%s",
ENTITY_PREFIX, hostname.data());
}
else
{
snprintf ( &alarm.entity_instance_id[0], FM_MAX_BUFFER_LENGTH, "%s%s.%s",
ENTITY_PREFIX, hostname.data(), instance.data());
}
}
void alarmUtil_clear_all ( string hostname )
{
SFmAlarmDataT alarm ;
string instance = "" ;
_build_entity_path ( hostname, instance, alarm );
/* This will clear all the alarms for this host ;
* even ones that are raised against this host by other daemons */
fm_clear_all ( &alarm.entity_instance_id );
}
/******************************************************************************
*
* Name : alarmUtil_query
*
* Description: Utility will query a specific alarm for its current severity
*
* @param : identity may be 200.xxx
*
* @param : instance may be
*
* host=<hostname>
*
* example:
*
* hostname=compute-1
*
* host=<hostname>.<function>=<specific>
*
* example:
*
* hostname=compute-1.process=mtcClient
*
* hostname=compute-1.sensor=Fan_PSU2
*
* Updates : None
*
* Returns : FM severity code for the specified alarm.
* FM_ALARM_SEVERITY_CLEAR if it not set.
*
******************************************************************************/
EFmAlarmSeverityT alarmUtil_query ( string hostname,
string identity,
string instance )
{
SFmAlarmDataT alarm_query ;
AlarmFilter alarm_filter ;
EFmErrorT rc ;
memset(&alarm_query, 0, sizeof(alarm_query));
memset(&alarm_filter, 0, sizeof(alarm_filter));
snprintf ( &alarm_filter.alarm_id[0], FM_MAX_BUFFER_LENGTH, "%s", identity.data());
if ( instance.empty() )
{
snprintf ( &alarm_filter.entity_instance_id[0], FM_MAX_BUFFER_LENGTH, "%s%s",
ENTITY_PREFIX, hostname.data());
}
else
{
snprintf ( &alarm_filter.entity_instance_id[0], FM_MAX_BUFFER_LENGTH, "%s%s.%s",
ENTITY_PREFIX, hostname.data(), instance.data());
}
alog ("entity_instance:%s\n", alarm_filter.entity_instance_id );
if (( rc = fm_get_fault ( &alarm_filter, &alarm_query )) == FM_ERR_OK )
{
dlog ("Found with Severity: %d\n", alarm_query.severity );
return (alarm_query.severity) ;
}
else if ( rc != FM_ERR_ENTITY_NOT_FOUND )
{
elog ("%s fm_get_fault returned error (%d)\n", hostname.c_str(), rc );
}
return (FM_ALARM_SEVERITY_CLEAR);
}
int alarmUtil_query_identity ( string identity, SFmAlarmDataT * alarm_list_ptr, unsigned int max_alarms )
{
int rc = 0 ;
if ( max_alarms == 0 )
{
slog ("max alarms is zero !\n");
}
else if ( identity.empty() )
{
slog ("empty alarm 'identity'\n");
}
else if ( alarm_list_ptr )
{
AlarmFilter alarm_filter ;
memset(&alarm_filter, 0, sizeof(alarm_filter));
snprintf ( alarm_filter.alarm_id, FM_MAX_BUFFER_LENGTH, "%s", identity.data());
rc = fm_get_faults_by_id ( &alarm_filter.alarm_id, alarm_list_ptr, &max_alarms );
alog ("%s fm_get_faults_by_id rc = %d\n", alarm_filter.alarm_id, rc );
if ( rc == FM_ERR_OK )
{
return (PASS);
}
else if ( rc == FM_ERR_ENTITY_NOT_FOUND )
{
return (RETRY);
}
else
{
return (FAIL);
}
}
else
{
slog ("caller supplied null alarm_list_ptr\n");
}
return (FAIL_NULL_POINTER);
}
/*********************************************************************************
*
* Name : alarmUtil
*
* Purpose : Primary module API used to set/clear severity alarms and logs in FM.
*
* Description : Other maintenance services are expected to use ths interface to
*
*
********************************************************************************/
int alarmUtil ( string & hostname,
string & identity,
string & instance,
SFmAlarmDataT & alarm )
{
int rc = PASS ;
// msgSock_type * mtclogd_ptr = get_mtclogd_sockPtr() ;
/* Don't report events while we are in reset mode */
if ( daemon_is_file_present ( NODE_RESET_FILE ) )
{
return (rc);
}
_build_entity_path ( hostname, instance, alarm );
#ifdef WANT_ALARM_QUERY
/* See if the alarm is already in the requested state */
EFmAlarmSeverityT curr_sev = alarmUtil_query ( hostname, identity, instance ) ;
/* If its not a log message and we are already at this
* severity level then ignore the call */
if (( alarm.alarm_state != FM_ALARM_STATE_MSG ) &&
( curr_sev == alarm.severity ))
{
ilog ("%s %s %s already at desired (%s) severity level\n",
hostname.c_str(),
identity.c_str(),
instance.c_str(),
alarmUtil_getSev_str(alarm.severity).c_str());
return (rc);
}
#endif
snprintf(&alarm.alarm_id[0], FM_MAX_BUFFER_LENGTH, "%s", identity.data());
if (( alarm.alarm_state == FM_ALARM_STATE_SET ) ||
( alarm.alarm_state == FM_ALARM_STATE_MSG ))
{
if ( alarm.alarm_state == FM_ALARM_STATE_SET )
{
alog ("%s setting %s %s alarm\n", hostname.c_str(), alarm.alarm_id, alarm.entity_instance_id );
}
else
{
alog ("%s creating %s %s log\n", hostname.c_str(), alarm.alarm_id, alarm.entity_instance_id );
}
/* Debug Logs */
alog ("%s Alarm Reason: %s\n", hostname.c_str(), alarm.reason_text );
alog ("%s Alarm Action: %s\n", hostname.c_str(), alarm.proposed_repair_action );
alog ("%s Alarm Ident : %s : %s\n", hostname.c_str(), alarm.entity_type_id, alarm.entity_instance_id );
alog ("%s Alarm State : state:%d sev:%d type:%d cause:%d sa:%c supp:%c\n",
hostname.c_str(),
alarm.alarm_state,
alarm.severity,
alarm.alarm_type,
alarm.probable_cause,
alarm.service_affecting ? 'Y' : 'N',
alarm.suppression ? 'Y' : 'N' );
ilog ( "fm_set_fault: %s %s state:%d sev:%d type:%d cause:%d sa:%c supp:%c",
hostname.c_str(),
alarm.alarm_id,
alarm.alarm_state,
alarm.severity,
alarm.alarm_type,
alarm.probable_cause,
alarm.service_affecting ? 'Y' : 'N',
alarm.suppression ? 'Y' : 'N' );
rc = fm_set_fault ( &alarm , NULL );
if ( rc != FM_ERR_OK )
{
wlog ("%s fm_set_fault call failed for alarm %s (rc:%d) ; retrying\n", hostname.c_str(), alarm.alarm_id, rc);
usleep (100000); /* sleep 100 msec */
rc = fm_set_fault ( &alarm , NULL );
if ( rc != FM_ERR_OK )
{
elog ("%s failed to set alarm %s (rc:%d) ; giving up\n", hostname.c_str(), alarm.alarm_id, rc);
rc = FAIL ;
}
}
}
else
{
AlarmFilter filter ; memset(&filter, 0, sizeof(filter));
/* Setup the alarm filter */
snprintf(filter.alarm_id, FM_MAX_BUFFER_LENGTH, "%s", alarm.alarm_id);
snprintf(filter.entity_instance_id, FM_MAX_BUFFER_LENGTH, "%s", alarm.entity_instance_id);
alog ( "fm_clear_fault: %s %s:%s", hostname.c_str(), alarm.entity_instance_id, alarm.alarm_id );
ilog ("%s clearing %s %s alarm\n", hostname.c_str(), alarm.alarm_id, alarm.entity_instance_id);
if ( ( rc = fm_clear_fault ( &filter )) != FM_ERR_OK )
{
if ( rc != FM_ERR_ENTITY_NOT_FOUND )
{
elog ("%s failed to fm_clear_fault (rc:%d)\n", hostname.c_str(), rc );
rc = FAIL ;
}
else
{
rc = PASS ;
}
}
}
return (rc);
}
/* Clear the specified hosts's alarm */
int alarmUtil_clear ( string hostname, string alarm_id , string entity )
{
alarmUtil_type * alarm_ptr = alarmData_getAlarm_ptr(alarm_id);
if ( alarm_ptr )
{
string instance = alarm_ptr->instc_prefix ;
instance.append(entity);
alarm_ptr->alarm.severity = FM_ALARM_SEVERITY_CLEAR ;
alarm_ptr->alarm.alarm_state = FM_ALARM_STATE_CLEAR ;
return ( alarmUtil ( hostname, alarm_id, instance, alarm_ptr->alarm ));
}
return (FAIL_NULL_POINTER);
}
/** Assert a specified hosts's alarm with a CRITICAL severity level */
int alarmUtil_critical ( string hostname, string alarm_id , string entity )
{
alarmUtil_type * alarm_ptr = alarmData_getAlarm_ptr(alarm_id);
if ( alarm_ptr )
{
string instance = alarm_ptr->instc_prefix ;
instance.append(entity);
alarm_ptr->alarm.severity = FM_ALARM_SEVERITY_CRITICAL ;
alarm_ptr->alarm.alarm_state = FM_ALARM_STATE_SET ;
snprintf ( alarm_ptr->alarm.reason_text, FM_MAX_BUFFER_LENGTH, "%s %s", hostname.data(), alarm_ptr->critl_reason.data());
return ( alarmUtil ( hostname, alarm_id, instance, alarm_ptr->alarm ));
}
return (FAIL_NULL_POINTER);
}
/** Assert a specified host's alarm with a MAJOR severity level */
int alarmUtil_major ( string hostname, string alarm_id , string entity )
{
alarmUtil_type * alarm_ptr = alarmData_getAlarm_ptr(alarm_id);
if ( alarm_ptr )
{
string instance = alarm_ptr->instc_prefix ;
instance.append(entity);
alarm_ptr->alarm.severity = FM_ALARM_SEVERITY_MAJOR ;
alarm_ptr->alarm.alarm_state = FM_ALARM_STATE_SET ;
snprintf ( alarm_ptr->alarm.reason_text, FM_MAX_BUFFER_LENGTH, "%s %s", hostname.data(), alarm_ptr->major_reason.data());
return ( alarmUtil ( hostname, alarm_id, instance, alarm_ptr->alarm ));
}
return (FAIL_NULL_POINTER);
}
/** Assert a specified host's alarm with a MINOR severity level */
int alarmUtil_minor ( string hostname, string alarm_id , string entity )
{
alarmUtil_type * alarm_ptr = alarmData_getAlarm_ptr(alarm_id);
if ( alarm_ptr )
{
string instance = alarm_ptr->instc_prefix ;
instance.append(entity);
alarm_ptr->alarm.severity = FM_ALARM_SEVERITY_MINOR ;
alarm_ptr->alarm.alarm_state = FM_ALARM_STATE_SET ;
snprintf ( alarm_ptr->alarm.reason_text, FM_MAX_BUFFER_LENGTH, "%s %s", hostname.data(), alarm_ptr->minor_reason.data());
return ( alarmUtil ( hostname, alarm_id, instance, alarm_ptr->alarm ));
}
return (FAIL_NULL_POINTER);
}
/** Assert a specified host's alarm with a WARNING severity level */
int alarmUtil_warning ( string hostname, string alarm_id , string entity )
{
alarmUtil_type * alarm_ptr = alarmData_getAlarm_ptr(alarm_id);
if ( alarm_ptr )
{
string instance = alarm_ptr->instc_prefix ;
instance.append(entity);
alarm_ptr->alarm.severity = FM_ALARM_SEVERITY_WARNING ;
alarm_ptr->alarm.alarm_state = FM_ALARM_STATE_SET ;
snprintf ( alarm_ptr->alarm.reason_text, FM_MAX_BUFFER_LENGTH, "%s %s", hostname.data(), alarm_ptr->minor_reason.data());
return ( alarmUtil ( hostname, alarm_id, instance, alarm_ptr->alarm ));
}
return (FAIL_NULL_POINTER);
}
/** Create CRITICAL log */
int alarmUtil_critical_log ( string hostname, string alarm_id , string entity )
{
alarmUtil_type * alarm_ptr = alarmData_getAlarm_ptr(alarm_id);
if ( alarm_ptr )
{
string instance = alarm_ptr->instc_prefix ;
instance.append(entity);
alarm_ptr->alarm.severity = FM_ALARM_SEVERITY_CRITICAL ;
alarm_ptr->alarm.alarm_state = FM_ALARM_STATE_MSG ;
snprintf ( alarm_ptr->alarm.reason_text, FM_MAX_BUFFER_LENGTH, "%s %s", hostname.data(), alarm_ptr->critl_reason.data());
return ( alarmUtil ( hostname, alarm_id, instance, alarm_ptr->alarm ));
}
return (FAIL_NULL_POINTER);
}
/** Create MAJOR log */
int alarmUtil_major_log ( string hostname, string alarm_id , string entity )
{
alarmUtil_type * alarm_ptr = alarmData_getAlarm_ptr(alarm_id);
if ( alarm_ptr )
{
string instance = alarm_ptr->instc_prefix ;
instance.append(entity);
alarm_ptr->alarm.severity = FM_ALARM_SEVERITY_MAJOR ;
alarm_ptr->alarm.alarm_state = FM_ALARM_STATE_MSG ;
snprintf ( alarm_ptr->alarm.reason_text, FM_MAX_BUFFER_LENGTH, "%s %s", hostname.data(), alarm_ptr->major_reason.data());
return ( alarmUtil ( hostname, alarm_id, instance, alarm_ptr->alarm ));
}
return (FAIL_NULL_POINTER);
}
/** Create MINOR log */
int alarmUtil_minor_log ( string hostname, string alarm_id , string entity )
{
alarmUtil_type * alarm_ptr = alarmData_getAlarm_ptr(alarm_id);
if ( alarm_ptr )
{
string instance = alarm_ptr->instc_prefix ;
instance.append(entity);
alarm_ptr->alarm.severity = FM_ALARM_SEVERITY_MINOR ;
alarm_ptr->alarm.alarm_state = FM_ALARM_STATE_MSG ;
snprintf ( alarm_ptr->alarm.reason_text, FM_MAX_BUFFER_LENGTH, "%s %s", hostname.data(), alarm_ptr->minor_reason.data());
return ( alarmUtil ( hostname, alarm_id, instance, alarm_ptr->alarm ));
}
return (FAIL_NULL_POINTER);
}
/** Create WARNING log */
int alarmUtil_warning_log ( string hostname, string alarm_id, string entity, string prefix )
{
alarmUtil_type * alarm_ptr = alarmData_getAlarm_ptr(alarm_id);
if ( alarm_ptr )
{
string instance = alarm_ptr->instc_prefix ;
instance.append(prefix);
alarm_ptr->alarm.severity = FM_ALARM_SEVERITY_WARNING ;
alarm_ptr->alarm.alarm_state = FM_ALARM_STATE_MSG ;
snprintf ( alarm_ptr->alarm.reason_text, FM_MAX_BUFFER_LENGTH, "%s %s", hostname.data(), entity.data());
return ( alarmUtil ( hostname, alarm_id, instance, alarm_ptr->alarm ));
}
return (FAIL_NULL_POINTER);
}

View File

@ -0,0 +1,108 @@
#! /bin/sh
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# chkconfig: 2345 95 95
#
### BEGIN INIT INFO
# Provides: mtcalarm
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Maintenance Alarm Daemon
### END INIT INFO
. /etc/init.d/functions
DAEMON_NAME="mtcalarmd"
DAEMON="/usr/local/bin/${DAEMON_NAME}"
PIDFILE="/var/run/${DAEMON_NAME}.pid"
PLATFORM_CONF="/etc/platform/platform.conf"
IFACE=""
# Linux Standard Base (LSB) Error Codes
RETVAL=0
GENERIC_ERROR=1
INVALID_ARGS=2
UNSUPPORTED_FEATURE=3
NOT_INSTALLED=5
NOT_RUNNING=7
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
export PATH
if [ ! -e "${DAEMON}" ] ; then
logger "${DAEMON} is missing"
exit ${NOT_INSTALLED}
fi
case "$1" in
start)
logger "Starting ${DAEMON_NAME}"
echo -n "Starting ${DAEMON_NAME}: "
if [ -n "`pidof ${DAEMON_NAME}`" ] ; then
echo -n "is already running "
RETVAL=0
else
start-stop-daemon --start -b -x ${DAEMON} -- -l
RETVAL=$?
fi
if [ ${RETVAL} -eq 0 ] ; then
pid=`pidof ${DAEMON_NAME}`
echo "OK"
logger "${DAEMON} (${pid})"
else
echo "FAIL"
RETVAL=${GENERIC_ERROR}
fi
;;
stop)
logger "Stopping ${DAEMON_NAME}"
echo -n "Stopping ${DAEMON_NAME}: "
if [ -n "`pidof ${DAEMON_NAME}`" ] ; then
killproc ${DAEMON_NAME}
fi
if [ -n "`pidof ${DAEMON_NAME}`" ] ; then
echo "FAIL"
RETVAL=${NOT_RUNNING}
else
echo "OK"
fi
rm -f ${PIDFILE}
;;
restart)
$0 stop
$0 start
;;
status)
pid=`pidof ${DAEMON_NAME}`
RETVAL=$?
if [ ${RETVAL} -eq 0 ] ; then
echo "${DAEMON_NAME} is running"
else
echo "${DAEMON_NAME} is NOT running"
RETVAL=${NOT_RUNNING}
fi
;;
reload)
pkill -hup ${DAEMON_NAME}
;;
condrestart)
$0 restart
;;
*)
echo "usage: $0 { start | stop | status | restart | condrestart | reload | status }"
;;
esac
exit ${RETVAL}

View File

@ -0,0 +1,17 @@
#daily
nodateext
start 1
compress
copytruncate
notifempty
missingok
/var/log/mtcalarmd.log
{
size 10M
rotate 20
sharedscripts
postrotate
systemctl reload syslog-ng > /dev/null 2>&1 || true
endscript
}

View File

@ -0,0 +1,17 @@
[process]
process = mtcalarmd
service = mtcalarm
pidfile = /var/run/mtcalarmd.pid
script = /etc/init.d/mtcalarmd
style = lsb ; ocf or lsb
severity = major ; minor, major, critical
restarts = 3 ; restart retries before error assertion
interval = 1 ; number of seconds to wait between restarts
debounce = 3 ; number of seconds that a process needs to remain
; running before degrade is removed and retry count
; is cleared.
startuptime = 1 ; Seconds to wait after process start before starting the debounce monitor
mode = passive ; Monitoring mode: passive (default) or active
; passive: process death monitoring (default: always)
; active : heartbeat monitoring, i.e. request / response messaging
; ignore : do not monitor or stop monitoring

View File

@ -0,0 +1,14 @@
[Unit]
Description=Titanium Cloud Maintenance Alarm Handler Client
After=network.target syslog.service config.service
Before=pmon.service
[Service]
Type=forking
ExecStart=/etc/rc.d/init.d/mtcalarm start
ExecStop=/etc/rc.d/init.d/mtcalarm stop
ExecReload=/etc/rc.d/init.d/mtcalarm reload
PIDFile=/var/run/mtcalarmd.pid
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,91 @@
#
# Copyright (c) 2013-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
SRCS = regexUtil.cpp \
timeUtil.cpp \
ipmiUtil.cpp \
pingUtil.cpp \
keyClass.cpp \
hostClass.cpp \
nodeClass.cpp \
nodeBase.cpp \
nodeTimers.cpp \
nodeUtil.cpp \
hostUtil.cpp \
nodeEvent.cpp \
alarmUtil.cpp \
nlEvent.cpp \
jsonUtil.cpp \
httpUtil.cpp \
tokenUtil.cpp \
msgClass.cpp
COMMON_OBJS = regexUtil.o \
timeUtil.o \
pingUtil.o \
keyClass.o \
keyClass.cpp \
hostClass.o \
nodeClass.o \
nodeBase.o \
nodeTimers.o \
nodeUtil.o \
hostUtil.o \
nodeEvent.o \
alarmUtil.o \
nlEvent.o \
jsonUtil.o \
httpUtil.o \
tokenUtil.o \
msgClass.o
OBJS = $(SRCS:.cpp=.o)
LDLIBS += -lstdc++ -ldaemon -lcommon -lfmcommon -lrt -lpq -levent -ljson-c -lcrypto -luuid
INCLUDES = -I../daemon -I../alarm -I../maintenance -I../heartbeat -I.. -I.
CCFLAGS = -g -O2 -Wall -Wextra -Werror -std=c++11
STATIC_ANALYSIS_TOOL = cppcheck
STATIC_ANALYSIS_TOOL_EXISTS = $(shell [[ -e `which $(STATIC_ANALYSIS_TOOL)` ]] && echo 1 || echo 0)
ifeq (,$(shell which ${CC}))
CC=g++
endif
.cpp.o:
$(CXX) $(CCFLAGS) $(INCLUDES) $(EXTRACCFLAGS) -c $< -o $@
static_analysis:
ifeq ($(STATIC_ANALYSIS_TOOL_EXISTS), 1)
$(STATIC_ANALYSIS_TOOL) --language=c++ --enable=warning -U__AREA__ -UWANT_FIT_TESTING *.cpp *.h
else
echo "Warning: '$(STATIC_ANALYSIS_TOOL)' static analysis tool not installed ; bypassing ..."
endif
lib: clean threadUtil static_analysis $(OBJS) library
build: threadUtil static_analysis $(OBJS) library
threadUtil:
$(CXX) -c threadUtil.cpp $(CCFLAGS) $(INCLUDES) $(EXTRACCFLAGS) $(LDLIBS) -lpthread -o threadUtil.o
ar rcs libthreadUtil.a threadUtil.o $(EXTRAARFLAGS)
library:
ar rcs libcommon.a $(COMMON_OBJS) $(EXTRAARFLAGS)
ar rcs libipmiUtil.a ipmiUtil.o $(EXTRAARFLAGS)
ar rcs libpingUtil.a pingUtil.o $(EXTRAARFLAGS)
ar rcs libnodeBase.a nodeBase.o $(EXTRAARFLAGS)
ar rcs libregexUtil.a regexUtil.o $(EXTRAARFLAGS)
ar rcs libhostUtil.a hostUtil.o $(EXTRAARFLAGS)
testhead:
$(CCFLAGS) $(INCLUDES) -L../daemon -L../common -L. $(LDLIBS) -lpingUtil -lnodeBase -lregexUtil -lhostUtil
fsync: fsync.o
$(CC) fsync.o -L../daemon -L../common -L. -ldaemon -lcommon -o fsync
clean:
@rm -f *.o *.a fsync *.o

View File

@ -0,0 +1,422 @@
/*
* Copyright (c) 2013, 2016 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River CGCS Platform common Alarm utilities
*/
#include "daemon_common.h" /* for ... daemon_is_file_present */
#include "nodeBase.h"
#include "nodeUtil.h" /* for ... get_mtclogd_sockPtr */
#include "alarmUtil.h" /* for ... alarmUtilClass and Utilities */
alarmUtilClass __alarmObject ;
/* module init */
void alarmUtil_init ( void )
{
snprintf ( &__alarmObject.varlog_filename[0], MAX_FILENAME_LEN, "/var/log/%s_alarm.log",
program_invocation_short_name );
}
/********************** alarmUtilClass API Implementation ************************/
alarmUtilClass::alarmUtilClass()
{
temp_str[0] = '\0';
varlog_filename[0] = '\0';
//ilog ("class constructor\n");
alarmUtil_init ();
}
alarmUtilClass::~alarmUtilClass()
{
// ilog ("class destructor\n");
}
/***************************** Open API Implementation ***************************/
string alarmUtil_getSev_str ( EFmAlarmSeverityT sev )
{
switch ( sev )
{
case FM_ALARM_SEVERITY_CLEAR: return ("clear");
case FM_ALARM_SEVERITY_WARNING: return ("warning");
case FM_ALARM_SEVERITY_MINOR: return ("minor");
case FM_ALARM_SEVERITY_MAJOR: return ("major");
case FM_ALARM_SEVERITY_CRITICAL:return ("critical");
default : return ("unknown");
}
}
EFmAlarmSeverityT alarmUtil_getSev_enum ( string sev )
{
if ( !sev.compare("clear")) return (FM_ALARM_SEVERITY_CLEAR) ;
if ( !sev.compare("warning")) return (FM_ALARM_SEVERITY_WARNING);
if ( !sev.compare("minor")) return (FM_ALARM_SEVERITY_MINOR);
if ( !sev.compare("major")) return (FM_ALARM_SEVERITY_MAJOR);
if ( !sev.compare("critical")) return (FM_ALARM_SEVERITY_CRITICAL);
wlog ("Unsupported severity '%s'\n", sev.c_str() );
return (FM_ALARM_SEVERITY_CLEAR) ;
}
/* update the passed in alarm struct's instance_id entity path for the specified host */
void _build_entity_path ( string & hostname, string & instance, SFmAlarmDataT & alarm )
{
snprintf ( &alarm.entity_type_id[0], FM_MAX_BUFFER_LENGTH, "system.host" );
if ( instance.empty() )
{
snprintf ( &alarm.entity_instance_id[0], FM_MAX_BUFFER_LENGTH, "%s%s",
ENTITY_PREFIX, hostname.data());
}
else
{
snprintf ( &alarm.entity_instance_id[0], FM_MAX_BUFFER_LENGTH, "%s%s.%s",
ENTITY_PREFIX, hostname.data(), instance.data());
}
}
void alarmUtil_clear_all ( string hostname )
{
SFmAlarmDataT alarm ;
string instance = "" ;
_build_entity_path ( hostname, instance, alarm );
/* This will clear all the alarms for this host ;
* even ones that are raised against this host by other daemons */
fm_clear_all_async ( &alarm.entity_instance_id );
}
/******************************************************************************
*
* Name : alarmUtil_query
*
* Description: Utility will query a specific alarm for its current severity
*
* @param : identity may be 200.xxx
*
* @param : instance may be
*
* host=<hostname>
*
* example:
*
* hostname=compute-1
*
* host=<hostname>.<function>=<specific>
*
* example:
*
* hostname=compute-1.process=mtcClient
*
* hostname=compute-1.sensor=Fan_PSU2
*
* Updates : None
*
* Returns : FM severity code for the specified alarm.
* FM_ALARM_SEVERITY_CLEAR if it not set.
*
******************************************************************************/
EFmAlarmSeverityT alarmUtil_query ( string & hostname,
string & identity,
string & instance )
{
SFmAlarmDataT alarm_query ;
AlarmFilter alarm_filter ;
EFmErrorT rc ;
memset(&alarm_query, 0, sizeof(alarm_query));
memset(&alarm_filter, 0, sizeof(alarm_filter));
snprintf ( &alarm_filter.alarm_id[0], FM_MAX_BUFFER_LENGTH, "%s", identity.data());
if ( instance.empty() )
{
snprintf ( &alarm_filter.entity_instance_id[0], FM_MAX_BUFFER_LENGTH, "%s%s",
ENTITY_PREFIX, hostname.data());
}
else
{
snprintf ( &alarm_filter.entity_instance_id[0], FM_MAX_BUFFER_LENGTH, "%s%s.%s",
ENTITY_PREFIX, hostname.data(), instance.data());
}
alog ("entity_instance:%s\n", alarm_filter.entity_instance_id );
if (( rc = fm_get_fault ( &alarm_filter, &alarm_query )) == FM_ERR_OK )
{
dlog ("Found with Severity: %d\n", alarm_query.severity );
return (alarm_query.severity) ;
}
else if ( rc != FM_ERR_ENTITY_NOT_FOUND )
{
elog ("%s fm_get_fault returned error (%d)\n", hostname.c_str(), rc );
}
return (FM_ALARM_SEVERITY_CLEAR);
}
int alarmUtil_query_identity ( string identity, SFmAlarmDataT * alarm_list_ptr, unsigned int max_alarms )
{
int rc = 0 ;
if ( max_alarms == 0 )
{
slog ("max alarms is zero !\n");
}
else if ( identity.empty() )
{
slog ("empty alarm 'identity'\n");
}
else if ( alarm_list_ptr )
{
AlarmFilter alarm_filter ;
memset(&alarm_filter, 0, sizeof(alarm_filter));
snprintf ( alarm_filter.alarm_id, FM_MAX_BUFFER_LENGTH, "%s", identity.data());
rc = fm_get_faults_by_id ( &alarm_filter.alarm_id, alarm_list_ptr, &max_alarms );
alog ("%s fm_get_faults_by_id rc = %d\n", alarm_filter.alarm_id, rc );
if ( rc == FM_ERR_OK )
{
return (PASS);
}
else if ( rc == FM_ERR_ENTITY_NOT_FOUND )
{
return (RETRY);
}
else
{
return (FAIL);
}
}
else
{
slog ("caller supplied null alarm_list_ptr\n");
}
return (FAIL_NULL_POINTER);
}
/*********************************************************************************
*
* Name : alarmUtil
*
* Purpose : Primary module API used to set/clear severity alarms and logs in FM.
*
* Description : Other maintenance services are expected to use ths interface to
*
*
********************************************************************************/
int alarmUtil ( string & hostname,
string & identity,
string & instance,
SFmAlarmDataT & alarm )
{
int rc = PASS ;
// msgSock_type * mtclogd_ptr = get_mtclogd_sockPtr() ;
/* Don't report events while we are in reset mode */
if ( daemon_is_file_present ( NODE_RESET_FILE ) )
{
return (rc);
}
_build_entity_path ( hostname, instance, alarm );
#ifdef WANT_ALARM_QUERY
/* See if the alarm is already in the requested state */
EFmAlarmSeverityT curr_sev = alarmUtil_query ( hostname, identity, instance ) ;
/* If its not a log message and we are already at this
* severity level then ignore the call */
if (( alarm.alarm_state != FM_ALARM_STATE_MSG ) &&
( curr_sev == alarm.severity ))
{
alog ("%s %s %s already at desired (%s) severity level\n",
hostname.c_str(),
identity.c_str(),
instance.c_str(),
alarmUtil_getSev_str(alarm.severity).c_str());
return (rc);
}
#endif
snprintf(&alarm.alarm_id[0], FM_MAX_BUFFER_LENGTH, "%s", identity.data());
if (( alarm.alarm_state == FM_ALARM_STATE_SET ) ||
( alarm.alarm_state == FM_ALARM_STATE_MSG ))
{
if ( alarm.alarm_state == FM_ALARM_STATE_SET )
{
alog ("%s setting %s %s alarm\n", hostname.c_str(), alarm.alarm_id, alarm.entity_instance_id );
}
else
{
alog ("%s creating %s %s log\n", hostname.c_str(), alarm.alarm_id, alarm.entity_instance_id );
}
/* Debug Logs */
alog ("%s Alarm Reason: %s\n", hostname.c_str(), alarm.reason_text );
alog ("%s Alarm Action: %s\n", hostname.c_str(), alarm.proposed_repair_action );
alog ("%s Alarm Ident : %s : %s\n", hostname.c_str(), alarm.entity_type_id, alarm.entity_instance_id );
alog ("%s Alarm State : state:%d sev:%d type:%d cause:%d sa:%c supp:%c\n",
hostname.c_str(),
alarm.alarm_state,
alarm.severity,
alarm.alarm_type,
alarm.probable_cause,
alarm.service_affecting ? 'Y' : 'N',
alarm.suppression ? 'Y' : 'N' );
snprintf (&__alarmObject.temp_str[0], MAX_API_LOG_LEN-1,
"\n%s [%5d] fm_set_fault: %s %s state:%d sev:%d type:%d cause:%d sa:%c supp:%c",
pt(), getpid(), hostname.c_str(), alarm.alarm_id, alarm.alarm_state,
alarm.severity,
alarm.alarm_type,
alarm.probable_cause,
alarm.service_affecting ? 'Y' : 'N',
alarm.suppression ? 'Y' : 'N' );
//send_log_message ( mtclogd_ptr, hostname.data(), &__alarmObject.varlog_filename[0],
// &__alarmObject.temp_str[0] );
nodeUtil_latency_log ( hostname, NODEUTIL_LATENCY_MON_START , 0 );
rc = fm_set_fault_async ( &alarm , NULL );
nodeUtil_latency_log ( hostname, "fm_set_fault - alarm - common" , LATENCY_1SEC );
snprintf (&__alarmObject.temp_str[0], MAX_API_LOG_LEN-1,
"%s [%5d] fm_set_fault: %s returned %d",
pt(), getpid(), hostname.c_str(), rc );
//send_log_message ( mtclogd_ptr, hostname.data(), &__alarmObject.varlog_filename[0],
// &__alarmObject.temp_str[0] );
if ( rc != FM_ERR_OK )
{
elog ("%s failed to set alarm %s (rc:%d)\n", hostname.c_str(), alarm.alarm_id, rc);
rc = FAIL ;
}
}
else // ( alarm.alarm_state == FM_ALARM_STATE_CLEAR )
{
AlarmFilter filter ; memset(&filter, 0, sizeof(filter));
/* Setup the alarm filter */
snprintf(filter.alarm_id, FM_MAX_BUFFER_LENGTH, "%s", alarm.alarm_id);
snprintf(filter.entity_instance_id, FM_MAX_BUFFER_LENGTH, "%s", alarm.entity_instance_id);
snprintf (&__alarmObject.temp_str[0], MAX_API_LOG_LEN-1, "\n%s [%5d] fm_clear_fault: %s %s:%s",
pt(), getpid(), hostname.c_str(), alarm.entity_instance_id, alarm.alarm_id );
// send_log_message ( mtclogd_ptr, hostname.data(), &__alarmObject.varlog_filename[0],
// &__alarmObject.temp_str[0] );
alog ("%s clearing %s %s alarm\n", hostname.c_str(), alarm.alarm_id, alarm.entity_instance_id);
nodeUtil_latency_log ( hostname, NODEUTIL_LATENCY_MON_START , 0 );
if ( ( rc = fm_clear_fault_async ( &filter )) != FM_ERR_OK )
{
if ( rc != FM_ERR_ENTITY_NOT_FOUND )
{
elog ("%s failed to fm_clear_fault (rc:%d)\n", hostname.c_str(), rc );
rc = FAIL ;
}
}
nodeUtil_latency_log ( hostname, "fm_clear_fault - common" , LATENCY_1SEC );
}
return (rc);
}
/* Clear the specified hosts's alarm */
int alarmUtil_clear ( string hostname, string identity, string instance, SFmAlarmDataT & alarm )
{
alarm.severity = FM_ALARM_SEVERITY_CLEAR ;
alarm.alarm_state = FM_ALARM_STATE_CLEAR ;
return ( alarmUtil ( hostname, identity, instance, alarm ));
}
/************************* A L A R M I N G **************************/
/** Assert a specified hosts's alarm with a CRITICAL severity level */
int alarmUtil_critical ( string hostname, string identity, string instance, SFmAlarmDataT & alarm )
{
alarm.severity = FM_ALARM_SEVERITY_CRITICAL ;
alarm.alarm_state = FM_ALARM_STATE_SET ;
return ( alarmUtil ( hostname, identity, instance, alarm ));
}
/** Assert a specified host's alarm with a MAJOR severity level */
int alarmUtil_major ( string hostname, string identity, string instance, SFmAlarmDataT & alarm )
{
alarm.severity = FM_ALARM_SEVERITY_MAJOR ;
alarm.alarm_state = FM_ALARM_STATE_SET ;
return ( alarmUtil ( hostname, identity, instance, alarm ));
}
/** Assert a specified host's alarm with a MINOR severity level */
int alarmUtil_minor ( string hostname, string identity, string instance, SFmAlarmDataT & alarm )
{
alarm.severity = FM_ALARM_SEVERITY_MINOR ;
alarm.alarm_state = FM_ALARM_STATE_SET ;
return ( alarmUtil ( hostname, identity, instance, alarm ));
}
/** Assert a specified host's mtce alarm with a WARNING severity level */
int alarmUtil_warning ( string hostname, string identity, string instance, SFmAlarmDataT & alarm )
{
alarm.severity = FM_ALARM_SEVERITY_WARNING ;
alarm.alarm_state = FM_ALARM_STATE_SET ;
return ( alarmUtil ( hostname, identity, instance, alarm ));
}
/*************************** L O G G I N G **********************************/
/** Create a CRITICAL log */
int alarmUtil_critical_log ( string hostname, string identity, string instance, SFmAlarmDataT & alarm )
{
alarm.severity = FM_ALARM_SEVERITY_CRITICAL ;
alarm.alarm_state = FM_ALARM_STATE_MSG ;
return ( alarmUtil ( hostname,identity, instance, alarm ));
}
/** Create a MAJOR log */
int alarmUtil_major_log ( string hostname, string identity, string instance, SFmAlarmDataT & alarm )
{
alarm.severity = FM_ALARM_SEVERITY_MAJOR ;
alarm.alarm_state = FM_ALARM_STATE_MSG ;
return ( alarmUtil ( hostname, identity, instance, alarm ));
}
/** Create a MINOR log */
int alarmUtil_minor_log ( string hostname, string identity, string instance, SFmAlarmDataT & alarm )
{
alarm.severity = FM_ALARM_SEVERITY_MINOR ;
alarm.alarm_state = FM_ALARM_STATE_MSG ;
return ( alarmUtil ( hostname, identity, instance, alarm ));
}
/** Create a WARNING log */
int alarmUtil_warning_log ( string hostname, string identity, string instance, SFmAlarmDataT & alarm )
{
alarm.severity = FM_ALARM_SEVERITY_WARNING ;
alarm.alarm_state = FM_ALARM_STATE_MSG ;
return ( alarmUtil ( hostname, identity, instance, alarm ));
}
/** Create a neutral log */
int alarmUtil_log ( string hostname, string identity, string instance, SFmAlarmDataT & alarm )
{
alarm.alarm_state = FM_ALARM_STATE_MSG ;
return ( alarmUtil ( hostname, identity, instance, alarm ));
}

View File

@ -0,0 +1,142 @@
#ifndef __ALARMUTIL_H__
#define __ALARMUTIL_H__
/*
* Copyright (c) 2013, 2016 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River CGTS Platform Common Maintenance 'Alarm' Header
*/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
//using namespace std;
/* external header APIs */
#include "nodeBase.h"
#include "fmAPI.h" /* for fm_set_fault, fm_clear_fault, etc */
#define ENTITY_PREFIX ((const char *)"host=")
#define MAX_ALARMS (10)
#define SWERR_ALARM_ID ((const char *)"200.000") /* Do No Use */
#define LOCK_ALARM_ID ((const char *)"200.001")
#define ENABLE_ALARM_ID ((const char *)"200.004")
#define MGMNT_HB_ALARM_ID ((const char *)"200.005")
#define PMOND_ALARM_ID ((const char *)"200.006")
#define SENSOR_ALARM_ID ((const char *)"200.007") /* Sensor read alarm ; i.e. the sensor read value bad */
#define INFRA_HB_ALARM_ID ((const char *)"200.009")
#define BM_ALARM_ID ((const char *)"200.010")
#define CONFIG_ALARM_ID ((const char *)"200.011")
#define CH_CONT_ALARM_ID ((const char *)"200.012") /* Combo Host Controller Failure - with Active Compute */
#define CH_COMP_ALARM_ID ((const char *)"200.013") /* Combo Host Compute Failure - on last Controller */
#define SENSORCFG_ALARM_ID ((const char *)"200.014") /* Sensor configuration alarm ; i.e. could not add */
#define SENSORGROUP_ALARM_ID ((const char *)"200.015") /* Sensor Group Read Error */
#define EVENT_LOG_ID ((const char *)"200.020")
#define COMMAND_LOG_ID ((const char *)"200.021")
#define STATECHANGE_LOG_ID ((const char *)"200.022")
#define SERVICESTATUS_LOG_ID ((const char *)"200.023") /* log used to report service failure events against */
/**
* TODO: This class is more of a place holder for
* more centralized management of alarms
* It is useless in its present form.
**/
class alarmUtilClass
{
private:
public:
alarmUtilClass();
~alarmUtilClass();
char temp_str [MAX_API_LOG_LEN] ;
char varlog_filename[MAX_FILENAME_LEN];
};
typedef struct
{
SFmAlarmDataT alarm ;
string name ;
string instc_prefix ; /* Instance prefix i.e. "=sensor." or "=process." */
string critl_reason ;
string minor_reason ;
string major_reason ;
string clear_reason ;
} alarmUtil_type ;
/** Converts FM severity to representative string */
string alarmUtil_getSev_str ( EFmAlarmSeverityT sev );
EFmAlarmSeverityT alarmUtil_getSev_enum ( string sev );
/* Clear all alarms against this host */
void alarmUtil_clear_all ( string hostname );
/**
* Query the specified alarm severity level.
* Severity levels are specified in fmAPI.h
**/
EFmAlarmSeverityT alarmUtil_query ( string & hostname,
string & identity,
string & instance );
int alarmUtil_query_identity ( string identity,
SFmAlarmDataT * alarm_list_ptr,
unsigned int alarms_max );
int alarmUtil_clear ( string hostname, string identity, string instance, SFmAlarmDataT & alarm );
/************************* A L A R M I N G **************************/
/**
* Assert a unique identity alarm or log against specified
* hostname/instance using the supplied alarm data
**/
int alarmUtil (string & hostname, string & identity, string & instance, SFmAlarmDataT & alarm);
/** Return a string that represents the specified severity enum */
string alarmUtil_getSev_str ( EFmAlarmSeverityT sev );
/** Assert a specified host's alarm with a CRITICAL severity level */
int alarmUtil_critical ( string hostname, string identity, string instance, SFmAlarmDataT & alarm );
/** Assert a specified host's alarm with a MAJOR severity level */
int alarmUtil_major ( string hostname, string identity, string instance, SFmAlarmDataT & alarm );
/** Assert a specified host's alarm with a MINOR severity level */
int alarmUtil_minor ( string hostname, string identity, string instance, SFmAlarmDataT & alarm );
/** Assert a specified host's mtce alarm with a WARNING severity level */
int alarmUtil_warning ( string hostname, string identity, string instance, SFmAlarmDataT & alarm );
/*************************** L O G G I N G **********************************/
/** Create a CRITICAL log */
int alarmUtil_critical_log ( string hostname, string identity, string instance, SFmAlarmDataT & alarm );
/** Create a MAJOR log */
int alarmUtil_major_log ( string hostname, string identity, string instance, SFmAlarmDataT & alarm );
/** Create a MINOR log */
int alarmUtil_minor_log ( string hostname, string identity, string instance, SFmAlarmDataT & alarm );
/** Create a WARNING log */
int alarmUtil_warning_log ( string hostname, string identity, string instance, SFmAlarmDataT & alarm );
/** Create a neutral customer log */
int alarmUtil_log ( string hostname, string identity, string instance, SFmAlarmDataT & alarm );
#endif /* __ALARMUTIL_H__ */

View File

@ -0,0 +1,170 @@
#ifndef __INCLUDE_FITCODES_H__
#define __INCLUDE_FITCODES_H__
/*
* Copyright (c) 2013, 2016 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River CGTS Platform Common Fault Insertion Code Definitions
*/
/*************************************************************************************
*
* These definitions are used for fault insertion testing.
*
* Here are examples of how they are used,
*
* - touch the 'no_reboot' file on the mtcClient to cause it to
* servie the reboot request but don't actually reboot
*
* - touch the 'no_mgmnt_ack' file on the mtcClient to cause
* it to handle command requests but drop/not send the ack message
* if it came in on themanagement network ; same for infra
*
* - touch the 'no_mtcAlive file to tell mtcClient to stop sending
* its mtcAlive messages while this file is present.
*
**************************************************************************************/
/**
* This is the Fault Insertion Dir - Code that looks for multiple fit files need not
* bother if the dir is not present
**/
#define MTC_CMD_FIT__DIR ("/var/run/fit")
#define MTC_CMD_FIT__NO_REBOOT ("/var/run/fit/no_reboot") /* mtcClient */
#define MTC_CMD_FIT__NO_RESET ("/var/run/fit/no_reset") /* mtcClient */
#define MTC_CMD_FIT__NO_WIPEDISK ("/var/run/fit/no_wipedisk") /* mtcClient */
#define MTC_CMD_FIT__NO_MGMNT_ACK ("/var/run/fit/no_mgmnt_ack") /* mtcClient */
#define MTC_CMD_FIT__NO_INFRA_ACK ("/var/run/fit/no_infra_ack") /* mtcClient */
#define MTC_CMD_FIT__NO_MTCALIVE ("/var/run/fit/no_mtcalive") /* mtcClient */
#define MTC_CMD_FIT__MGMNT_RXSOCK ("/var/run/fit/mgmnt_rxsock") /* mtcClient */
#define MTC_CMD_FIT__MGMNT_TXSOCK ("/var/run/fit/mgmnt_txsock") /* mtcClient */
#define MTC_CMD_FIT__INFRA_RXSOCK ("/var/run/fit/infra_rxsock") /* mtcClient */
#define MTC_CMD_FIT__INFRA_TXSOCK ("/var/run/fit/infra_txsock") /* mtcClient */
#define MTC_CMD_FIT__RMON_SOCK ("/var/run/fit/rmon_sock") /* mtcClient */
#define MTC_CMD_FIT__AMON_SOCK ("/var/run/fit/amon_sock") /* mtcClient */
#define MTC_CMD_FIT__NO_INFRA_RSP ("/var/run/fit/no_infra_rsp") /* hbsClient */
#define MTC_CMD_FIT__NO_MGMNT_RSP ("/var/run/fit/no_mgmnt_rsp") /* hbsClient */
#define MTC_CMD_FIT__LINKLIST ("/var/run/fit/linklist") /* hbsAgent */
#define MTC_CMD_FIT__HBSSILENT ("/var/run/fit/hbs_silent_fault") /* hbsAgent */
#define MTC_CMD_FIT__SENSOR_DATA ("/var/run/fit/sensor_data") /* hwmond */
#define MTC_CMD_FIT__POWER_CMD ("/var/run/fit/power_cmd_result") /* mtcAgent */
#define MTC_CMD_FIT__MC_INFO ("/var/run/fit/mc_info") /* mtcAgent */
#define MTC_CMD_FIT__POWER_STATUS ("/var/run/fit/power_status") /* mtcAgent */
#define MTC_CMD_FIT__RESTART_CAUSE ("/var/run/fit/restart_cause") /* mtcAgent */
#define MTC_CMD_FIT__UPTIME ("/var/run/fit/uptime") /* mtcAgent */
#define MTC_CMD_FIT__LOUD_BM_PW ("/var/run/fit/loud_bm_pw") /* mtcAgent & hwmond */
#define MTC_CMD_FIT__START_SVCS ("/var/run/fit/host_services") /* mtcClient */
#define MTC_CMD_FIT__NO_HS_ACK ("/var/run/fit/no_hs_ack") /* mtcClient */
#define MTC_CMD_FIT__GOENABLE_AUDIT ("/var/run/fit/goenable_audit") /* mtcAgent */
/*****************************************************
* Fault Insertion Codes
*****************************************************/
/*****************************************************************************
*
* the fit /var/run/fit/fitinfo file contains the following format,
* - code and process are required
* - other fields are optional
* - no spaces, exclude <>
*
* proc=<process shortname>
* code=<decimal number>
* host=<hostname>
* name=<some string>
* data=<some string>
*
*****************************************************************************/
/*********************** Common FIT Codes **********************************/
#define FIT_CODE__NONE (0)
#define FIT_CODE__CORRUPT_TOKEN (1)
#define FIT_CODE__ADD_DELETE (2)
#define FIT_CODE__STUCK_TASK (3)
#define FIT_CODE__AVOID_N_FAIL_IPMITOOL_REQUEST (4)
#define FIT_CODE__THREAD_TIMEOUT (5)
#define FIT_CODE__THREAD_SEGFAULT (6)
#define FIT_CODE__SIGNAL_NOEXIT (7)
#define FIT_CODE__STRESS_THREAD (8)
#define FIT_CODE__DO_NOTHING_THREAD (9)
#define FIT_CODE__EMPTY_BM_PASSWORD (10)
#define FIT_CODE__INVALIDATE_MGMNT_IP (11)
#define FIT_CODE__INVALIDATE_INFRA_IP (12)
#define FIT_CODE__WORK_QUEUE (13)
#define FIT_CODE__NO_READY_EVENT (14)
#define FIT_CODE__NO_PULSE_REQUEST (15)
#define FIT_CODE__NO_PULSE_RESPONSE (16)
#define FIT_CODE__FAST_PING_AUDIT_HOST (20)
#define FIT_CODE__FAST_PING_AUDIT_ALL (21)
#define FIT_CODE__TRANSLATE_LOCK_TO_FORCELOCK (30)
#define FIT_CODE__LOCK_HOST (31)
#define FIT_CODE__FORCE_LOCK_HOST (32)
#define FIT_CODE__UNLOCK_HOST (33)
#define FIT_CODE__FM_SET_ALARM (40)
#define FIT_CODE__FM_GET_ALARM (41)
#define FIT_CODE__FM_QRY_ALARMS (42)
#define FIT_CODE__IPMI_COMMAND_SEND (60)
#define FIT_CODE__IPMI_COMMAND_RECV (61)
#define FIT_CODE__START_HOST_SERVICES (70)
#define FIT_CODE__STOP_HOST_SERVICES (71)
/***************** Process Fit Codes ********************************/
/* Hardware Monitor FIT Codes */
#define FIT_CODE__HWMON__CORRUPT_TOKEN (101)
#define FIT_CODE__HWMON__AVOID_TOKEN_REFRESH (102)
#define FIT_CODE__HWMON__THREAD_TIMEOUT (103)
#define FIT_CODE__HWMON__AVOID_SENSOR_QUERY (104)
#define FIT_CODE__HWMON__SENSOR_STATUS (105)
#define FIT_CODE__HWMON__STARTUP_STATES_FAILURE (106)
#define FIT_CODE__HWMON__HTTP_LOAD_SENSORS (120)
#define FIT_CODE__HWMON__HTTP_ADD_SENSOR (121)
#define FIT_CODE__HWMON__HTTP_DEL_SENSOR (122)
#define FIT_CODE__HWMON__HTTP_MOD_SENSOR (123)
#define FIT_CODE__HWMON__ADD_SENSOR (130)
#define FIT_CODE__HWMON__BAD_SENSOR (131)
#define FIT_CODE__HWMON__GET_SENSOR (132)
#define FIT_CODE__HWMON__CREATE_ORPHAN_SENSOR_ALARM (136)
#define FIT_CODE__HWMON__HTTP_LOAD_GROUPS (140)
#define FIT_CODE__HWMON__HTTP_ADD_GROUP (141)
#define FIT_CODE__HWMON__HTTP_DEL_GROUP (142)
#define FIT_CODE__HWMON__HTTP_MOD_GROUP (143)
#define FIT_CODE__HWMON__HTTP_GROUP_SENSORS (144)
#define FIT_CODE__HWMON__ADD_GROUP (150)
#define FIT_CODE__HWMON__BAD_GROUP (151)
#define FIT_CODE__HWMON__GET_GROUP (152)
#define FIT_CODE__HWMON__CREATE_ORPHAN_GROUP_ALARM (156)
#define FIT_CODE__HWMON__NO_DATA (160)
#define FIT_CODE__HWMON__RAISE_SENSOR_ALARM (170)
#define FIT_CODE__HWMON__CLEAR_SENSOR_ALARM (171)
#define FIT_CODE__HWMON__RAISE_GROUP_ALARM (172)
#define FIT_CODE__HWMON__CLEAR_GROUP_ALARM (173)
#define FIT_CODE__HWMON__SET_DB_SENSOR_STATUS (175)
#define FIT_CODE__HWMON__SET_DB_SENSOR_STATE (176)
#define FIT_CODE__HWMON__SET_DB_GROUP_STATUS (177)
#define FIT_CODE__HWMON__SET_DB_GROUP_STATE (178)
#endif /* __INCLUDE_FITCODES_H__ */

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
/* helper app to fsync a single file/directory */
int main(int argc, char **argv)
{
int fd,rc;
if (argc != 2) {
printf("usage: %s <path/to/file>\n", argv[0]);
return -1;
}
fd = open(argv[1], O_RDONLY);
if (fd == -1) {
printf("unable to open file %s: %m\n", argv[1]);
return -1;
}
rc = fsync(fd);
if (rc == -1) {
printf("error fsyncing file %s: %m\n", argv[1]);
}
if (close(fd) == -1) {
printf("error closing file %s: %m\n", argv[1]);
}
return rc;
}

View File

@ -0,0 +1,454 @@
/*
* Copyright (c) 2015 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River CGTS Platform Host Base Class Member Implementation.
*/
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <errno.h> /* for ENODEV, EFAULT and ENXIO */
#include <unistd.h> /* for close and usleep */
using namespace std;
#ifdef __AREA__
#undef __AREA__
#define __AREA__ "~~~"
#endif
#include "nodeBase.h"
#include "hostClass.h"
#include "nodeUtil.h"
hostBaseClass::hostBaseClass() /* constructor */
{
for(unsigned int i = 0; i < MAX_HOSTS; ++i)
{
host_ptrs[i] = NULL;
}
bm_provisioned= false;
head = tail = NULL;
memory_allocs = 0 ;
memory_used = 0 ;
hosts = 0 ;
service = 0 ;
/* Start with null identity */
my_hostname.clear() ;
my_local_ip.clear() ;
my_float_ip.clear() ;
}
hostBaseClass::~hostBaseClass() /* destructor */
{
host * ptr = head ;
host * temp_ptr = ptr ;
while ( ptr != NULL )
{
temp_ptr = ptr ;
ptr = ptr->next ;
delHost (temp_ptr);
}
if ( memory_used != 0 )
{
elog ( "Apparent Memory Leak - Allocs:%d and Bytes:%d\n",
memory_allocs, memory_used );
}
else
{
dlog ( "No Memory Leaks\n\n");
}
}
/*
* Allocates memory for a new host and stores its the address in host_ptrs
*
* @param void
* @return pointer to the newly allocted host memory
*/
struct hostBaseClass::host * hostBaseClass::newHost ( void )
{
struct hostBaseClass::host * host_ptr = NULL ;
if ( memory_allocs == 0 )
{
memset ( host_ptrs, 0 , sizeof(struct host *)*MAX_HOSTS);
}
// find an empty spot
for ( int i = 0 ; i < MAX_HOSTS ; i++ )
{
if ( host_ptrs[i] == NULL )
{
host_ptrs[i] = host_ptr = new host ;
memory_allocs++ ;
memory_used += sizeof (struct hostBaseClass::host);
// ilog ("%p:%p - mem after new: allocs:%d used:%d\n", host_ptr , host_ptrs[i], memory_allocs, memory_used);
return host_ptr ;
}
}
elog ( "Failed to save new host pointer address\n" );
return host_ptr ;
}
/* Frees the memory of a pre-allocated host and removes
* it from the host_ptrs list
* @param host * pointer to the host memory address to be freed
* @return int return code { PASS or -EINVAL }
*/
int hostBaseClass::delHost ( struct hostBaseClass::host * host_ptr )
{
if ( memory_allocs > 0 )
{
for ( int i = 0 ; i < MAX_NODES ; i++ )
{
if ( host_ptrs[i] == host_ptr )
{
// ilog ("%p:%p - mem before del: allocs:%d used:%d\n", host_ptr , host_ptrs[i], memory_allocs, memory_used);
delete host_ptr ;
host_ptrs[i] = NULL ;
memory_allocs-- ;
memory_used -= sizeof (struct hostBaseClass::host);
return PASS ;
}
}
elog ( "Error: Unable to validate memory address being freed\n" );
}
else
elog ( "Error: Free memory called when there is no memory to free\n" );
return -EINVAL ;
}
/*
* Allocate new host and tack it on the end of the host_list
*/
struct
hostBaseClass::host* hostBaseClass::addHost( string hostname )
{
/* verify host is not already provisioned */
struct host * ptr = getHost ( hostname );
if ( ptr )
{
if ( remHost ( hostname ) )
{
/* Should never get here but if we do then */
/* something is seriously wrong */
elog ("Error: Unable to remove host during reprovision\n");
return static_cast<struct host *>(NULL);
}
}
/* allocate memory for new host */
ptr = newHost ();
if( ptr == NULL )
{
elog ( "Error: Failed to allocate memory for new host\n" );
return static_cast<struct host *>(NULL);
}
/* Init the new host */
ptr->hostname = hostname ;
/* If the host list is empty add it to the head */
if( head == NULL )
{
head = ptr ;
tail = ptr ;
ptr->prev = NULL ;
ptr->next = NULL ;
}
else
{
/* link the new_host to the tail of the host_list
* then mark the next field as the end of the host_list
* adjust tail to point to the last host
*/
tail->next = ptr ;
ptr->prev = tail ;
ptr->next = NULL ;
tail = ptr ;
}
hosts++ ;
return ptr ;
}
struct hostBaseClass::host* hostBaseClass::getHost ( string hostname )
{
/* check for empty list condition */
if ( head == NULL )
return NULL ;
for ( struct host * ptr = head ; ; ptr = ptr->next )
{
if ( !hostname.compare ( ptr->hostname ))
{
// ilog ("%s %p\n", hostname.c_str(), ptr );
return ptr ;
}
else if ( !hostname.compare ( ptr->uuid ))
{
// ilog ("%s %p\n", hostname.c_str(), ptr );
return ptr ;
}
if (( ptr->next == NULL ) || ( ptr == tail ))
break ;
}
return static_cast<struct host *>(NULL);
}
/* Remove a hist from the linked list of hosts - may require splice action */
int hostBaseClass::remHost( string hostname )
{
if ( hostname.c_str() == NULL )
return -ENODEV ;
if ( head == NULL )
return -ENXIO ;
struct host * ptr = getHost ( hostname );
if ( ptr == NULL )
return -EFAULT ;
/* If the host is the head host */
if ( ptr == head )
{
/* only one host in the list case */
if ( head == tail )
{
dlog ("Single Host -> Head Case\n");
head = NULL ;
tail = NULL ;
}
else
{
dlog ("Multiple Hosts -> Head Case\n");
head = head->next ;
head->prev = NULL ;
}
}
/* if not head but tail then there must be more than one
* host in the list so go ahead and chop the tail.
*/
else if ( ptr == tail )
{
dlog ("Multiple Host -> Tail Case\n");
tail = tail->prev ;
tail->next = NULL ;
}
else
{
dlog ("Multiple Host -> Full Splice Out\n");
ptr->prev->next = ptr->next ;
ptr->next->prev = ptr->prev ;
}
delHost ( ptr );
hosts-- ;
return (PASS) ;
}
/******************************************************************************************
******************************************************************************************
*****************************************************************************************/
int hostBaseClass::add_host ( node_inv_type & inv )
{
int rc = FAIL ;
struct hostBaseClass::host * host_ptr = static_cast<struct host *>(NULL);
if (( inv.name.empty()) ||
( !inv.name.compare ("none")) ||
( !inv.name.compare ("None")))
{
wlog ("Refusing to add host with 'null' or 'invalid' hostname (%s)\n",
inv.uuid.c_str());
return (FAIL_INVALID_HOSTNAME) ;
}
host_ptr = hostBaseClass::getHost(inv.name);
if ( host_ptr )
{
dlog ("%s Already provisioned\n", host_ptr->hostname.c_str());
/* Send back a retry in case the add needs to be converted to a modify */
return (RETRY);
}
/* Otherwise add it as a new host */
else
{
if ( daemon_get_cfg_ptr()->debug_level > 1 )
print_inv ( inv );
host_ptr = hostBaseClass::addHost(inv.name);
if ( host_ptr )
{
host_ptr->ip = inv.ip ;
host_ptr->mac = inv.mac ;
host_ptr->uuid = inv.uuid ;
host_ptr->type = inv.type ;
host_ptr->nodetype = CGTS_NODE_NULL ;
host_ptr->retries = 0 ;
host_ptr->toggle = false ;
/* Add to the end of inventory */
hostlist.push_back ( host_ptr->hostname );
dlog ("%s Added Host Base\n", inv.name.c_str());
rc = PASS ;
}
else
{
elog ("%s Host Base Add Failed\n", inv.name.c_str());
rc = FAIL_NULL_POINTER ;
}
}
return (rc);
}
int hostBaseClass::rem_host ( string hostname )
{
int rc = FAIL ;
if ( ! hostname.empty() )
{
hostlist.remove ( hostname );
rc = hostBaseClass::remHost ( hostname );
}
return ( rc );
}
int hostBaseClass::del_host ( string hostname )
{
int rc = FAIL_DEL_UNKNOWN ;
hostBaseClass::host * host_ptr = hostBaseClass::getHost( hostname );
if ( host_ptr )
{
rc = rem_host ( host_ptr->hostname );
if ( rc == PASS )
{
dlog ("%s Deleted\n", host_ptr->hostname.c_str());
print_node_info();
}
else
{
elog ("%s Delete Failed (rc:%d)\n", hostname.c_str(), rc );
}
}
else
{
wlog ("Unknown hostname: %s\n", hostname.c_str());
}
return (rc);
}
/** Get this hosts uuid address */
string hostBaseClass::get_uuid ( string hostname )
{
hostBaseClass::host * host_ptr ;
host_ptr = hostBaseClass::getHost ( hostname );
if ( host_ptr != NULL )
{
return (host_ptr->uuid );
}
elog ("%s uuid lookup failed\n", hostname.c_str() );
return ("");
}
/** Get this hosts uuid address */
string hostBaseClass::get_hostname ( string uuid )
{
hostBaseClass::host * host_ptr ;
host_ptr = hostBaseClass::getHost ( uuid );
if ( host_ptr != NULL )
{
return (host_ptr->hostname );
}
elog ("%s hostname lookup failed\n", uuid.c_str() );
return ("");
}
/** Get this hosts ip address */
string hostBaseClass::get_ip ( string hostname )
{
hostBaseClass::host * host_ptr ;
host_ptr = hostBaseClass::getHost ( hostname );
if ( host_ptr != NULL )
{
return (host_ptr->ip );
}
elog ("%s ip lookup failed\n", hostname.c_str() );
return ("");
}
static string null_str = "" ;
string hostBaseClass::get_hostaddr ( string hostname )
{
hostBaseClass::host* host_ptr ;
host_ptr = hostBaseClass::getHost ( hostname );
if ( host_ptr != NULL )
{
return ( host_ptr->ip );
}
return ( null_str );
}
void hostBaseClass::print_node_info ( void )
{
fflush (stdout);
fflush (stderr);
}
void hostBaseClass::memLogDelimit ( void )
{
char str[MAX_MEM_LOG_DATA] ;
snprintf (&str[0], MAX_MEM_LOG_DATA, "-------------------------------------------------------------\n");
mem_log (str);
}
void hostBaseClass::mem_log_host ( struct hostBaseClass::host * host_ptr )
{
char str[MAX_MEM_LOG_DATA] ;
snprintf (&str[0], MAX_MEM_LOG_DATA, "%s\t%s - %s - %s - %s\n",
host_ptr->hostname.c_str(),
host_ptr->ip.c_str(),
host_ptr->mac.c_str(),
host_ptr->uuid.c_str(),
host_ptr->type.c_str());
mem_log (str);
}
void hostBaseClass::memDumpNodeState ( string hostname )
{
hostBaseClass::host* host_ptr ;
host_ptr = hostBaseClass::getHost ( hostname );
if ( host_ptr == NULL )
{
mem_log ( hostname, ": ", "Not Found hostBaseClass\n" );
return ;
}
else
{
mem_log_host ( host_ptr );
// memLogDelimit ();
}
}

View File

@ -0,0 +1,221 @@
#ifndef __INCLUDE_HOSTCLASS_H__
#define __INCLUDE_HOSTCLASS_H__
/*
* Copyright (c) 2015 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River CGTS Platform Host Maintenance "Host Manager"
* class, support structs and enums.
*/
#include <sys/types.h>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <list>
#include <vector>
//using namespace std;
#include "nodeTimers.h" /* for ... mtcTimer */
/**
* @addtogroup hostBaseClass
* @{
* This class is used to maintain a linked list of hosts for a given application.
*/
class hostBaseClass
{
private:
/**
* A single host entity within the hostBaseClass.
* Used to build a linked list of added/provisioned hosts.
*/
struct host {
/** The name of the host */
std::string hostname ;
/** The name of the host */
std::string uuid ;
/** The IP address of the host */
std::string ip ;
/** The Mac address of the host node */
std::string mac ;
/** A string indicating the host type as 'compute' , 'storage' or 'controller' */
std::string type ;
/** The Type ; host specific service refinement */
int nodetype ;
/** general retry counter */
int retries ;
/** Generic toggle switch */
bool toggle ;
/** Pointer to the previous host in the list */
struct host * prev;
/** Pointer to the next host in the list */
struct host * next;
} ;
struct host * head ; /**< Host Linked List Head pointer */
struct host * tail ; /**< Host Linked List Tail pointer */
/** Allocate memory for a new host.
*
* Preserves the host address in the host_ptr list and increments
* the memory_allocs counter used by the inservice test audit.
*
* @return
* a pointer to the memory of the newly allocated host */
struct hostBaseClass::host * newHost ( void );
/** Start heartbeating a new host.
*
* host is added to the end of the host linked list.
*
* @param host_info_ptr
* is a pointer containing pertinent info about the physical host
* @return
* a pointer to the newly added host
*/
struct hostBaseClass::host* addHost ( string hostname );
/** Get pointer to "hostname" host.
*
* Host list lookup by pointer from hostname.
*
* @param host_info_ptr
* is a pointer containing info required to find the host in the host list
* @return
* a pointer to the hostname's host
*/
struct hostBaseClass::host* getHost ( string hostname );
/** Free the memory of a previously allocated host.
*
* The memory to be removed is found in the host_ptr list, cleared and
* the memory_allocs counter is decremented.
* If the memory cannot be found then an error is returned.
*
* @param host_ptr
* is a pointer to the host to be freed
* @return
* a signed integer of PASS or -EINVAL
*/
int delHost ( struct hostBaseClass::host * host_ptr );
/** Remove a host from the linked list.
*
* Node is spliced out of the host linked list.
*
* @param node_info_ptr
* is a pointer containing info required to find the host in the host list
* @return
* an integer of PASS or -EINVAL */
int remHost ( string hostname );
/** List of allocated host memory.
*
* An array of host pointers.
*/
hostBaseClass::host * host_ptrs[MAX_HOSTS] ;
/** A memory allocation counter.
*
* Should represent the number of hosts in the linked list.
*/
int memory_allocs ;
/** A memory used counter
*
* A variable storing the accumulated host memory
*/
int memory_used ;
void mem_log_host ( struct hostBaseClass::host * host_ptr );
/** Public Interfaces that allow hosts to be
* added or removed from maintenance.
*/
public:
hostBaseClass(); /**< constructor */
~hostBaseClass(); /**< destructor */
/**< The service this list is associated with */
int service ;
int hosts ;
string my_hostname ; /**< My hostname */
string my_local_ip ; /**< Primary IP address */
string my_float_ip ; /**< Secondary (floating) IP address */
bool bm_provisioned ;
/** Add a host to the linked list using public API */
int add_host ( node_inv_type & inv );
/** Mod a host to the linked list using public API */
int mod_host ( node_inv_type & inv );
/** Remove a host from the linked list using public API */
int rem_host ( string hostname );
/** Free the memory of an already allocated host link using public API */
int del_host ( string hostname );
string get_ip ( string hostname );
string get_uuid ( string hostname );
string get_hostaddr ( string hostname );
string get_hostname ( string uuid );
void memLogDelimit ( void ); /**< Debug log delimiter */
void memDumpNodeState ( string hostname );
void memDumpAllState ( void );
void print_node_info ( void ); /**< Print node info banner */
/** This is a list of host names. */
std::list<string> hostlist ;
std::list<string>::iterator hostlist_iter_ptr ;
} ;
/**
* @addtogroup hostBaseClass_base
* @{
*/
hostBaseClass * get_hostBaseClass_ptr ( void );
/* allocates hostBaseClass obj_ptr and host_ptr */
#define GET_HOST_PTR(hostname) \
hostBaseClass * obj_ptr = get_hostBaseClass_ptr () ; \
hostBaseClass::host * host_ptr = obj_ptr->getHost ( hostname ) ; \
if ( host_ptr == NULL ) \
{ \
elog ("%s hostname unknown\n", hostname.c_str()); \
return (FAIL_HOSTNAME_LOOKUP); \
}
#endif // __INCLUDE_HOSTCLASS_H__

View File

@ -0,0 +1,209 @@
/*
* Copyright (c) 2013, 2016 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/**
* @file
* Wind River CGCS Platform - Host Server Utility Module
*/
#include "hostUtil.h"
string hostUtil_getServiceIp ( mtc_service_enum service )
{
string ip = "0.0.0.0" ;
daemon_config_type * cfg_ptr = daemon_get_cfg_ptr();
switch (service)
{
case SERVICE_SYSINV:
{
ip = cfg_ptr->sysinv_api_bind_ip ;
break ;
}
case SERVICE_TOKEN:
{
if ( cfg_ptr->keystone_auth_host)
{
ip = cfg_ptr->keystone_auth_host;
}
else
{
ip = "localhost";
}
break ;
}
case SERVICE_SMGR:
case SERVICE_VIM:
{
ip = "localhost" ;
break ;
}
default:
{
slog ("Unsupported service (%d)\n", service );
break ;
}
}
return (ip);
}
string hostUtil_getPrefixPath ( )
{
string prefix_path = "";
daemon_config_type * cfg_ptr = daemon_get_cfg_ptr();
if ( cfg_ptr->keystone_prefix_path)
{
prefix_path = cfg_ptr->keystone_prefix_path;
}
return (prefix_path);
}
int hostUtil_getServicePort ( mtc_service_enum service )
{
daemon_config_type * cfg_ptr = daemon_get_cfg_ptr();
switch (service)
{
case SERVICE_SYSINV:
return(cfg_ptr->sysinv_api_port);
case SERVICE_SMGR:
return(cfg_ptr->ha_port);
case SERVICE_VIM:
return(cfg_ptr->vim_cmd_port);
case SERVICE_TOKEN:
return(cfg_ptr->keystone_port);
default:
{
slog ("Unsupported service (%d)\n", service );
break ;
}
}
return (0);
}
bool hostUtil_is_valid_ip_addr ( string ip )
{
if ( !ip.empty() )
if ( ip.compare(NONE) )
return (true);
return (false);
}
bool hostUtil_is_valid_mac_addr ( string mac )
{
if ( !mac.empty() )
if ( mac.length() == COL_CHARS_IN_MAC_ADDR )
return (true);
return (false);
}
bool hostUtil_is_valid_bm_type ( string bm_type )
{
dlog3 ("BM_Type:%s\n", bm_type.c_str());
if ( !bm_type.empty() )
{
if (( bm_type == "bmc" ) ||
( bm_type == "ilo" ) ||
( bm_type == "ilo3" ) ||
( bm_type == "ilo4" ) ||
( bm_type == "quanta" ))
{
return (true);
}
}
return ( false );
}
bool hostUtil_is_valid_uuid ( string uuid )
{
if (( !uuid.empty() ) && ( uuid.length() == UUID_LEN ) )
return (true);
return (false);
}
/*****************************************************************************
*
* Name : hostUtil_tmpfile
*
* Description : Create a temporary file with a randomized suffix.
* Write the specified 'data' to it and return its
* open file descriptor.
*
* The file is unlinked so that it is automatically deleted by the kernel
* when the file descriptor is closed or the program exits.
*
* TODO: fix or figure out why the unlink removes the file right away even
* with the file open.
*
*****************************************************************************/
int hostUtil_mktmpfile ( string hostname, string basename, string & filename, string data )
{
// buffer to hold the temporary file name
char tempBuff[MAX_FILENAME_LEN];
int fd = -1;
memset(tempBuff,0,sizeof(tempBuff));
if ( basename.empty() || data.empty() )
{
slog ("%s called with one or more bad parameters (%d:%d)\n",
hostname.c_str(), basename.empty(), data.empty());
return (0);
}
/* add what mkstemp will make unique */
basename.append("XXXXXX");
// Copy the relevant information in the buffers
snprintf ( &tempBuff[0], MAX_FILENAME_LEN, "%s", basename.data());
// Create the temporary file, this function will
// replace the 'X's with random letters
fd = mkstemp(tempBuff);
// Call unlink so that whenever the file is closed or the program exits
// the temporary file is deleted.
//
// Note: Unlinking removes the file immediately.
// Commenting out. Caller must remove file.
//
// unlink(tempBuff);
if(fd<1)
{
elog ("%s failed to create temp file (%d:%m)\n", hostname.c_str(), errno );
return 0 ;
}
else
{
filename = tempBuff ;
dlog2 ("%s temporary file [%s] created\n", hostname.c_str(), tempBuff );
}
// Write the data to the temporary file
if ( write ( fd, data.data(), data.size()) < 0 )
{
elog ("%s failed to write data to '%s' (%d:%m)\n",
hostname.c_str(), filename.c_str(), errno );
return 0 ;
}
else
{
dlog2 ("%s wrote %s to %s\n", hostname.c_str(), data.c_str(), filename.c_str());
}
return (fd);
}

View File

@ -0,0 +1,85 @@
#ifndef __INCLUDE_HOSTUTIL_H__
#define __INCLUDE_HOSTUTIL_H__
/*
* Copyright (c) 2013-2014, 2016 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <list>
#include <evhttp.h> /* for ... HTTP_ status definitions */
using namespace std;
#include "nodeBase.h"
/* Supported Server Names */
//#define SERVER__UNKNOWN ((const char*)"Undetermined Server")
//#define SERVER__NOKIA_QUANTA_1234_GEN1 ((const char*)"Quanta Computer")
//#define SERVER__HP_PROLIANT_DL380_GEN9 ((const char*)"ProLiant DL380 Gen9")
//#define SERVER__HP_PROLIANT_DL360_GEN9 ((const char*)"ProLiant DL360 Gen9")
/* Supported Board Management Controller Names */
//#define SERVER_BMC__UNKNOWN ((const char*)"Unknown BMC")
//#define SERVER_BMC__STANDARD_ILO_V3 ((const char*)"iLO 3 Standard")
//#define SERVER_BMC__STANDARD_ILO_V4 ((const char*)"iLO 4 Standard")
/* A list of supported servers */
//typedef enum
//{
// SERVER_IS_UNKNOWN = 0,
// SERVER_IS_NOKIA__QUANTA_1234____GEN1__ILO_V4 = 1,
// SERVER_IS_HP_____PROLIANT_DL380_GEN9__ILO_V4 = 2,
// SERVER_IS_HP_____PROLIANT_DL360_GEN9__ILO_V4 = 3,
// SERVER_IS_LAST = 4
//} server_enum ;
/* Server Table Entry Type */
//typedef struct
//{
// server_enum server_code ;
// protocol_enum protocol ;
// const char * server_name ;
// const char * server_bmc ;
// const char * profile ;
//
//} server_table_entry_type ;
//server_table_entry_type * hostUtil_get_server_info ( server_enum server_code );
typedef enum
{
CLIENT_NONE = 0,
CLIENT_SYSINV = 1,
CLIENT_VIM_HOSTS = 2,
CLIENT_VIM_SYSTEMS = 3,
CLIENT_SENSORS = 4,
CLIENT_SENSORGROUPS = 5,
CLIENT_SM = 6,
} mtc_client_enum ;
typedef enum
{
SERVICE_SYSINV = 0,
SERVICE_TOKEN = 1,
SERVICE_SMGR = 2,
SERVICE_VIM = 3,
} mtc_service_enum ;
string hostUtil_getServiceIp ( mtc_service_enum service );
int hostUtil_getServicePort ( mtc_service_enum service );
string hostUtil_getPrefixPath ( void );
bool hostUtil_is_valid_uuid ( string uuid );
bool hostUtil_is_valid_ip_addr ( string ip );
bool hostUtil_is_valid_bm_type ( string bm_type );
int hostUtil_mktmpfile ( string hostname, string basename, string & filename, string data );
#endif

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More