diff --git a/notes b/notes
index b07f3b27..078b5f8d 100644
--- a/notes
+++ b/notes
@@ -1398,3 +1398,7 @@ totem.transport (str) = knet
====================================
+
+
+Gi1/0/24 + Gi2/0/24
+
diff --git a/share/words.xml b/share/words.xml
index 25fafecc..5e3a4916 100644
--- a/share/words.xml
+++ b/share/words.xml
@@ -1120,6 +1120,7 @@ It should be provisioned in the next minute or two.
Manage a server menu:
* Please enter the name of the server you want to manage
-=] Servers available to manage on the Anvil! [#!variable!anvil_name!#] [=-
+ -=] Managing the server: [#!variable!server_name!#] on the Anvil!: [#!variable!anvil_name!#]
Starting: [#!variable!program!#].
diff --git a/tools/anvil-manage-server b/tools/anvil-manage-server
index c253c340..4c85f886 100755
--- a/tools/anvil-manage-server
+++ b/tools/anvil-manage-server
@@ -469,14 +469,26 @@ sub interactive_question
host => $short_host_name,
});
- $anvil->data->{target_server}{server_cpu_sockets} = $anvil->data->{server}{$short_host_name}{$server_name}{from_db}{cpu}{sockets} if not defined $anvil->data->{target_server}{server_cpu_sockets};
- $anvil->data->{target_server}{server_cpu_cores} = $anvil->data->{server}{$short_host_name}{$server_name}{from_db}{cpu}{threads} if not defined $anvil->data->{target_server}{server_cpu_cores};
+ # If only VCPU is set, cores and threads will both be '1' but 'total' will be higher.
+ # Windows (and others?) interprets this as X number of single core sockets.
+ $anvil->data->{target_server}{server_cpu_total} = $anvil->data->{server}{$short_host_name}{$server_name}{from_db}{cpu}{total_cores} if not defined $anvil->data->{target_server}{server_cpu_total};
+ $anvil->data->{target_server}{server_cpu_sockets} = $anvil->data->{server}{$short_host_name}{$server_name}{from_db}{cpu}{sockets} if not defined $anvil->data->{target_server}{server_cpu_sockets};
+ $anvil->data->{target_server}{server_cpu_cores} = $anvil->data->{server}{$short_host_name}{$server_name}{from_db}{cpu}{threads} if not defined $anvil->data->{target_server}{server_cpu_cores};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:target_server::server_cpu_sockets' => $anvil->data->{target_server}{server_cpu_sockets},
's2:target_server::server_cpu_cores' => $anvil->data->{target_server}{server_cpu_cores},
+ 's3:target_server::server_cpu_total' => $anvil->data->{target_server}{server_cpu_total},
}});
- # server::an-a02n01::srv02-c8s-fujitsu:: from_db::device::disk::target::vda
+ if (($anvil->data->{target_server}{server_cpu_sockets} == 1) && ($anvil->data->{target_server}{server_cpu_cores} == 1) && ($anvil->data->{target_server}{server_cpu_total} > 1))
+ {
+ $anvil->data->{target_server}{server_cpu_sockets} = $anvil->data->{target_server}{server_cpu_total};
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
+ 's1:target_server::server_cpu_sockets' => $anvil->data->{target_server}{server_cpu_sockets},
+ }});
+ }
+
+ # Pull out the existing disks.
foreach my $target (sort {$a cmp $b} keys %{$anvil->data->{server}{$short_host_name}{$server_name}{from_db}{device}{disk}{target}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { target => $target }});
@@ -626,17 +638,13 @@ sub interactive_configure_main
{
my ($anvil, $terminal) = @_;
- my $selection = 0;
- my $retry = 0;
while(1)
{
- my $default = "";
-
print $terminal->Tputs('cl');
- print $anvil->Words->string({key => "job_0352"})."\n";
- print $anvil->Words->string({key => "job_0151", variables => { anvil_name => $anvil->data->{target_server}{anvil_name} }})."\n";
- print $anvil->Words->string({key => "job_0157", variables => { server_name => $anvil->data->{target_server}{server_name} }})."\n";
- print "\n";
+ print $anvil->Words->string({key => "job_0355", variables => {
+ anvil_name => $anvil->data->{target_server}{anvil_name},
+ server_name => $anvil->data->{target_server}{server_name},
+ }})."\n";
print "[ 1 ] - CPU\n";
print "[ 2 ] - RAM\n";
print "[ 3 ] - Storage\n";
@@ -646,15 +654,14 @@ sub interactive_configure_main
print "[ B ] - Back\n";
print "[ Q ] - Quit\n";
print "\n";
- print $terminal->Tgoto('cm', 0, 13)."? ";
+ print $terminal->Tgoto('cm', 0, 9)."? ";
my $answer = ;
chomp $answer;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { answer => $answer }});
if ($answer eq "1")
{
- print "Going to CPU menu\n";
- sleep 1;
+ interactive_configure_cpu($anvil, $terminal)
}
elsif ($answer eq "2")
{
@@ -681,12 +688,11 @@ sub interactive_configure_main
$anvil->data->{target_server}{server_name} = "";
$anvil->data->{target_server}{server_uuid} = "";
$anvil->data->{switches}{server} = "";
- print "Going back\n";
interactive_ask_server_name($anvil, $terminal);
}
elsif (lc($answer) eq "q")
{
- print "Good bye.\n";
+ print "NO CARRIER, good bye.\n";
$anvil->nice_exit({exit_code => 0});
}
else
@@ -734,6 +740,75 @@ sub interactive_configure_main
return(0);
}
+sub interactive_configure_cpu
+{
+ my ($anvil, $terminal) = @_;
+
+ while(1)
+ {
+ my $anvil_uuid = $anvil->data->{target_server}{anvil_uuid};
+ my $maximum = $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{cores} * $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads};
+ my $current_cores = $anvil->data->{target_server}{server_cpu_cores};
+
+ if (not exists $anvil->data->{new_config}{cpu}{sockets})
+ {
+ $anvil->data->{new_config}{cpu}{sockets} = "";
+ }
+ if (not exists $anvil->data->{new_config}{cpu}{cores})
+ {
+ $anvil->data->{new_config}{cpu}{cores} = "";
+ }
+
+ my $star_cores = " ";
+ if (($anvil->data->{new_config}{cpu}{cores}) && ($anvil->data->{new_config}{cpu}{cores} ne $anvil->data->{target_server}{server_cpu_cores}))
+ {
+ $star_cores = "*";
+ }
+ my $star_sockets = " ";
+ if (($anvil->data->{new_config}{cpu}{sockets}) && ($anvil->data->{new_config}{cpu}{sockets} ne $anvil->data->{target_server}{server_cpu_sockets}))
+ {
+ $star_sockets = "*";
+ }
+
+ print $terminal->Tputs('cl');
+ print $anvil->Words->string({key => "job_0355", variables => {
+ anvil_name => $anvil->data->{target_server}{anvil_name},
+ server_name => $anvil->data->{target_server}{server_name},
+ }})."\n";
+ print "* CPU configuration. Maximum cores X sockets is: [".$maximum."]\n";
+ print "[ 1 ] - Cores per socket".$star_cores." (currently: [".$anvil->data->{target_server}{server_cpu_cores}."], new: [".$anvil->data->{new_config}{cpu}{cores}."])\n";
+ print "[ 2 ] - Sockets".$star_sockets." (currently: [".$anvil->data->{target_server}{server_cpu_sockets}."], new: [".$anvil->data->{new_config}{cpu}{sockets}."])\n";
+
+ print "\n";
+ print "[ B ] - Back\n";
+ print "[ Q ] - Quit\n";
+ print $terminal->Tgoto('cm', 0, 7)."? ";
+ my $answer = ;
+ chomp $answer;
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { answer => $answer }});
+
+ if ($answer eq "1")
+ {
+ print "How many cores per socket would you like? ";
+ }
+ elsif ($answer eq "2")
+ {
+ }
+ elsif (lc($answer) eq "b")
+ {
+ }
+ elsif (lc($answer) eq "q")
+ {
+ }
+ else
+ {
+
+ }
+ }
+
+ return(0);
+}
+
sub interactive_ask_anvil_name
{
my ($anvil, $terminal) = @_;
@@ -841,7 +916,7 @@ sub interactive_ask_anvil_name
}
elsif (lc($answer) eq "q")
{
- print "Good bye.\n";
+ print "NO CARRIER, good bye.\n";
$anvil->nice_exit({exit_code => 0});
}
else
@@ -982,7 +1057,7 @@ sub interactive_ask_server_name
}
elsif (lc($answer) eq "q")
{
- print "Good bye.\n";
+ print "NO CARRIER, good bye.\n";
$anvil->nice_exit({exit_code => 0});
}
else
diff --git a/tools/fence_delay b/tools/fence_delay
index ae98f3a3..6c2c1c2b 100755
--- a/tools/fence_delay
+++ b/tools/fence_delay
@@ -37,6 +37,7 @@ my $conf = {
'system' => {
action => "off",
agent_version => "1.0",
+ do_chown => 0,
log_level => 1,
'wait' => 60,
device => "",
@@ -54,8 +55,14 @@ my $conf = {
};
# Log file for output.
+if (not -e $conf->{'system'}{'log'})
+{
+ # We'll chown the log.
+ $conf->{'system'}{do_chown} = 1;
+}
+
my $log = IO::Handle->new();
-open ($log, ">>".$conf->{'system'}{'log'}) || warn "Failed to open: [".$conf->{'system'}{'log'}."] for writing; Error: $!\n";
+open ($log, ">>".$conf->{'system'}{'log'}) || die "Failed to open: [".$conf->{'system'}{'log'}."] for writing; Error: $!\n";
# Set $log and STDOUT to hot (unbuffered) output.
if (1)
{
@@ -74,7 +81,7 @@ read_cla($conf, $log);
read_stdin($conf, $log);
# If I've been asked to show the metadata XML, do so and then exit.
-if (($conf->{'system'}{action} eq "metadata") or ($conf->{'system'}{action} eq "meta-data"))
+if ($conf->{'system'}{action} eq "metadata")
{
metadata($conf, $log);
do_exit($conf, $log, 0);
@@ -116,6 +123,16 @@ sub do_exit
# Close the log file handle, if it exists.
$log->close() if $log;
+ record($conf, $log, "system::do_chown: [".$conf->{'system'}{do_chown}."].\n", 2);
+ if ($conf->{'system'}{do_chown})
+ {
+ record($conf, $log, "Changing ownership of: [".$conf->{'system'}{do_chown}."] to [hacluster:haclient].\n", 1);
+ my $uid = getpwnam('hacluster');
+ my $gid = getgrnam('haclient');
+ record($conf, $log, "chown'ing: [".$conf->{'system'}{do_chown}."].\n", 2);
+ chown $uid, $gid, $conf->{'system'}{'log'};
+ }
+
exit ($exit_status);
}
@@ -274,36 +291,36 @@ sub read_cla
{
# Print the version information and then exit.
$conf->{'system'}{version} = 1;
- record($conf, $log, "[ Debug ] - 'system::version': . [".$conf->{'system'}{version}."]\n", 1);
+ record($conf, $log, "[ Debug ] - 'system::version': [".$conf->{'system'}{version}."]\n", 2);
}
elsif (($arg eq "-q") or ($arg eq "--quiet"))
{
# Suppress all messages, including critical messages, from STDOUT.
$conf->{'system'}{log_level} = 0;
- record($conf, $log, "[ Debug ] - 'system::log_level': [".$conf->{'system'}{quiet}."]\n", 1);
+ record($conf, $log, "[ Debug ] - 'system::log_level': [".$conf->{'system'}{quiet}."]\n", 2);
}
elsif ($arg eq "--debug")
{
# Enable debug mode.
$conf->{'system'}{log_level} = 2;
- record($conf, $log, "[ Debug ] - 'system::log_level': [".$conf->{'system'}{log_level}."]\n", 1);
+ record($conf, $log, "[ Debug ] - 'system::log_level': [".$conf->{'system'}{log_level}."]\n", 2);
}
elsif (($arg eq "-w") or ($arg eq "--wait"))
{
# How long to wait before exiting.
$set_next = "wait";
- record($conf, $log, "[ Debug ] - 'set_next': ........ [".$set_next."]\n", 1);
+ record($conf, $log, "[ Debug ] - 'set_next': [".$set_next."]\n", 2);
}
elsif (($arg eq "-o") or ($arg eq "--action"))
{
# This is the action to take.
$set_next = "action";
- record($conf, $log, "[ Debug ] - 'set_next': ........ [".$set_next."]\n", 1);
+ record($conf, $log, "[ Debug ] - 'set_next': [".$set_next."]\n", 2);
}
else
{
# Bad argument.
- record($conf, $log, "[ Warning ] - Argument: [".$arg."] is not valid arguments.\n", 1);
+ record($conf, $log, "[ Warning ] - Argument: [".$arg."] is not valid arguments.\n", 2);
}
}
@@ -344,7 +361,7 @@ sub read_stdin
my ($name, $value) = split /\s*=\s*/, $option;
# Record the line for now, but comment this out before release.
- record ($conf, $log, "Name: [$name], value: [$value].\n", 2);
+ record ($conf, $log, "Name: [$name], value: [$value].\n");
# Set my variables depending on the veriable name.
if ($name eq "agent")
@@ -352,27 +369,27 @@ sub read_stdin
# This is only used by 'fenced', but I record it for
# potential debugging.
$conf->{'system'}{agent} = $value;
- record($conf, $log, "[ Debug ] - 'system::agent': ... [".$conf->{'system'}{agent}."]\n", 1);
+ record($conf, $log, "[ Debug ] - 'system::agent': [".$conf->{'system'}{agent}."]\n", 2);
}
elsif ($name eq "action")
{
$conf->{'system'}{action} = $value;
- record($conf, $log, "[ Debug ] - 'system::action': .. [".$conf->{'system'}{action}."]\n", 1);
+ record($conf, $log, "[ Debug ] - 'system::action': [".$conf->{'system'}{action}."]\n", 2);
}
elsif ($name eq "quiet")
{
$conf->{'system'}{log_level} = 0;
- record($conf, $log, "[ Debug ] - 'system::log_level': [".$conf->{'system'}{log_level}."]\n", 1);
+ record($conf, $log, "[ Debug ] - 'system::log_level': [".$conf->{'system'}{log_level}."]\n", 2);
}
elsif ($name eq "debug")
{
$conf->{'system'}{log_level} = 2;
- record($conf, $log, "[ Debug ] - 'system::log_level': [".$conf->{'system'}{log_level}."]\n", 1);
+ record($conf, $log, "[ Debug ] - 'system::log_level': [".$conf->{'system'}{log_level}."]\n", 2);
}
elsif ($name eq "wait")
{
$conf->{'system'}{wait} = $value;
- record($conf, $log, "[ Debug ] - 'system::wait': .... [".$conf->{'system'}{'wait'}."]\n", 1);
+ record($conf, $log, "[ Debug ] - 'system::wait': [".$conf->{'system'}{wait}."]\n", 2);
}
else
{
@@ -392,7 +409,7 @@ sub record
return if $level > $conf->{'system'}{log_level};
# Print to the log
- print $log get_date_time($conf)." - ".$msg;
+ print $log $msg;
# Print to the screen if we're not 'quiet'.
print $msg if not $conf->{'system'}{quiet};