* Updated anvil-manage-server-storage to connect the new drive to the VM. Still need to update the on-disk and in-DB definitions though.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent de86cf88fe
commit afaf129733
  1. 23
      tools/anvil-manage-server-storage

@ -1064,7 +1064,7 @@ sub manage_disk_add
# If the volume is 'Negotiating', disconnect and reconnect the peer. # If the volume is 'Negotiating', disconnect and reconnect the peer.
if (lc($peer_disk_state) eq "negotiating") if (lc($peer_disk_state) eq "negotiating")
{ {
print "Problem!\n"; print "\n- Problem!\n";
($peer_disk_state, $role) = reconnect_resource($anvil, $short_host_name, $peer_name, $drbd_resource, $next_drbd_volume); ($peer_disk_state, $role) = reconnect_resource($anvil, $short_host_name, $peer_name, $drbd_resource, $next_drbd_volume);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
peer_disk_state => $peer_disk_state, peer_disk_state => $peer_disk_state,
@ -1313,11 +1313,14 @@ sub manage_disk_add
$shell_call = $anvil->data->{path}{exe}{setsid}." --wait ".$anvil->data->{path}{exe}{virsh}." attach-disk ".$server_name." "; $shell_call = $anvil->data->{path}{exe}{setsid}." --wait ".$anvil->data->{path}{exe}{virsh}." attach-disk ".$server_name." ";
$shell_call .= "/dev/drbd/by-res/".$drbd_resource."/".$next_drbd_volume." ".$new_device_target." "; $shell_call .= "/dev/drbd/by-res/".$drbd_resource."/".$next_drbd_volume." ".$new_device_target." ";
$shell_call .= "--persistent --targetbus ".$disk_device_bus." "; $shell_call .= "--targetbus ".$disk_device_bus." ";
$shell_call .= "--cache ".$disk_cache." "; $shell_call .= "--cache ".$disk_cache." ";
$shell_call .= "--io ".$disk_io_policy; $shell_call .= "--io ".$disk_io_policy." ";
$shell_call .= "--sourcetype block --subdriver raw"; $shell_call .= "--sourcetype block --subdriver raw";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
offline => $offline,
shell_call => $shell_call,
}});
if ($offline) if ($offline)
{ {
# Define the VM, if needed, then add the drive, dump the config and push it out. # Define the VM, if needed, then add the drive, dump the config and push it out.
@ -1351,9 +1354,19 @@ sub manage_disk_add
output => $output, output => $output,
return_code => $return_code, return_code => $return_code,
}}); }});
if ($return_code)
{
# Something went wrong.
print "- Failed!\n";
print "Expected the return code '0', but got: [".$return_code."]. The command output, if anything, was:\n";
print "========\n";
print $output."\n";
print "========\n";
$anvil->nice_exit({exit_code => 1});
}
print "- Updating the stored definition and undefining the server now...\n"; print "- Updating the stored definition and undefining the server now...\n";
update_definition($anvil, "undefine", ""); update_definition($anvil, "define", "");
print "Done!\n"; print "Done!\n";
$anvil->nice_exit({exit_code => 0}); $anvil->nice_exit({exit_code => 0});
} }

Loading…
Cancel
Save