* Renamed servers -> 'server_clean_stop' to 'server_user_stop' to make it clearer what the column represents.
Signed-off-by: Digimer <digimer@alteeve.ca>
server_name text not null, -- This is the server's name. It can change without re-uploading the server.
server_anvil_uuid uuid not null, -- This is the Anvil! system that the server lives on. It can move to another Anvil!, so this can change.
server_clean_stop boolean not null default FALSE, -- When set, the server was stopped by a user. The Anvil! will not start a server that has been cleanly stopped.
server_user_stop boolean not null default FALSE, -- When set, the server was stopped by a user. The Anvil! will not start a server that has been cleanly stopped.
server_start_after_server_uuid uuid not null, -- This can be the server_uuid of another server. If set, this server will boot 'server_start_delay' seconds after the referenced server boots. A value of '00000000-0000-0000-0000-000000000000' will tell 'anvil-safe-start' to not boot the server at all. If a server is set not to start, any dependent servers will also stay off.
server_start_delay integer not null default 0, -- See above.
server_host_uuid uuid not null, -- This is the current hosts -> host_uuid for this server. If the server is off, this will be blank.
server_state text not null, -- This is the current state of this server, as reported by 'virsh list --all' (see: man virsh -> GENERIC COMMANDS -> --list)
server_live_migration boolean not null default TRUE, -- When false, servers will be stopped and then rebooted when a migration is requested. Also, when false, preventative migrations will not happen.
server_live_migration boolean not null default TRUE, -- When false, servers will be frozen for a migration, instead of being migrated while the server is migrating. During a cold migration, the server will be unresponsive, so connections to it could time out. However, by being frozen the migration will complete faster.
server_pre_migration_file_uuid uuid not null, -- This is set to the files -> file_uuid of a script to run BEFORE migrating a server. If the file isn't found or can't run, the script is ignored.
server_pre_migration_arguments text not null, -- These are arguments to pass to the pre-migration script
server_post_migration_file_uuid uuid not null, -- This is set to the files -> file_uuid of a script to run AFTER migrating a server. If the file isn't found or can't run, the script is ignored.
server_post_migration_arguments text not null, -- These are arguments to pass to the post-migration script
server_ram_in_use numeric not null, -- This is the amount of RAM currently used by the server. If the server is off, then this is the amount of RAM last used when the server was running.
server_configured_ram numeric not null, -- This is the amount of RAM allocated to the server in the on-disk definition file. This should always match the table above, but allows us to track when a user manually updated the allocated RAM in the on-disk definition, but that hasn't yet been picked up by the server
server_updated_by_user numeric not null, -- This is set to a unix timestamp when the user last updated the definition. When set, scan-server will check this value against the age of the definition file on disk. If this is newer and the running definition is different from the database definition, the database definition will be used to update the on-disk definition.
server_updated_by_user numeric not null, -- This is set to a unix timestamp when the user last updated the definition (via striker). When set, scan-server will check this value against the age of the definition file on disk. If this is newer, the on-disk defition will be updated. On the host with the server (if any), the new definition will be loaded into virsh as well.
server_boot_time numeric not null, -- This is the unix time (since epoch) when the server booted. It is calculated by checking the 'ps -p <pid> -o etimes=' when a server is seen to be running when it had be last seen as off. If a server that had been running is seen to be off, this is set back to 0.
my $seen_state = $anvil->data->{'scan-server'}{server}{$server_name}{server_state};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { seen_state => $seen_state }});
# If the server is on the peer, skip it.
next if $server_host_uuid ne $anvil->Get->host_uuid;
# If it needs to be undefined, do so now.
if (($anvil->data->{'scan-server'}{server}{$server_name}{undefine}) && ($anvil->data->{scancore}{'scan-server'}{'auto-undefine'}))
{
# It's off, and should be undefined. Dump the defition to archive and underfine.
my $backup_file = $anvil->data->{path}{directories}{shared}{archives}."/".$server_name.".pre-undefine.".$anvil->Get->date_and_time({file_name => 1}).".xml";
my $shell_call = $anvil->data->{path}{exe}{virsh}." dumpxml --inactive ".$server_name." > ".$backup_file;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{virsh}." list --all", source => $THIS_FILE, line => __LINE__});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { output => $output, return_code => $return_code }});
@ -62,8 +62,8 @@ The definition for the server: [#!variable!server!#] was edited outside of the A
#!variable!new_difference!#
======================
</key>
<keyname="scan_server_alert_0004">The active definition for the server: [#!variable!server!#] now matches the definition on disk. Changes should now be applied.</key>
<keyname="scan_server_alert_0004">The name of the server: [#!variable!old_name!#] has changed to: [#!variable!new_name!#]</key>
<keyname="scan_server_alert_0005">The server: [#!variable!old_name!#] state has changed from: [#!variable!old_state!#] to: [#!variable!new_state!#].</key>
<keyname="scan_server_alert_0006">
A new server named: [#!variable!server!#] has been found. The definition XML is:
====
@ -71,6 +71,18 @@ A new server named: [#!variable!server!#] has been found. The definition XML is:
====
</key>
<keyname="scan_server_alert_0007">The server: [#!variable!server!#] has been shut off.</key>
<keyname="scan_server_alert_0008">The server: [#!variable!server!#] boot time has changed from: [#!variable!old_boot_time_date!#] to: [#!variable!new_boot_time_date!#] (epoch from: [#!variable!old_boot_time_epoch!#] to: [#!variable!new_boot_time_epoch!#]).</key>
<keyname="scan_server_alert_0009">The server: [#!variable!server!#] has moved from the Anvil!: [#!variable!old_anvil_name!#] to: [#!variable!new_anvil_name!#] (from: [#!variable!old_anvil_uuid!#] to: [#!variable!new_anvil_uuid!#]).</key>
<keyname="scan_server_alert_0010">The server: [#!variable!server!#] has is now marked as user-stopped.</key>
<keyname="scan_server_alert_0011">The server: [#!variable!server!#] has is no longer marked as user-stopped.</key>
<keyname="scan_server_alert_0012">The server: [#!variable!server!#] has moved from the node: [#!variable!old_host_name!#] to: [#!variable!new_host_name!#] (from: [#!variable!old_host_uuid!#] to: [#!variable!new_host_uuid!#]).</key>
<keyname="scan_server_alert_0013">The amount of RAM the server: [#!variable!server!#] is currently using has changed from: [#!variable!old_ram_in_use_short!#] to: [#!variable!new_ram_in_use_short!#] (from: [#!variable!old_ram_in_use_bytes!# bytes] to: [#!variable!new_ram_in_use_bytes!# bytes]).</key>
<keyname="scan_server_alert_0014">The amount of RAM configured for the server: [#!variable!server!#] has changed from: [#!variable!old_ram_in_use_short!#] to: [#!variable!new_ram_in_use_short!#] (from: [#!variable!old_ram_in_use_bytes!# bytes] to: [#!variable!new_ram_in_use_bytes!# bytes]).</key>
<keyname="scan_server_alert_0015">
The amount of RAM configured for the server: [#!variable!server!#] has changed from: [#!variable!old_ram_in_use_short!#] to: [#!variable!new_ram_in_use_short!#] (from: [#!variable!old_ram_in_use_bytes!# bytes] to: [#!variable!new_ram_in_use_bytes!# bytes]).
- NOTE: This RAM will not be used until the server is power cycled!
server_nametextnotnull,-- This is the server's name. It can change without re-uploading the server.
server_anvil_uuiduuidnotnull,-- This is the Anvil! system that the server lives on. It can move to another Anvil!, so this can change.
server_clean_stopbooleannotnulldefaultFALSE,-- When set, the server was stopped by a user. The Anvil! will not start a server that has been cleanly stopped.
server_user_stopbooleannotnulldefaultFALSE,-- When set, the server was stopped by a user. The Anvil! will not start a server that has been cleanly stopped.
server_start_after_server_uuiduuidnotnull,-- This can be the server_uuid of another server. If set, this server will boot 'server_start_delay' seconds after the referenced server boots. A value of '00000000-0000-0000-0000-000000000000' will tell 'anvil-safe-start' to not boot the server at all. If a server is set not to start, any dependent servers will also stay off.
server_start_delayintegernotnulldefault0,-- See above.
server_host_uuiduuidnotnull,-- This is the current hosts -> host_uuid for this server. If the server is off, this will be blank.