Commit Graph

1088 Commits

Author SHA1 Message Date
Digimer
0370d6acef * Fixed a bug in the network_interfaces SQL procedure that broke how data was recorded in the history schema.
* Added 'file' and 'line' arguments to the Database->insert_or_update_X methods to allow for the original caller's file and line number to be recorded in the SQL call logs.
* Cleaned up how logging to 'anvil.log' logging is handled.
* Updated anvil-update-states to ignore libvirt bridges and to manually set the speed and duplex of virtio network based interfaces.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-03-24 09:57:10 -04:00
Digimer
c21b326f1a * Changed all methods to take a 'debug' argument for setting log level on calls.
* Fixed a bug with resync, but others remain as resync is incomplete (at least for network_interfaces).
* Currently, tools/anvil-update-states is broken while working on the above issue.
* Reworked the jobs table and removed the units/anvil-jobs.service unit. Jobs will be invoked and backgrounded in all calls.
* Started adding missing hidden form fields.
* Updated the 'server' OCF resource agent version and metadata.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-03-07 03:11:55 -05:00
Digimer
f52d8196f6 * Migration is now sort of working. There is still an issue to sort out with enabling drbd dual-primary, but server can move is some cases now.
* Changed fence_pacemaker to exit with '1' on generic error as per LINBIT's comments.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-21 02:06:00 -05:00
Digimer
81534cddbc * Moved ocf:alteeve:server along... It now can properly check and report the server's status on a monitor call.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-13 23:59:07 -05:00
Digimer
636cef0564 * Barring some testing, the fence_pacemaker fence handler is done.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-11 19:32:18 -05:00
Digimer
6405483fea * Added a check to fence_pacemaker that exits with 7 if the target node is already out of the pacemaker cluster.
* Verified that the logic works in a 3-node (Anvil! + DR) cluster.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-11 02:45:56 -05:00
Digimer
26f956e429 * Much more work done on the fence handler. How able to sanity check most of the pacemaker side of things and have the framing done for sanity checking DRBD.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-08 02:03:36 -05:00
Digimer
806b452d10 Merge branch 'master' of github.com:digimer/m3
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-07 12:11:21 -05:00
Digimer
ced92139b1 * Added the new (and still very much in progress) 'fence_pacemaker' fence handler for power-fencing via DRBD.
* Updated dev notes.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-07 03:36:49 -05:00
Digimer
fe4a1d5a1c * Working on timing for DB connections.
* Created a new tool (that may go away) for monitoring for network changes as quickly and with as few resources as possible.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-01-17 15:10:07 -06:00
Digimer
2170c00add * Added the 'debug' parameter to System->check_alert_sent. Also updated it to use 'alert_sent_uuid'.
* Added the 'debug' parameter to System->enable_daemon.
* Fixed a bug where the old 'Tools.sql' files was being referenced instead of the new 'anvil.sql'.
* Added the 'debug' parameter to Database->initialize and Database->write. Also made it enable the postgresql daemon when initializing the DB.
* Added the 'debug' parameter to Get->host_uuid.
* Fixed the old anvil.conf variable from defaults::log::db_transactions to sys::database::log_transactions.
* Fixed a bad replacement variable name in anvil.sql.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-27 13:01:58 -04:00
Digimer
4e30f2024c * Changed tabs to white-spaces in the SQL source to make copy/pasting easier.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-27 02:43:32 -04:00
Digimer
f1bd4b99ca * Fixed more issues with anvil-prep-database.
* Added the 'debug' parameter to System->call(). Also added a check to make sure that the called executable exists.
* Added the 'debug' parameter to System->start_daemon().

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-27 00:45:59 -04:00
Digimer
d864bd6dac * Moved words.xml to /usr/share/anvil/
* Moved all executables to /usr/sbin/
* Made /root/anvil-backups/ the backup directory.
* Started debuging anvil-prep-database

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-26 14:12:59 -04:00
Digimer
d03213b860 * Fixed some string and path issues from the 'anvil' merger.
* Added a 'debug' parameter to System->ping() to allow per-call log levels.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-24 01:49:57 -04:00
Digimer
5976e7ea32 * Adding a new Database->insert_or_update_jobs() method and associated database tables.
* Fixed display issues when showing a summary of what will be done if the user confirms the reconfiguration of the Striker.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-13 11:40:50 -05:00
Digimer
9648e8ba43 * Create tools/anvil-jobs and units/anvil-jobs.service, which is a new daemon that will handle jobs that can take some time to finish.
* Created Storage->record_md5sums() and Storage->check_md5sums for use in daemons. These will record the md5sums of the program itself, all perl modules and the words file. When check_md5sums is called, it returns '1' if any sums have changed, which daemons can trigger on to exit (and systemd will restart them). Removed the basic md5sum check from anvil-daemon and switched to this.
* Fixed how 'fatalstobrowsers' is invoked so that it only applies to programs running in a browser.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-08 17:04:36 -05:00
Digimer
bb48c090a7 * Created Get->md5sum() to return the md5sum of the specified file.
* Updated anvil-daemon to exit if the md5sum on disk changes.
* Quieted a lot of logging.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-07 18:42:48 -05:00
Digimer
8e5e5b07d3 * Moved the buffer disable up the script.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-11-01 00:33:41 -04:00
Digimer
9e4414613b * Added a check to exit if no DBs were available in tools/anvil-update-states.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-20 13:53:01 -04:00
Digimer
1c3b3c2c9e * Fixed a bug in calling ethtool in tools/anvil-update-states and added conditionals to reading the data files.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-20 13:45:55 -04:00
Digimer
2b9c6c26dc * Fixed a couple remaining issues from the recent merger. Specifically, '$$anvil' was fixed from a bad regex and the path/names of our tools were fixed.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-20 11:13:00 -04:00
Digimer
1cb42080c3 ** Major Changes **
We've decided to give up on trying to keep ScanCore, AN::Tools and Striker as three separate things. We had originally hoped to make ScanCore easily separatable from the Anvil!, but this was adding increasing complexity to the project and complexity is the enemy of reliability.

In this release, AN::Tools becomes Anvil::Tools, all configuration files move to /etc/anvil and all programs and data files move to /usr/sbin/anvil. Words files are now merged, as are SQL schemas (ScanCore agents will still maintain their own, later). The journald tag has changed from 'an-tools' to 'anvil'.

Other changes;
* Tools.t has been updated to handle existing tests. New methods and parameters still need to have tests added though.
* Added a simple test.pl script used for testing things outside the main program. It will be removed before final release.
* Added the simple 'watch_logs' bash script to more easily tail output.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-20 00:19:32 -04:00
Digimer
eed06bdb22 * Created a dedicated loop for processes that need to run each time tools/scancore-daemon loops.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-18 11:27:57 -04:00
Digimer
886331c756 * Created the new System->get_ips method which records IP addresses, subnet masks and MAC addresses of interfaces as reported by 'ip addr'.
* Finished the form for showing the user what changes will be made.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-12 18:34:41 -04:00
Digimer
3d385a5731 * Updated the configuration step 2 to properly show interface link changes again (had to add the network status XML generator back), and added displaying the 'up order', which tells the order that interfaces last cycles. This allows a user to unplug and plug the network cables in without watching the screen and be able to determine which interfaces cycled in a given order. This makes it easier to map MAC addresses to desired roles.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-05 00:20:36 -04:00
Digimer
fa11459543 * Updated Log->entry to use the new Log::Journald method, which improved writing to log speed at high log levels dramatically (ie: 33 seconds -> 1 seconds).
* Started using Time::HiRes and recording the run time of programs using AN::Tools at log level 2.
* Added a check in tools/an-prep-database to write journald.conf.d/an.conf to disable rate limiting to allow high log levels without losing messages.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-04 02:11:03 -04:00
Digimer
1e7fe44c23 * Updated Get->host_uuid to record the UUID to a cache file when run with root privs, but read from the cache when an unpriv user.
* Added a start-check to make sure 'home' could read the host UUID and exit if not.
* Removed network_interface_current_name / network_interface_requested_name from the network_interfaces DB table and used simply network_interface_name.
* Added caching to Storage->read_file().
* Now record form answers in the variables table as 'form::<form_name>::<variable>::value' and read the same when the form is first loaded.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-09-27 03:24:27 -04:00
Digimer
96670756ab * Created Database->insert_or_update_network_interfaces to handle pushing data into update_network_interfaces.
* Updated Database->connect to always test if hosts table exists and load the core schema if not.
* Fixed Database->write to log all SQL when 'sys::database::log_transactions' is set.
* Got tools/scancore-update-states scanning and recording network interface data to the database. Also removed it writing out the XML status file.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-09-22 00:56:35 -04:00
Digimer
13352bad6d * Moved most of 'scancore-database' into the new Database->configure_pgsql() method. I had renamed that script, but now it will be removed soon.
* Created System->reload_daemon().

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-07-27 01:56:52 -04:00
Digimer
edf85511f4 * Did more work on Tools.t tests.
* Changed Log->secure and Log->level to take new settings using 'set => X' parameter to bring them inline with other modules.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-06-21 20:09:22 -04:00
Digimer
648af130cd * Finished scancore-database. It now setups/repairs postgresql database config, user and scancore database.
* Fixed a bug in Tools.pm->_set_paths where a path set to '#!not_found!#' was being set (the existing value should have been left alone).
* Fixed some escaping in Log->entry. Also added some additional checks to error more gracefully.
* Created Storage->copy_file() that, well, copies files.
* Fixed Storage->find to not call Log->entry.
* Fixed Storage->make_directory() to only pass the first digit when passed a GID or UID with more that one digit (as can happen with GIDs).
* Updated Storage->write_file() to take 'secure' as a parameter to treat the file contents as containing secure data for logging purposes.
* Created System->check_daemon and ->start_daemon to check and start systemd daemons, as needed.
* Updated scancore-daemon to support running things just once on invocation (effectively run on boot or daemon restart). Call scancore-database. from here.
* Added reading striker.conf to scancore-update-states.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-06-19 22:32:35 -04:00
Digimer
632f677f04 * Added two new modules; Convert.pm for converting data types and Database.pm for managing all things related to databases.
* Created Convert->cidr() that will convert dotted decimal subnets to CIDR notation and vice versa.
* Created Database->get_local_id that returns the ID from striker.conf that matches the local host, if any,
* Created Get->network_details that returns the host name and a list of interfaces and their IP addresses (if any).
* Created System->call() that takes a shell call and returns the output.
* Created icon for the top-right bar that are "on" (lit up).
* Created a skeleton striker.conf file.
* Created the new scancore-database tool that will manage ScanCore databases.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-06-13 17:08:38 -04:00
Digimer
e983f27de7 * Changed scancore-update-states to report link speeds > 100 Gbps as 0.
* Added polling to update the network state as needed.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-06-12 17:39:09 -04:00
Digimer
a8a98b431d * Updated the jquery to read in translated strings and to display the link speed.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-06-12 15:44:23 -04:00
Digimer
8c42b78e63 * Made some progress on displaying the network state on an HTML page using jquery. It's ugly as sin, but it works.
* Fixed a bug in Storage->write_file() where the parent directory wasn't created if it was missing. Also removed passing the mode to the parent directory creation as the file mode rarely applies to the directory (ie: 644 breaks directories but is common for files).
* Changed Template->skin to return just the skin name, not the path.
* Updated scancore-update-states to write the network state information to both xml (for ScanCore) and JSON (for jquery) files.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-06-12 14:39:20 -04:00
Digimer
bea6bc5e69 * Updated Tools->new() to check if it is being invoked in a browser and set the environment appropriately. It also sets the PWD environmental variable to the DOCUMENT_ROOT variable.
* Renamed 'defaults::languages' to 'defaults::language'.
* Created Storage->change_mode(), Storage->change_owner(), Storage->make_directory() and Storage->write_file() that does what their names imply, using the shell commands instead of the built-in commands (may switch to them later). The ->make_directory() method will create any needed parent directories.
* Moved System->read_file() to the Storage module as it made more sense there. For now, System is empty.
* Created Words->language to set or check the active output language.
* Fixed Template->get() to use Words->language.
* Updated Words->string() to take the new 'string' parameter which, when set, is used instead of the 'key' parameter and is treated as a pre-retrieved string, so replacement keys are directly injected.
* Updated Template->get() to take the 'variables' parameter and then uses Words->string({string => ...}) to process the replacement keys.
* Updated tools/scancore-update-states to write out the network interface states to the status.xml file.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-06-11 03:00:35 -04:00
Digimer
753d7a3ba6 * Created the new System.pm module with the initial read_file() method that reads files.
* Created Log->language that sets/returns the active log language.
* Created Log->variables that takes a hash reference and logs their variable: [$value] pairs.
* Created the new /usr/sbin/striker/ directory which is added to the list of search directories. We will store our tools here.
* Created the scancore-daemon and scancore-daemon.unit files which will handle all the things we used to use crontab for, minus ScanCore itself.
* Created the scancore-update-states that will eventually store some machine state information in a file that the web browser can read.
* Created the cgi-bin/home script that will be the main landing page for the Striker UI.
* Added some of the initial html files.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-06-10 02:38:04 -04:00