Skip to content
Snippets Groups Projects
Select Git revision
  • 21e8d0a405f74ca62ad3a9542d89b47486d87e5b
  • master default protected
  • portal-css
  • openssl-1-1-0
  • imagezip-64
  • wireless-techpreview
  • lbs-greatness
  • extension-fix
  • extension-rounding-test
  • root-keypair-r1
  • admission-control-prereserve-fix
  • typelimitfix
  • no-require
  • imagealiases
  • reserve-nalloc
  • 153-add-a-flag-to-assign-to-turn-the-different-type-penalty-into-a-violation
  • current
  • gblinks
  • kmerge
  • dashboard-reorg
  • newports
  • stable-20180326
  • pre-igevent-changes
  • stable-20170417
  • stable-20160912
  • stable-20160222
  • stable-20150511
  • instageni-20141003
  • help
  • list
  • instageni-20140823
  • stable-20140728
  • instageni-20140418
  • instageni-20140214
  • instageni-20140207
  • instageni-20140124
  • instageni-20140117
  • instageni-20140103
  • instageni-20131209
  • instageni-20131115
  • stable-20131118
41 results

nsgenilib.py.in

Blame
  • Forked from emulab / emulab-devel
    Source project has a limited visibility.
    step4_newids.pl 15.45 KiB
    #!/usr/bin/perl -w
    #
    # Copyright (c) 2006, 2007 University of Utah and the Flux Group.
    # 
    # {{{EMULAB-LICENSE
    # 
    # This file is part of the Emulab network testbed software.
    # 
    # This file is free software: you can redistribute it and/or modify it
    # under the terms of the GNU Affero General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or (at
    # your option) any later version.
    # 
    # This file is distributed in the hope that it will be useful, but WITHOUT
    # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
    # License for more details.
    # 
    # You should have received a copy of the GNU Affero General Public License
    # along with this file.  If not, see <http://www.gnu.org/licenses/>.
    # 
    # }}}
    #
    use English;
    
    use lib "/usr/testbed/lib";
    use libdb;
    use libtestbed;
    
    #
    # Untaint the path
    # 
    $ENV{'PATH'} = '/bin:/usr/bin:/usr/sbin';
    delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
    
    my %new_osids    = ();
    my %new_imageids = ();
    my $index        = 100;
    
    #
    # See if a table has been changed by looking for the existence of a field.
    #
    sub TableChanged($$)
    {
        my ($table, $slot) = @_;
    
        my $describe_result =
    	DBQueryFatal("describe $table $slot");
    
        return $describe_result->numrows;
    }
    
    DBQueryFatal("drop table if exists ".
    	     " temp_images, temp_os_info, temp_o2i, ".
    	     " temp_osid_map, temp_partitions, temp_nodes, ".
    	     " temp_attributes, temp_cur_reloads, temp_sched_reloads");
    
    DBQueryFatal("create table temp_os_info like os_info");
    DBQueryFatal("create table temp_images like images");
    DBQueryFatal("create table temp_o2i (".
    	     " `osid` int(8) unsigned NOT NULL default '0',".
    	     " `type` varchar(30) NOT NULL default '', ".
    	     " `imageid` int(8) unsigned NOT NULL default '0', ".
    	     " PRIMARY KEY  (`osid`,`type`) ".
    	     " ) ENGINE=MyISAM DEFAULT CHARSET=latin1");
    DBQueryFatal("create table temp_osid_map (".
    	     " `osid` int(8) unsigned NOT NULL default '0',".
    	     " `btime` datetime NOT NULL default '1000-01-01 00:00:00', ".
    	     " `etime` datetime NOT NULL default '9999-12-31 23:59:59', ".
    	     " `nextosid` int(8) unsigned NOT NULL default '0', ".