diff --git a/scancore-agents/scan-network/scan-network b/scancore-agents/scan-network/scan-network
index 5bad0021..f2a78f59 100755
--- a/scancore-agents/scan-network/scan-network
+++ b/scancore-agents/scan-network/scan-network
@@ -313,14 +313,14 @@ sub collect_data
type => $type,
}});
}
- elsif (-e $full_path."/master")
+ elsif ((-e $full_path."/master") && ($interface !~ /^vnet/))
{
- # No, but it's slaved to one.
+ # We're in a bond.
my $target = readlink($full_path."/master");
- $bond_master = ($target =~ /^.*\/(.*)$/)[0];
+ my $bond_master = ($target =~ /^.*\/(.*)$/)[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
target => $target,
- bond_master => $bond_master,
+ bond_master => $bond_master
}});
}
elsif (-d $full_path."/bridge")
@@ -352,6 +352,17 @@ sub collect_data
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { bridge_stp_enabled => $bridge_stp_enabled }});
}
+ # If this is a 'vnet' device, set 'operational' to up
+ if ($interface =~ /^vnet/)
+ {
+ $operational = "up";
+ $media = "virtual";
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
+ operational => $operational,
+ media => $media,
+ }});
+ }
+
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
active_interface => $active_interface,
bond_master => $bond_master,
@@ -469,7 +480,7 @@ sub collect_data
closedir(DIRECTORY);
# Find what interfaces are connected to which bridges
- $anvil->Network->bridge_info({debug => 2});
+ $anvil->Network->bridge_info({debug => 3});
delete $anvil->data->{interface_to_bridge} if exists $anvil->data->{interface_to_bridge};
foreach my $bridge_name (sort {$a cmp $b} keys %{$anvil->data->{bridge}{$local_host}})
{
diff --git a/scancore-agents/scan-server/scan-server b/scancore-agents/scan-server/scan-server
index fdf2092f..9af32f8c 100755
--- a/scancore-agents/scan-server/scan-server
+++ b/scancore-agents/scan-server/scan-server
@@ -15,6 +15,7 @@
# - Move location constraints to the host node if the server is not on the preferred host (this happens after
# recovering from a node loss).
# - Update the fence delay to favour the active host
+# - If a server isn't running, and the database definition has been updated, it isn't updated on disk.
#
use strict;
@@ -90,6 +91,9 @@ collect_data($anvil);
# Look for migration times written out by ocf:alteeve:server.
record_migration_times($anvil);
+# Check if we need to update the websocket stuff.
+check_vnc($anvil);
+
# Mark that we ran.
$anvil->Database->insert_or_update_updated({updated_by => $THIS_FILE});
@@ -99,6 +103,70 @@ $anvil->nice_exit({exit_code => 0});
# Functions #
#############################################################################################################
+#
+sub check_vnc
+{
+ my ($anvil) = @_;
+
+ ### NOTE: In the interest of time, this table is not yet in the core schema. Later, when it is, this
+ ### check can be removed.
+ # See if the 'vnc_pipes' table exists.
+ my $query = "SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 'vnc_pipes' AND table_schema = 'public';";
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0124", variables => { query => $query }});
+
+ my $count = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0];
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { count => $count }});
+
+ if ($count)
+ {
+ # For each server running here, get the VNC port and record it.
+ foreach my $server_name (sort {$a cmp $b} keys %{$anvil->data->{'scan-server'}{server_name}})
+ {
+ my $server_uuid = $anvil->data->{'scan-server'}{server_name}{$server_name}{server_uuid};
+ my $server_state = $anvil->data->{'scan-server'}{server_name}{$server_name}{server_state};
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
+ server_name => $server_name,
+ server_uuid => $server_uuid,
+ server_state => $server_state,
+ }});
+
+ next if $server_state eq "paused";
+ next if $server_state eq "shut off";
+ next if $server_state eq "crashed";
+
+ # Get the VNC port. Ignore the IP and the port number is +5900.
+ my $shell_call = $anvil->data->{path}{exe}{virsh}." vncdisplay --domain ".$server_name;
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
+
+ my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call, source => $THIS_FILE, line => __LINE__});
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { output => $output, return_code => $return_code }});
+ foreach my $line (split/\n/, $output)
+ {
+ if ($line =~ /\d.*?:(\d+)$/)
+ {
+ my $port = 5900 + $1;
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { port => $port }});
+
+ my ($variable_uuid) = $anvil->Database->insert_or_update_variables({
+ file => $THIS_FILE,
+ line => __LINE__,
+ variable_name => "server::vnc_port",
+ variable_value => $port,
+ variable_default => "",
+ variable_description => "message_0255",
+ variable_section => "servers",
+ variable_source_uuid => $server_uuid,
+ variable_source_table => "servers",
+ });
+ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { variable_uuid => $variable_uuid }});
+ }
+ }
+ }
+ }
+
+ return(0);
+}
+
# Look for migration times written out by ocf:alteeve:server.
sub record_migration_times
{
diff --git a/share/words.xml b/share/words.xml
index 25c5da6f..953f61ae 100644
--- a/share/words.xml
+++ b/share/words.xml
@@ -1848,7 +1848,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is:
We've got: [#!variable!local_server_count!#] servers, and the peer has: [#!variable!peer_server_count!#] servers. Skipping fence delay preference checks for now.We're hosting servers, and our peer is not. Making the fence delay favours this node.The Anvil! daemon is in startup mode, and the job: [#!variable!job_uuid!#], command: [#!variable!job_command!#] is not a startup job, ignoring it for now.
- Out peer is online, no need to check server location constraints.
+ Our peer is online, no need to check server location constraints.The server: [#!variable!server!#] has a location constraint that preferres our peer, but our peer is offline. Updating the location constraint to prefer this node.Disabling dual primary for the resource: [#!variable!resource!#] to the node: [#!variable!target_name!# (#!variable!target_node_id!#)].The corosync config file is being updated with these differences;
@@ -2209,6 +2209,7 @@ Are you sure that you want to delete the server: [#!variable!server_name!#]? [Ty
Found the server: [#!variable!server_name!#] in the database, loading details now.The fence delay to prefer the node: [#!variable!node!#] has been removed.The fence delay now prefers the node: [#!variable!node!#].
+ This is the TCP port that the VNC server is listening on to provide graphical access to the associated server.Saved the mail server information successfully!
diff --git a/tools/anvil-join-anvil b/tools/anvil-join-anvil
index 258e53cf..c1492f82 100755
--- a/tools/anvil-join-anvil
+++ b/tools/anvil-join-anvil
@@ -1127,7 +1127,7 @@ sub check_corosync
update_progress($anvil, ($anvil->data->{job}{progress} += 1), "job_0345");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0345"});
my $waiting = 1;
- my $anvil_uuid = $anvil->data->{sys}{anvil_uuid};
+ my $anvil_uuid = $anvil->data->{sys}{anvil_uuid};
my $new_password = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_password};
while ($waiting)
{
diff --git a/tools/anvil-provision-server b/tools/anvil-provision-server
index 7f061ae0..c48c9f0a 100755
--- a/tools/anvil-provision-server
+++ b/tools/anvil-provision-server
@@ -10,6 +10,7 @@
#
# TODO: Support cloning; Example
# - virt-clone --original-xml /mnt/shared/definitions/