summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ac4062d)
raw | patch | inline | side by side (parent: ac4062d)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 17 May 2007 20:59:04 +0000 (22:59 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 17 May 2007 20:59:04 +0000 (22:59 +0200) |
contrib/migrate-3-4.px | patch | blob | history |
diff --git a/contrib/migrate-3-4.px b/contrib/migrate-3-4.px
index 467c46bc22b02246a0e32a66e785cc9114cc8115..24a3c4ed6fc7672d865b23c3c4a6562a1b6ff637 100755 (executable)
--- a/contrib/migrate-3-4.px
+++ b/contrib/migrate-3-4.px
$OutDirs{$dest_directory} = 1;
}
- if (exists ($TypeSplit{$orig->{'type'}}))
+ if (($orig->{'type'} eq 'disk') || ($orig->{'type'} eq 'partition'))
+ {
+ special_disk ($orig_filename, $orig, $dest_filename, $dest);
+ }
+ elsif (exists ($TypeSplit{$orig->{'type'}}))
{
my $src_dses = $TypeSplit{$orig->{'type'}}->{'from'};
my $dst_ds = $TypeSplit{$orig->{'type'}}->{'to'};
return (@files);
} # find_files
-sub special_cpu
+{my $cache;
+sub _special_disk_instance
{
- my %file_orig = @_;
- my %file_dest = %file_orig;
+ my $orig_instance = shift;
+
+ if (!defined ($cache))
+ {
+ my $fh;
+ open ($fh, "< /proc/diskstats") or die ("open (/proc/diststats): $!");
+
+ $cache = {};
+ while (my $line = <$fh>)
+ {
+ chomp ($line);
+ my @fields = split (' ', $line);
+ $cache->{$fields[0] . '-' . $fields[1]} = $fields[2];
+ }
+ close ($fh);
+ }
+
+ return (defined ($cache->{$orig_instance})
+ ? $cache->{$orig_instance}
+ : $orig_instance);
+}}
+
+sub special_disk
+{
+ my $orig_filename = shift;
+ my $orig = shift;
+ my $dest_filename = shift;
+ my $dest = shift;
+
+ $dest->{'type_instance'} = undef;
+ $dest->{'plugin_instance'} = _special_disk_instance ($orig->{'type_instance'});
+ if ($dest->{'plugin_instance'} eq $orig->{'type_instance'})
+ {
+ print qq(echo "You may need to rename these files" >&2\n);
+ }
+
+ $dest->{'type'} = 'disk_merged';
+ $dest_filename = get_filename ($dest);
+ print "./extractDS.px -i '$InDir/$orig_filename' -s 'rmerged' -s 'wmerged' -o '$OutDir/$dest_filename' -d 'read' -d 'write'\n";
+
+ $dest->{'type'} = 'disk_octets';
+ $dest_filename = get_filename ($dest);
+ print "./extractDS.px -i '$InDir/$orig_filename' -s 'rbytes' -s 'wbytes' -o '$OutDir/$dest_filename' -d 'read' -d 'write'\n";
- $file_dest{'plugin_instance'} = $file_dest{'type_instance'}
+ $dest->{'type'} = 'disk_ops';
+ $dest_filename = get_filename ($dest);
+ print "./extractDS.px -i '$InDir/$orig_filename' -s 'rcount' -s 'wcount' -o '$OutDir/$dest_filename' -d 'read' -d 'write'\n";
+ $dest->{'type'} = 'disk_time';
+ $dest_filename = get_filename ($dest);
+ print "./extractDS.px -i '$InDir/$orig_filename' -s 'rtime' -s 'wtime' -o '$OutDir/$dest_filename' -d 'read' -d 'write'\n";
}