IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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/Nebulous-Server
Files:
3 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
Note: See TracChangeset for help on using the changeset viewer.