* Applied typo fixed from PR #286 (thanks, Deezzir!). Also moved all the raw prints into words.xml.

* Updated Convert->human_readable_to_bytes() to return an empty string if passed an empty string.

Signed-off-by: digimer <digimer@gravitar.alteeve.com>
main
digimer 2 years ago
parent 9d2f9c4d88
commit ff69916a85
  1. 6
      Anvil/Tools/Convert.pm
  2. 32
      share/words.xml
  3. 162
      tools/anvil-provision-server

@ -999,6 +999,12 @@ sub human_readable_to_bytes
type => $type, type => $type,
}}); }});
# If we were passed nothing, return nothing.
if ($size eq "")
{
return("");
}
# Start cleaning up the variables. # Start cleaning up the variables.
my $value = $size; my $value = $size;
$size =~ s/ //g; $size =~ s/ //g;

@ -1484,6 +1484,38 @@ Note: This is a permanent action! If you protect this server again later, a full
<key name="job_0434">Waiting for up to a minute to see if the peer connects before provisioning the server.</key> <key name="job_0434">Waiting for up to a minute to see if the peer connects before provisioning the server.</key>
<key name="job_0435">One or more peer disk state or roles are 'unknown', waiting: [#!variable!waiting!#] seconds longer.</key> <key name="job_0435">One or more peer disk state or roles are 'unknown', waiting: [#!variable!waiting!#] seconds longer.</key>
<key name="job_0436">Peer disk state or role still unknown after one minute, proceeding without it.</key> <key name="job_0436">Peer disk state or role still unknown after one minute, proceeding without it.</key>
<key name="job_0437"><![CDATA[Missing '--anvil <name_or_uuid>'.]]></key>
<key name="job_0438"><![CDATA[Missing '--name <server_name>'.]]></key>
<key name="job_0439"><![CDATA[Missing '--os <os_variant>'. Valid options match 'virt-install --os-variant' (run: 'osinfo-query os' and reference the 'Short ID' column).]]></key>
<key name="job_0440"><![CDATA[The OS: [#!variable!os!#] was not found. If you're sure the OS is valid, please run 'striker-parse-os-list --xml --new' and add the output to 'words.xml'.]]></key>
<key name="job_0441"><![CDATA[Missing '--cpu <1 ~ #!variable!threads!#>'.]]></key>
<key name="job_0442"><![CDATA[The number of CPU cores: [#!variable!cores!#] is invalid. Must be between 1 and #!variable!threads!#.]]></key>
<key name="job_0443"><![CDATA[Missing '--ram <bytes or human readable, min is 64KiB, max is #!variable!max_ram!#>'.]]></key>
<key name="job_0444"><![CDATA[The requested RAM: [#!variable!ram!#] is not valid. Must be between: [64KiB] and: [#!variable!max_ram!#].]]></key>
<key name="job_0445"><![CDATA[Missing '--storage-group <name or uuid>'. Valid options are:]]></key>
<key name="job_0446"><![CDATA[- Name: [#!variable!name!#], UUID: [#!variable!uuid!#].]]></key>
<key name="job_0447"><![CDATA[- The requested storage group: [#!variable!storage_group!#] does not appear to be valid. Valid options are:]]></key>
<key name="job_0448"><![CDATA[Missing '--storage-size <bytes or human readable>'. Max is: [#!variable!storage_group_size!#].]]></key>
<key name="job_0449"><![CDATA[Missing '--storage-size <bytes or human readable>'. Max will depend on selected --storage-group.]]></key>
<key name="job_0450"><![CDATA[The requested disk size: [#!variable!storage_size!#] is not valid. Must be between: [10MiB] and: [#!variable!max_size!#].]]></key>
<key name="job_0451"><![CDATA[Missing '--install-media <file_name or file_uuid>'. Valid options are:]]></key>
<key name="job_0452"><![CDATA[- File name: [#!variable!name!#], file UUID: [#!variable!uuid!#].]]></key>
<key name="job_0453"><![CDATA[The install file: [#!variable!file!#] is not an ISO, so it can't be used to install.]]></key>
<key name="job_0454"><![CDATA[The install file: [#!variable!file!#] was not found on this Anvil!. Valid options are:]]></key>
<key name="job_0455"><![CDATA[Is it in '/mnt/shared/files/' and are the daemons running?]]></key>
<key name="job_0456"><![CDATA[The driver file: [#!variable!file!#] is not an ISO, so it can't be used as an optical disc.]]></key>
<key name="job_0457"><![CDATA[The driver file: [#!variable!file!#] was not found on this Anvil!. Valid options are:]]></key>
<key name="job_0458"><![CDATA[Available options
--name - Alphanumeric, 1~16 characters long.
--os - Run: 'osinfo-query os' and reference the 'Short ID' column for valid options.
--cpu - 1 ~ #!varaible!threads!#
--ram - Bytes or human readable, min is 64KiB, max is #!variable!max_ram.
--storage-group - Name or UUID. Valid options are:]]></key>
<key name="job_0459"><![CDATA[ - Name: [#!variable!name!#], UUID: [#!variable!uuid!#], free space: [#!variable!free_space!#]]]></key>
<key name="job_0460"><![CDATA[ --storage-size - Disk size, see above for space available
--install-media - File name or file UUID. Available discs are:]]></key>
<key name="job_0461"><![CDATA[ - File name: [#!variable!name!#], file UUID: [#!variable!uuid!#], size: [#!variable!size!#]]]></key>
<key name="job_0462"><![CDATA[ --driver-disc - (optional) A driver disc to be added as a second optical drive. Valid options are above.]]></key>
<!-- Log entries --> <!-- Log entries -->
<key name="log_0001">Starting: [#!variable!program!#].</key> <key name="log_0001">Starting: [#!variable!program!#].</key>

@ -2855,7 +2855,7 @@ sub interactive_ask_server_confirm
if (not $anvil->data->{new_server}{anvil_uuid}) if (not $anvil->data->{new_server}{anvil_uuid})
{ {
# Instantly fatal # Instantly fatal
print "Missing '--anvil <name_or_uuid>'\n"; $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, key => "job_0437"});
$anvil->nice_exit({exit_code => 1}); $anvil->nice_exit({exit_code => 1});
} }
@ -2876,12 +2876,14 @@ sub interactive_ask_server_confirm
my $problem = 0; my $problem = 0;
if (not $anvil->data->{switches}{name}) if (not $anvil->data->{switches}{name})
{ {
print "Missing '--name <server_name>'\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0438"});
$problem = 1; $problem = 1;
} }
if (not $anvil->data->{switches}{os}) if (not $anvil->data->{switches}{os})
{ {
print "Missing '--os <os_variant>', valid options match 'virt-install --os-variant' (run: 'osinfo-query os' and reference the 'Short ID' column).\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0439"});
$problem = 1; $problem = 1;
} }
else else
@ -2895,18 +2897,28 @@ sub interactive_ask_server_confirm
}}); }});
if ($os_name =~ /#!not_found/) if ($os_name =~ /#!not_found/)
{ {
print "The OS: [".$anvil->data->{switches}{os}."] was not found. If you're sure the OS is valid, please run 'striker-parse-os-list --xml --new' and add the output to 'words.xml'.\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0440", variables => {
os => $anvil->data->{switches}{os},
}});
$problem = 1; $problem = 1;
} }
} }
if (not $anvil->data->{switches}{cpu}) if (not $anvil->data->{switches}{cpu})
{ {
print "Missing '--cpu <1 ~ ".$anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads}.">'\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0441", variables => {
threads => $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads},
}});
$problem = 1; $problem = 1;
} }
elsif (($anvil->data->{switches}{cpu} =~ /\D/) or ($anvil->data->{switches}{cpu} > $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads}) or ($anvil->data->{switches}{cpu} < 1)) elsif (($anvil->data->{switches}{cpu} =~ /\D/) or ($anvil->data->{switches}{cpu} > $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads}) or ($anvil->data->{switches}{cpu} < 1))
{ {
print "The number of CPU cores: [".$anvil->data->{switches}{cpu}."] is invalid. Must be between 1 and ".$anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads}.".\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0442", variables => {
cores => $anvil->data->{switches}{cpu},
threads => $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads},
}});
$problem = 1; $problem = 1;
} }
@ -2923,7 +2935,10 @@ sub interactive_ask_server_confirm
}}); }});
if (not $anvil->data->{switches}{ram}) if (not $anvil->data->{switches}{ram})
{ {
print "Missing '--ram <bytes or human readable, min is 64KiB, max is ".$say_max_ram.">'\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0443", variables => {
max_ram => $say_max_ram,
}});
$problem = 1; $problem = 1;
} }
elsif (($requested_ram eq "!!error!!") or elsif (($requested_ram eq "!!error!!") or
@ -2932,7 +2947,11 @@ sub interactive_ask_server_confirm
($requested_ram > $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{available})) ($requested_ram > $anvil->data->{anvil_resources}{$anvil_uuid}{ram}{available}))
{ {
# Invalid # Invalid
print "The requested RAM: [".$anvil->data->{switches}{ram}."] is not valid. Must be between: [64KiB] and: [".$say_max_ram."]\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0444", variables => {
ram => $anvil->data->{switches}{ram},
max_ram => $say_max_ram,
}});
$problem = 1; $problem = 1;
} }
@ -2940,10 +2959,14 @@ sub interactive_ask_server_confirm
my $storage_group_uuid = ""; my $storage_group_uuid = "";
if (not $anvil->data->{switches}{'storage-group'}) if (not $anvil->data->{switches}{'storage-group'})
{ {
print "Missing '--storage-group <name or uuid>. Valid options are:'\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0445"});
foreach my $storage_group_name (sort {$a cmp $b} keys %{$anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}}) foreach my $storage_group_name (sort {$a cmp $b} keys %{$anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}})
{ {
print "- Name: [".$storage_group_name."], UUID: [".$anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}{$storage_group_name}{storage_group_uuid}."]\n" if not $anvil->data->{switches}{options}; $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0446", variables => {
name => $storage_group_name,
uuid => $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}{$storage_group_name}{storage_group_uuid},
}});
} }
$problem = 1; $problem = 1;
} }
@ -2972,10 +2995,16 @@ sub interactive_ask_server_confirm
else else
{ {
# Invalid # Invalid
print "- The requested storage group: [".$storage_group."] does not appear to be valid. Valid options are;\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0447", variables => {
storage_group => $storage_group,
}});
foreach my $storage_group_name (sort {$a cmp $b} keys %{$anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}}) foreach my $storage_group_name (sort {$a cmp $b} keys %{$anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}})
{ {
print "- Name: [".$storage_group_name."], UUID: [".$anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}{$storage_group_name}{storage_group_uuid}."]\n" if not $anvil->data->{switches}{options}; $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0446", variables => {
name => $storage_group_name,
uuid => $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}{$storage_group_name}{storage_group_uuid},
}});
} }
$problem = 1; $problem = 1;
} }
@ -2983,13 +3012,16 @@ sub interactive_ask_server_confirm
my $say_max_storage_group_size = $max_storage_group_size ? $anvil->Convert->bytes_to_human_readable({"bytes" => $max_storage_group_size}) : ""; my $say_max_storage_group_size = $max_storage_group_size ? $anvil->Convert->bytes_to_human_readable({"bytes" => $max_storage_group_size}) : "";
if (not $anvil->data->{switches}{'storage-size'}) if (not $anvil->data->{switches}{'storage-size'})
{ {
my $print = $anvil->data->{switches}{options} ? 0 : 1;
if ($max_storage_group_size) if ($max_storage_group_size)
{ {
print "Missing '--storage-size <bytes or human readable. max is ".$say_max_storage_group_size.">'\n" if not $anvil->data->{switches}{options}; $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0448", variables => {
storage_group_size => $say_max_storage_group_size,
}});
} }
else else
{ {
print "Missing '--storage-size <bytes or human readable>. Max will depend on selected --storage-group.'\n" if not $anvil->data->{switches}{options}; $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0449"});
} }
$problem = 1; $problem = 1;
} }
@ -3005,7 +3037,11 @@ sub interactive_ask_server_confirm
($requested_disk > $max_storage_group_size)) ($requested_disk > $max_storage_group_size))
{ {
# Invalid # Invalid
print "The requested disk size: [".$anvil->data->{switches}{'storage-size'}."] is not valid. Must be between: [10MiB] and: [".$say_max_storage_group_size."]\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0450", variables => {
storage_size => $anvil->data->{switches}{'storage-size'},
max_size => $say_max_storage_group_size,
}});
$problem = 1; $problem = 1;
} }
} }
@ -3018,7 +3054,18 @@ sub interactive_ask_server_confirm
} }
if (not $anvil->data->{switches}{'install-media'}) if (not $anvil->data->{switches}{'install-media'})
{ {
print "Missing '--install-media <file name or file_uuid>'\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0451"});
foreach my $file_name (sort {$a cmp $b} keys %{$anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}})
{
my $file_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}{$file_name}{file_uuid};
my $file_type = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_type};
next if $file_type ne "iso";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0452", variables => {
name => $file_name,
uuid => $file_uuid,
}});
}
$problem = 1; $problem = 1;
} }
else else
@ -3030,7 +3077,8 @@ sub interactive_ask_server_confirm
my $file_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}{$file_name}{file_uuid}; my $file_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}{$file_name}{file_uuid};
my $file_type = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_type}; my $file_type = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_type};
my $file_directory = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_directory}; my $file_directory = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_directory};
if ($file_name eq $anvil->data->{switches}{'install-media'}) if (($file_name eq $anvil->data->{switches}{'install-media'}) or
($file_uuid eq $anvil->data->{switches}{'install-media'}))
{ {
# Found it. # Found it.
$found = 1; $found = 1;
@ -3045,7 +3093,10 @@ sub interactive_ask_server_confirm
else else
{ {
# Not an ISO. # Not an ISO.
print "The install file: [".$anvil->data->{switches}{'install-media'}."] is not an ISO, so it can't be used to install.\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0453", variables => {
file => $anvil->data->{switches}{'install-media'},
}});
$problem = 1; $problem = 1;
} }
} }
@ -3053,8 +3104,24 @@ sub interactive_ask_server_confirm
} }
if (not $found) if (not $found)
{ {
print "The install file: [".$anvil->data->{switches}{'install-media'}."] was not found on this Anvil!.\n" if not $anvil->data->{switches}{options}; if (not $anvil->data->{switches}{options})
print "Is it in '/mnt/shared/files/' and are the daemons running?\n" if not $anvil->data->{switches}{options}; {
my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0454", variables => {
file => $anvil->data->{switches}{'install-media'},
}});
foreach my $file_name (sort {$a cmp $b} keys %{$anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}})
{
my $file_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}{$file_name}{file_uuid};
my $file_type = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_type};
next if $file_type ne "iso";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0452", variables => {
name => $file_name,
uuid => $file_uuid,
}});
}
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0455"});
}
$problem = 1; $problem = 1;
} }
} }
@ -3067,7 +3134,8 @@ sub interactive_ask_server_confirm
my $file_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}{$file_name}{file_uuid}; my $file_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}{$file_name}{file_uuid};
my $file_type = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_type}; my $file_type = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_type};
my $file_directory = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_directory}; my $file_directory = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_directory};
if ($file_name eq $anvil->data->{switches}{'driver-disc'}) if (($file_name eq $anvil->data->{switches}{'driver-disc'}) or
($file_uuid eq $anvil->data->{switches}{'driver-disc'}))
{ {
# Found it. # Found it.
$found = 1; $found = 1;
@ -3082,7 +3150,10 @@ sub interactive_ask_server_confirm
else else
{ {
# Not an ISO. # Not an ISO.
print "The driver file: [".$anvil->data->{switches}{'driver-disc'}."] is not an ISO, so it can't be used as an optical disc.\n" if not $anvil->data->{switches}{options}; my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0456", variables => {
file => $anvil->data->{switches}{'driver-disc'},
}});
$problem = 1; $problem = 1;
} }
} }
@ -3090,8 +3161,24 @@ sub interactive_ask_server_confirm
} }
if (not $found) if (not $found)
{ {
print "The driver file: [".$anvil->data->{switches}{'driver-disc'}."] was not found on this Anvil!.\n" if not $anvil->data->{switches}{options}; if (not $anvil->data->{switches}{options})
print "Is it in '/mnt/shared/files/' and are the daemons running?\n" if not $anvil->data->{switches}{options}; {
my $print = $anvil->data->{switches}{options} ? 0 : 1;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0457", variables => {
file => $anvil->data->{switches}{'driver-disc'},
}});
foreach my $file_name (sort {$a cmp $b} keys %{$anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}})
{
my $file_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}{$file_name}{file_uuid};
my $file_type = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_type};
next if $file_type ne "iso";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0452", variables => {
name => $file_name,
uuid => $file_uuid,
}});
}
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => $print, level => 0, key => "job_0455"});
}
$problem = 1; $problem = 1;
} }
} }
@ -3127,21 +3214,22 @@ sub interactive_ask_server_confirm
else else
{ {
# Show valid options to build a VM in a machine-parsable way. # Show valid options to build a VM in a machine-parsable way.
print "Available options print $anvil->Words->string({key => "job_0458", variables => {
--name - alphanumeric, 1~16 characters long. threads => $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads},
--os - Valid options; run: 'osinfo-query os' and reference the 'Short ID' column. max_ram => $say_max_ram,
--cpu - 1 ~ ".$anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads}." }})."\n";
--ram - bytes or human readable, min is 64KiB, max is ".$say_max_ram."
--storage-group - name or uuid. Valid options are:\n";
foreach my $storage_group_name (sort {$a cmp $b} keys %{$anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}}) foreach my $storage_group_name (sort {$a cmp $b} keys %{$anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}})
{ {
my $storage_group_uuid = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_name}{$storage_group_name}{storage_group_uuid}; my $storage_group_uuid = $anvil->data->{storage_groups}{anvil_uuid}{$anvil_uuid}{storage_group_name}{$storage_group_name}{storage_group_uuid};
my $max_storage_group_size = $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group}{$storage_group_uuid}{free_size}; my $max_storage_group_size = $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group}{$storage_group_uuid}{free_size};
my $say_max_storage_group_size = $anvil->Convert->bytes_to_human_readable({"bytes" => $max_storage_group_size}); my $say_max_storage_group_size = $anvil->Convert->bytes_to_human_readable({"bytes" => $max_storage_group_size});
print " - Name: [".$storage_group_name."], UUID: [".$anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}{$storage_group_name}{storage_group_uuid}."], free space: [".$say_max_storage_group_size."]\n"; print $anvil->Words->string({key => "job_0459", variables => {
name => $storage_group_name,
uuid => $anvil->data->{anvil_resources}{$anvil_uuid}{storage_group_name}{$storage_group_name}{storage_group_uuid},
free_space => $say_max_storage_group_size,
}})."\n";
} }
print " --storage-size - Disk size, see above for space available print $anvil->Words->string({key => "job_0460"})."\n";
--install-media - file name or file UUID. Available discs are:\n";
foreach my $file_name (sort {$a cmp $b} keys %{$anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}}) foreach my $file_name (sort {$a cmp $b} keys %{$anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}})
{ {
my $file_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}{$file_name}{file_uuid}; my $file_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_name}{$file_name}{file_uuid};
@ -3149,9 +3237,13 @@ sub interactive_ask_server_confirm
my $file_size = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_size}; my $file_size = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{file_uuid}{$file_uuid}{file_size};
next if $file_type ne "iso"; next if $file_type ne "iso";
my $say_size = $anvil->Convert->bytes_to_human_readable({"bytes" => $file_size}); my $say_size = $anvil->Convert->bytes_to_human_readable({"bytes" => $file_size});
print " - File name: [".$file_name."], file UUID: [".$file_uuid."], size: [".$say_size."]\n"; print $anvil->Words->string({key => "job_0461", variables => {
name => $file_name,
uuid => $file_uuid,
size => $say_max_storage_group_size,
}})."\n";
} }
print " --driver-disc - (optional) A driver disc to be added as a second optical drive. Valid options are above.\n"; print $anvil->Words->string({key => "job_0462"})."\n";
} }
$anvil->nice_exit({exit_code => 0}); $anvil->nice_exit({exit_code => 0});
} }

Loading…
Cancel
Save