[sheepdog-users] different size of sheepdog storage discs

Jens WEBER jweber at tek2b.org
Tue Jul 10 21:58:37 CEST 2012


> Collie vdi track without the -i option just tracks where the vdi
> metadata object is located.  Given that you formatted with --nr-copies=1
> there is just one copy.
> 
> Try adding -i 0, -i 1, etc.
> 
I wrote a little script, maybe useful - looks like

# not preallocated vdi
root at sheep01:/home/jens/sheepdog/tools# ./vdidetails test2
Node List

	Id	Host:Port
	0	172.30.0.80:7000
	1	172.30.0.80:7001

Details of vdi test2, size 12 MB, blocks 3
 - : block does not exist or not allocated, # : block is here

	4MB block	  [node0,node1,...]
	metadata object	: [#-]
	0		: [--]
	1		: [--]
	2		: [--]
# preallocated vdi
root at sheep01:/home/jens/sheepdog/tools# ./vdidetails test
Node List

	Id	Host:Port
	0	172.30.0.80:7000
	1	172.30.0.80:7001

Details of vdi test, size 400 MB, blocks 100
 - : block does not exist or not allocated, # : block is here

	4MB block	  [node0,node1,...]
	metadata object	: [#-]
	0		: [#-]
	1		: [#-]
	2		: [#-]
	3		: [-#]
	4		: [-#]
	5		: [#-]
	6		: [-#]
	7		: [#-]


#!/usr/bin/perl -w
#
# Copyright:
#
#    Copyright (C) 2012 Jens Weber <jweber at tek2b.org>
#
# License:
#
#    This program is free software; you can redistribute it and/or modify it
#    under the terms of the GNU General Public License version 2 as published by
#    the Free Software Foundation.

use strict;

my $vdi = $ARGV[0] || "";
my @nodes = qx(collie node list);

print "Node List\n\n";

print "\tId\tHost:Port\n";
foreach my $line (@nodes) {
    if ( $line =~ /-\s+(\d)+\s+([0-9,.]+:[0-9]+)\s+\d+\s+.*/ ) {
        my $id = $1;
        my $node = $2;
        print "\t$id\t$node\n";
    }
}

my $size = 0;
my $unit = "MB";
my @details = qx(collie vdi list $vdi);

foreach my $line (@details) {
    if ( $line =~ /$vdi\s+\d+\s+(\d+)\s+([M,G,T]+B+)\s+\d+/ ) {
       $size = $1;
       $unit = $2;
    }
}

my $sumindex = $size / 4;
$sumindex = $sumindex * 1024 if ( $unit eq "GB" );
$sumindex = $sumindex * 1024 *1024 if ( $unit eq "TB" );

print "\nDetails of vdi $vdi, size $size $unit, blocks $sumindex\n";
print " - : block does not exist or not allocated, # : block is here\n\n";
print "\t4MB block\t  [node0,node1,...]\n";
my @object = qx(collie vdi object $vdi);
my $indi = "[";
foreach my $line (@object) {
    if ( $line =~ /[0-9,.,]+:[0-9]+\s+(.*)/ ) {
        if ( $1 =~ /has the object/ ) {
            $indi .= "#";
        } else {
            $indi .= "-";
        }
    }
}
$indi .= "]";
print "\tmetadata object\t: $indi\n";
for ( my $index=0; $index < $sumindex; $index++ ) {
    my @object = qx(collie vdi object $vdi -i $index);
    my $indi = "[";
    foreach my $line (@object) {
        if ( $line =~ /[0-9,.,]+:[0-9]+\s+(.*)/ ) {
            if ( $1 =~ /has the object/ ) {
                $indi .= "#";
            } else {
                $indi .= "-";
            }
        }
    }
    $indi .= "]";
    print "\t$index\t\t: $indi\n";
}



More information about the sheepdog-users mailing list