IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20175


Ignore:
Timestamp:
Oct 15, 2008, 10:45:51 AM (18 years ago)
Author:
jhoblitt
Message:

add find_objects_with_extra_instances query
change get_mounted_volumes to sort by host then name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r20155 r20175  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: SQL.pm,v 1.74 2008-10-15 01:56:00 jhoblitt Exp $
     3# $Id: SQL.pm,v 1.75 2008-10-15 20:45:51 jhoblitt Exp $
    44
    55package Nebulous::Server::SQL;
     
    324324        HAVING available_instances < instances OR instances < copies
    325325    },
     326    find_objects_with_extra_instances => qq{
     327        SELECT
     328            storage_object.so_id,
     329            ext_id,
     330            count(ins_id) as instances,
     331            volume.name as volume_name,
     332            volume.host as volume_host,
     333            count(mymountedvol.vol_id) as available_instances,
     334            count(mymountedvol.vol_id) > 0 as recoverable,
     335            storage_object_xattr.value as copies
     336        FROM storage_object
     337        JOIN instance
     338            USING(so_id)
     339        JOIN volume
     340            USING(vol_id)
     341        LEFT JOIN storage_object_xattr
     342            ON storage_object.so_id = storage_object_xattr.so_id
     343        JOIN mymountedvol
     344            USING(vol_id)
     345        WHERE
     346            mymountedvol.available = 1
     347            AND storage_object_xattr.name = 'user.copies'
     348        GROUP BY so_id
     349        HAVING available_instances > copies
     350    },
    326351    get_mounted_volumes => qq{
    327         SELECT * FROM mountedvol ORDER BY vol_id
     352        SELECT * FROM mountedvol ORDER BY host, name
    328353    },
    329354);
Note: See TracChangeset for help on using the changeset viewer.