* Updated DRBD->delete_resource() to return a success if asked to delete a non-existent resource (as can happen when partial anvil-delete-server runs are re-run).

* Reworked DRBD->get_next_resource() to pull from the database, and to no longer do that increments-of-three nonsense. Avoidable complexity. Also added a call to Cluster->get_anvil_uuid() if the 'anvil_uuid' parameter wasn't passed.
* Updated Database->get_host_from_uuid() and ->get_hosts() to now take 'include_deleted' parameter and default to not returning deleted hosts. This fixed issues where anvil-{delete,provision}-server calls could assign jobs to now-deleted hosts with reused host names.
* Updated anvil-delete-server to print log entries to STDOUT. Also updated it to not wait of shutdown of a server in pacemaker to complete, and instead to destroy it after calling pacemaker's resource stop. Updated to also check to see if the server being deleted is already out of pacemaker and, if so, skip that step and directly try to destroy the server, if it's running.
* Updated anvil-provision-server to force 'peer_mode' runs to pull their TCP Port and DRBD minor numbers from the job. This fixes a bug where the same resource on two machines could use different TCP ports.

Signed-off-by: Digimer <digimer@alteeve.ca>
This commit is contained in:
Digimer 2021-02-05 23:41:48 -05:00
parent 2be14d93a6
commit b2dab95459

View File

@ -26,38 +26,7 @@ $anvil->Get->switches;
$anvil->Database->connect({debug => 3});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0132"});
my $key_string = 'message_0190
job_0185
job_0186,!!minor!5!!,!!port!7803!!
job_0188,!!job_uuid!12eeded2-c5bb-4295-8c8e-665bd9c9b83a!!,!!peer_name!mk-a02n01.digimer.ca!!
job_0189,!!lv_path!/dev/mk-a02n02_ssd0/srv02-lab02_0!!
job_0218
job_0190,!!resource!srv02-lab02!!
job_0191,!!resource!srv02-lab02!!
job_0192
job_0195
job_0203,!!resource!srv02-lab02!!
job_0199,!!shell_call!/usr/bin/virt-install --connect qemu:///system \
--name srv02-lab02 \
--os-variant win2k19 \
--memory 8192 \
--events on_poweroff=destroy,on_reboot=restart \
--vcpus 6,sockets=1,cores=6 \
--cpu host \
--network bridge=ifn1_bridge1,model=virtio \
--graphics spice \
--sound ich9 \
--clock offset=localtime \
--boot menu=on \
--disk path=/dev/drbd/by-res/srv02-lab02/0,target.bus=virtio,driver.io=threads,cache=writeback,driver.discard=unmap,boot.order=1 \
--disk path=/mnt/shared/files/Windows_Server_2019_eval.iso,device=cdrom,shareable=on,boot.order=2 \
--disk path=/mnt/shared/files/virtio-win-0.1.185.iso,device=cdrom,shareable=on,boot.order=3 --force \
--noautoconsole --wait -1 > /var/log/anvil-server_srv02-lab02.log
!!
job_0200';
my ($free_minor, $free_port) = $anvil->Words->parse_banged_string({
debug => 2,
key_string => $key_string,
});
my ($minor, $tcp_port) = $anvil->DRBD->get_next_resource({debug => 2});
print "Next free minor: [".$minor."], tcp port: [".$tcp_port."]\n";
$anvil->nice_exit({exit_code => 0});