Changeset 24639
- Timestamp:
- Jul 1, 2009, 6:40:27 PM (17 years ago)
- Location:
- trunk/Nebulous-Server
- Files:
-
- 4 edited
-
Changes (modified) (1 diff)
-
lib/Nebulous/Server.pod (modified) (1 diff)
-
lib/Nebulous/Server/SQL.pm (modified) (1 diff)
-
t/10_server_stat_object.t (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/Changes
r24637 r24639 33 33 - add the ability to delete a storage object when it has instances that are 34 34 offline 35 - change Nebulous::Server->stat_object() to return both the total number of 36 instance and just those that are available 35 37 36 38 0.16 -
trunk/Nebulous-Server/lib/Nebulous/Server.pod
r24278 r24639 183 183 mtime 184 184 number of instances 185 number of available instances 185 186 186 187 =item * mounts( $key ); -
trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
r24638 r24639 83 83 stat_object => qq{ 84 84 SELECT 85 storage_object.so_id, 86 storage_object.ext_id, 87 read_lock, 88 write_lock, 89 storage_object_attr.epoch, 90 storage_object_attr.mtime, 91 COUNT(instance.so_id) as instances 92 FROM storage_object 93 JOIN storage_object_attr 85 so.so_id, 86 so.ext_id, 87 attr.read_lock, 88 attr.write_lock, 89 attr.epoch, 90 attr.mtime, 91 COUNT(instance.so_id) as instances, 92 SUM(available) as available 93 FROM storage_object as so 94 JOIN storage_object_attr as attr 94 95 USING (so_id) 95 96 JOIN instance 96 97 USING (so_id) 97 WHERE ext_id = ? 98 GROUP BY storage_object.so_id 98 LEFT JOIN mountedvol 99 USING(vol_id) 100 WHERE ext_id = ? 101 GROUP BY so.so_id 99 102 }, 100 103 # Note: this sets an update lock -
trunk/Nebulous-Server/t/10_server_stat_object.t
r24356 r24639 8 8 use warnings FATAL => qw( all ); 9 9 10 use Test::More tests => 1 2;10 use Test::More tests => 13; 11 11 12 12 use lib qw( ./t ./lib ); … … 27 27 my $info = $neb->stat_object("foo"); 28 28 29 is(scalar @$info, 7, "number of columns");29 is(scalar @$info, 8, "number of columns"); 30 30 } 31 31 … … 37 37 my $info = $neb->stat_object("foo"); 38 38 39 is(scalar @$info, 7, "number of columns");39 is(scalar @$info, 8, "number of columns"); 40 40 is(@$info[0], 1, "so_id"); 41 41 is(@$info[1], "foo", "ext_id"); … … 45 45 like(@$info[5], qr/....-..-.. ..:..:../, "mtime"); 46 46 is(@$info[6], 1, "instances"); 47 is(@$info[7], 1, "available instances"); 47 48 } 48 49
Note:
See TracChangeset
for help on using the changeset viewer.
