* WIP - Fixing a bug in scan-network where vnet devices aren't being recorded against their bridge.
* Updated scan-server to record the VNC port it is using in the database. Signed-off-by: Digimer <digimer@alteeve.ca>
This commit is contained in:
parent
69899455ca
commit
cebae28716
@ -313,14 +313,14 @@ sub collect_data
|
|||||||
type => $type,
|
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");
|
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 => {
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
|
||||||
target => $target,
|
target => $target,
|
||||||
bond_master => $bond_master,
|
bond_master => $bond_master
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
elsif (-d $full_path."/bridge")
|
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 }});
|
$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 => {
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
|
||||||
active_interface => $active_interface,
|
active_interface => $active_interface,
|
||||||
bond_master => $bond_master,
|
bond_master => $bond_master,
|
||||||
@ -469,7 +480,7 @@ sub collect_data
|
|||||||
closedir(DIRECTORY);
|
closedir(DIRECTORY);
|
||||||
|
|
||||||
# Find what interfaces are connected to which bridges
|
# 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};
|
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}})
|
foreach my $bridge_name (sort {$a cmp $b} keys %{$anvil->data->{bridge}{$local_host}})
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
# - Move location constraints to the host node if the server is not on the preferred host (this happens after
|
# - Move location constraints to the host node if the server is not on the preferred host (this happens after
|
||||||
# recovering from a node loss).
|
# recovering from a node loss).
|
||||||
# - Update the fence delay to favour the active host
|
# - 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;
|
use strict;
|
||||||
@ -90,6 +91,9 @@ collect_data($anvil);
|
|||||||
# Look for migration times written out by ocf:alteeve:server.
|
# Look for migration times written out by ocf:alteeve:server.
|
||||||
record_migration_times($anvil);
|
record_migration_times($anvil);
|
||||||
|
|
||||||
|
# Check if we need to update the websocket stuff.
|
||||||
|
check_vnc($anvil);
|
||||||
|
|
||||||
# Mark that we ran.
|
# Mark that we ran.
|
||||||
$anvil->Database->insert_or_update_updated({updated_by => $THIS_FILE});
|
$anvil->Database->insert_or_update_updated({updated_by => $THIS_FILE});
|
||||||
|
|
||||||
@ -99,6 +103,70 @@ $anvil->nice_exit({exit_code => 0});
|
|||||||
# Functions #
|
# 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.
|
# Look for migration times written out by ocf:alteeve:server.
|
||||||
sub record_migration_times
|
sub record_migration_times
|
||||||
{
|
{
|
||||||
|
@ -1848,7 +1848,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is:
|
|||||||
<key name="log_0637">We've got: [#!variable!local_server_count!#] servers, and the peer has: [#!variable!peer_server_count!#] servers. Skipping fence delay preference checks for now.</key>
|
<key name="log_0637">We've got: [#!variable!local_server_count!#] servers, and the peer has: [#!variable!peer_server_count!#] servers. Skipping fence delay preference checks for now.</key>
|
||||||
<key name="log_0638">We're hosting servers, and our peer is not. Making the fence delay favours this node.</key>
|
<key name="log_0638">We're hosting servers, and our peer is not. Making the fence delay favours this node.</key>
|
||||||
<key name="log_0639">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.</key>
|
<key name="log_0639">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.</key>
|
||||||
<key name="log_0640">Out peer is online, no need to check server location constraints.</key>
|
<key name="log_0640">Our peer is online, no need to check server location constraints.</key>
|
||||||
<key name="log_0641">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.</key>
|
<key name="log_0641">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.</key>
|
||||||
<key name="log_0642">Disabling dual primary for the resource: [#!variable!resource!#] to the node: [#!variable!target_name!# (#!variable!target_node_id!#)].</key>
|
<key name="log_0642">Disabling dual primary for the resource: [#!variable!resource!#] to the node: [#!variable!target_name!# (#!variable!target_node_id!#)].</key>
|
||||||
<key name="log_0643">The corosync config file is being updated with these differences;
|
<key name="log_0643">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
|
|||||||
<key name="message_0252">Found the server: [#!variable!server_name!#] in the database, loading details now.</key>
|
<key name="message_0252">Found the server: [#!variable!server_name!#] in the database, loading details now.</key>
|
||||||
<key name="message_0253">The fence delay to prefer the node: [#!variable!node!#] has been removed.</key>
|
<key name="message_0253">The fence delay to prefer the node: [#!variable!node!#] has been removed.</key>
|
||||||
<key name="message_0254">The fence delay now prefers the node: [#!variable!node!#].</key>
|
<key name="message_0254">The fence delay now prefers the node: [#!variable!node!#].</key>
|
||||||
|
<key name="message_0255">This is the TCP port that the VNC server is listening on to provide graphical access to the associated server.</key>
|
||||||
|
|
||||||
<!-- Success messages shown to the user -->
|
<!-- Success messages shown to the user -->
|
||||||
<key name="ok_0001">Saved the mail server information successfully!</key>
|
<key name="ok_0001">Saved the mail server information successfully!</key>
|
||||||
|
@ -1127,7 +1127,7 @@ sub check_corosync
|
|||||||
update_progress($anvil, ($anvil->data->{job}{progress} += 1), "job_0345");
|
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"});
|
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0345"});
|
||||||
my $waiting = 1;
|
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};
|
my $new_password = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_password};
|
||||||
while ($waiting)
|
while ($waiting)
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#
|
#
|
||||||
# TODO: Support cloning; Example
|
# TODO: Support cloning; Example
|
||||||
# - virt-clone --original-xml /mnt/shared/definitions/<source>.xml --name <new_server> --file <new_server's_drbd_path> --check path_exists=off
|
# - virt-clone --original-xml /mnt/shared/definitions/<source>.xml --name <new_server> --file <new_server's_drbd_path> --check path_exists=off
|
||||||
|
# - Make VNC default
|
||||||
#
|
#
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
Loading…
Reference in New Issue
Block a user