* Renamed the ScanCore unit file to scancore.

* Added support to parsing location contraints to Cluster->parse_cib

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 14bf323627
commit b2c7fd95fb
  1. 13
      Anvil/Tools/Cluster.pm
  2. 8
      notes
  3. 4
      ocf/alteeve/server
  4. 1
      tools/anvil-daemon
  5. 11
      tools/anvil-manage-keys
  6. 4
      tools/scancore
  7. 6
      tools/test.pl
  8. 2
      units/scancore.service

@ -423,7 +423,18 @@ sub parse_cib
}});
}
}
### TODO: /cib/configuration/constraints
foreach my $constraint ($dom->findnodes('/cib/configuration/constraints/rsc_location'))
{
my $id = $constraint->{id};
$anvil->data->{cib}{parsed}{configuration}{constraints}{location}{$id}{node} = $constraint->{node};
$anvil->data->{cib}{parsed}{configuration}{constraints}{location}{$id}{resource} = $constraint->{rsc};
$anvil->data->{cib}{parsed}{configuration}{constraints}{location}{$id}{score} = $constraint->{score};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"cib::parsed::configuration::constraints::location::${id}::node" => $anvil->data->{cib}{parsed}{configuration}{constraints}{location}{$id}{node},
"cib::parsed::configuration::constraints::location::${id}::resource" => $anvil->data->{cib}{parsed}{configuration}{constraints}{location}{$id}{resource},
"cib::parsed::configuration::constraints::location::${id}::score" => $anvil->data->{cib}{parsed}{configuration}{constraints}{location}{$id}{score},
}});
}
foreach my $node_state ($dom->findnodes('/cib/status/node_state'))
{
my $id = $node_state->{id};

@ -293,9 +293,13 @@ pcs resource clone hypervisor clone-max=2 notify="false"
pcs resource create drbd systemd:drbd op monitor interval=60
pcs resource clone drbd clone-max=2 notify="false"
pcs resource create srv07-el6 ocf:alteeve:server name="srv07-el6" meta allow-migrate="true" op monitor interval="60" on-fail="block"
# Create a new server resource, stopped, create the location constraint (higher == preferred), then start.
pcs resource create srv07-el6 ocf:alteeve:server name="srv07-el6" meta allow-migrate="true" migrate_to="INFINITY" target-role="stopped" start= stop="INFINITY" op monitor interval="60" on-fail="block"
pcs constraint location srv07-el6 prefers mk-a02n01=200 mk-a02n02=100
pcs resource enable srv07-el6
- or -
pcs resource update srv07-el6 ocf:alteeve:server name="srv07-el6" meta allow-migrate="true" op monitor interval="60" on-fail="block"
pcs resource update srv07-el6 ocf:alteeve:server name="srv07-el6" meta allow-migrate="true" migrate_to="INFINITY" stop="INFINITY" op monitor interval="60" on-fail="block"
# Test
stonith_admin --fence el8-a01n02 --verbose; crm_error $?

@ -988,7 +988,7 @@ sub server_status
# the server is failed, return OCF_ERR_GENERIC (1).
my $state = "";
my $server = $anvil->data->{environment}{OCF_RESKEY_name};
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0521", variables => { server => $server }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0521", variables => { server => $server }});
if (not $anvil->data->{environment}{OCF_RESKEY_CRM_meta_timeout})
{
@ -1140,7 +1140,7 @@ sub server_status
else
{
# In some fashion or another, the server is running. Exit with OCF_SUCCESS (rc: 0)
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0527", variables => { 'state' => $state }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0527", variables => { 'state' => $state }});
$anvil->nice_exit({exit_code => 0});
}
}

@ -15,6 +15,7 @@
# idea or not.
# - Write the status of this and the scancore daemon to /etc/anvil/anvil.motd and symlink it to /etc/motd.d/
# - Write a script that runs in crontab at UTC 17:00 that sends an email if Scancore or anvil-daemon are disabled.
# - Examine limites in: https://www.freedesktop.org/software/systemd/man/systemd.exec.html#LimitCPU=
#
# NOTE:
# - For later; 'reboot --force --force' immediately kills the OS, like disabling ACPI on EL6 and hitting the

@ -37,7 +37,11 @@ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure =
# Read switches (target ([user@]host[:port]) and the file with the target's password. If the password is
# passed directly, it will be used. Otherwise, the password will be read from the database.
$anvil->data->{switches}{'job-uuid'} = "";
$anvil->Get->switches;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
'switches::job-uuid' => $anvil->data->{switches}{'job-uuid'},
}});
$anvil->Database->connect();
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"});
@ -51,13 +55,6 @@ if (not $anvil->data->{sys}{database}{connections})
}
# Pick up the job details
$anvil->data->{switches}{'job-uuid'} = "";
$anvil->Get->switches;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
'switches::job-uuid' => $anvil->data->{switches}{'job-uuid'},
}});
# Load data.
load_job_data($anvil);
# Process the bad keys

@ -10,7 +10,7 @@
#
# TODO:
# - Decide if it's worth having a separate ScanCore.log file or just feed into anvil.log.
#
# - Examine limits in: https://www.freedesktop.org/software/systemd/man/systemd.exec.html#LimitCPU=
use strict;
use warnings;
@ -45,6 +45,8 @@ wait_for_database($anvil);
# If we're not configured, sleep.
wait_until_configured($anvil);
# Send a startup
# Disconnect. We'll reconnect inside the loop
$anvil->Database->disconnect();
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 3, key => "log_0203"});

@ -29,7 +29,7 @@ $anvil->Database->connect();
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, secure => 0, key => "log_0132"});
$anvil->Get->switches;
$anvil->Get->bridges({ debug => 2 });
my $host = $anvil->_short_host_name();
my $cib = '';
$anvil->Cluster->parse_cib({cib => $cib, debug => 2});
die;

@ -4,7 +4,7 @@ Wants=network.target
[Service]
Type=simple
ExecStart=/usr/sbin/ScanCore
ExecStart=/usr/sbin/scancore
ExecStop=/bin/kill -WINCH ${MAINPID}
Restart=always
Loading…
Cancel
Save