Do you mean "a volume with the same name can exist on different hosts"?
CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
| [reply] |
countzero, I rather think annie06 does mean that - a volume has only to be unique on a specific host - thus volumes having the same name can legitimately exist on one, or more, different hosts.
This applies to all OSes, even (tho' it pains me greatly to say it) Windoze - every Windoze host has a C: drive, which, in this context, can be taken to be the equivalent of a volume name.
IMO. the question (to ask of annie06) ought to be: 'Are all volumes the same size on every host?'
My reading of the OP suggests that where ever i.e. on which ever host, vol2 exists, it is always 20g, so a simplified version of the lookup table based approach (similar to that outlined by kennethk) should suffice - something along the lines of i.e. untested ...
use warnings;
use strict;
use autodie;
#for each vol_size_entry in the volsize file do
# add the vol_size_entry to the volsize lookup (keyed on vol name)
#done
open FILE, "<volsize";
my %volsize = map {
local @_ = split;
# $_[1] needs normalising (to chosen common units) and removal of
+unit spec
/_name/ ? () : ($_[0] => $_[1]);
} <FILE>;
close FILE;
#for each host_entry do
# lookup the size of the vol for the host
# add the vol size to the record for the host
#done
open FILE, "<hostfile";
my %hostsize;
while (<FILE>) {
next if /_name/;
local @_ = split;
$hostsize{$_[1]} += $volsize{$_[0]};
}
close FILE;
A user level that continues to overstate my experience :-))
| [reply] [d/l] [select] |