IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28446


Ignore:
Timestamp:
Jun 23, 2010, 5:51:46 PM (16 years ago)
Author:
watersc1
Message:

Updates to add neb-migrate code, and to fix repeated "can't find device info" bug in nebdiskd.

Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/bin/nebdiskd

    r27103 r28446  
    224224                }
    225225            };
     226
     227            # fetch stats on the mounted device.  this has to be done AFTER
     228            # we determine if it's a valid mountpoint incase
     229            # is_mountpoint() invokes the automounter
     230            my $dev_info = df($mountpoint, 1024);
     231            unless (defined $dev_info) {
     232                $valid_mountpoint = 0;
     233            }
     234
    226235            if (!$valid_mountpoint) {
    227236                # try is_mountpoint() again if $retry > 1
     
    254263            # we determine if it's a valid mountpoint incase
    255264            # is_mountpoint() invokes the automounter
    256             my $dev_info = df($mountpoint, 1024);
     265            $dev_info = df($mountpoint, 1024);
    257266            unless (defined $dev_info) {
    258267                $log->error("can't find device info for $mountpoint");
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r27115 r28446  
    15981598}
    15991599
     1600sub find_ext_id_by_volume
     1601{
     1602    my $self = shift;
     1603    my $log = $self->log;
     1604    $log->debug("entered - @_");
     1605    my ($vol_name,$limit) = validate_pos(@_,
     1606                                        {
     1607                                            type      => SCALAR,
     1608# #                                         callbacks => {
     1609# #                                             'is valid volume name' => sub {
     1610# #                                                 return 1 if not defined $_[0];
     1611# #                                                 $self->_is_valid_volume_name($_[0])
     1612# #                                             },
     1613#                                           },
     1614                                        },
     1615                                        {
     1616                                            type      => SCALAR|UNDEF,
     1617                                            optional => 1,
     1618                                        },
     1619        );
     1620    unless (defined($limit)) {
     1621        $limit = 50000;
     1622    }
     1623
     1624    my $sql = $self->sql;
     1625    my @ext_ids;
     1626    my $db = $self->_db_for_index(0);
     1627    eval {
     1628        my $query;
     1629        $query = $db->prepare_cached( $sql->get_ext_id_by_vol_name );
     1630        my $rows = $query->execute($vol_name, 1,$limit);
     1631        unless ($rows > 0) {
     1632            $query->finish;
     1633            $log->logdie("no instances on storage volume or volume is not avaiable for volume: $vol_name");
     1634        }
     1635        while (my $row = $query->fetchrow_hashref) {
     1636            my $ext_id = $row->{ 'ext_id' };
     1637            push @ext_ids, $ext_id if $ext_id;
     1638        }
     1639    };
     1640    if ($@) {
     1641        $db->rollback;
     1642        $log->logdie("database error: $@");
     1643    }
     1644
     1645    # XXX remove this?
     1646    $log->logdie("no ext_ids found") unless (scalar @ext_ids);
     1647
     1648    $log->debug("found: \@ext_ids");
     1649
     1650    $log->debug("leaving");
     1651
     1652    return \@ext_ids;
     1653}
    16001654
    16011655sub find_instances
  • trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r26294 r28446  
    266266            AND mountedvol.name = ?
    267267            AND mountedvol.available = ?
     268    },
     269    get_ext_id_by_vol_name => qq{
     270        SELECT
     271            ext_id
     272        FROM instance
     273        JOIN storage_object
     274            USING (so_id)
     275        JOIN mountedvol
     276            USING(vol_id)
     277        JOIN volume
     278            USING(vol_id)
     279        WHERE volume.name = ?
     280            AND mountedvol.available = ?
     281        LIMIT ?
    268282    },
    269283    # volume handler
  • trunk/Nebulous/Build.PL

    r26019 r28446  
    113113        bin/neb-locate
    114114        bin/neb-ls
     115        bin/neb-migrate
    115116        bin/neb-mv
    116117        bin/neb-replicate
    117118        bin/neb-rm
     119        bin/neb-shift
    118120        bin/neb-stat
    119121        bin/neb-swap
  • trunk/Nebulous/MANIFEST

    r26022 r28446  
    1414bin/neb-insert
    1515bin/neb-ls
     16bin/neb-migrate
    1617bin/neb-mv
    1718bin/neb-replicate
    1819bin/neb-rm
     20bin/neb-shift
    1921bin/neb-stat
    2022bin/neb-swap
  • trunk/Nebulous/lib/Nebulous/Client.pm

    r26333 r28446  
    790790}
    791791
     792sub find_ext_id_by_volume
     793{
     794    my $self = shift;
     795    my ($vol_name, $limit) = validate_pos( @_,
     796                                           {
     797                                               type => SCALAR,
     798                                           },
     799                                           {
     800                                               type => SCALAR|UNDEF,
     801                                               optional => 1,
     802                                           },
     803        );
     804   
     805    $log->debug( "entered - @_" );
     806
     807    my $response = $self->{ 'server' }->find_ext_id_by_volume( $vol_name, $limit);
     808    if ( $response->fault ) {
     809        $self->set_err($response->faultstring);
     810        if ($response->faultstring =~ /no instances on storage volume/) {
     811            $log->debug( "leaving" );
     812            return;
     813        }
     814
     815        $log->logdie("unhandled fault - ", $self->err);
     816    }
     817
     818    my $ext_ids = $response->result;
     819   
     820    $log->debug( "server found @$ext_ids" );
     821    $log->debug( "leaving" );
     822   
     823    return($ext_ids);
     824}
     825
    792826sub find_instances_for_cull
    793827{
Note: See TracChangeset for help on using the changeset viewer.