Commit bbc5dea0 authored by Keith Downie's avatar Keith Downie

Merge remote-tracking branch 'upstream/master'

parents 9b29a309 4afd72d0
......@@ -265,6 +265,10 @@ sub GenCredentials($$;$$)
$speaksfor->SetType("speaksfor");
if ($speaksfor->Sign($speaker_signer)) {
print STDERR "Could not sign speaksfor credential\n";
print STDERR Dumper($speaksfor) . "\n";
print STDERR Dumper($geniuser) . "\n";
print STDERR Dumper($sa_authority) . "\n";
print STDERR Dumper($speaker_signer) . "\n";
goto bad;
}
}
......
......@@ -134,7 +134,7 @@ sysetc-onceonly-install:
@echo "sysetc-onceonly-install"
script-install: dir-install $(SCRIPTS)
$(INSTALL) -m 755 $(SRCDIR)/delaysetup $(BINDIR)/delaysetup
@echo "no centos-specific script files"
sfs-install:
@echo "no centos-specific sfs files"
......
This diff is collapsed.
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -35,10 +35,10 @@ use POSIX qw(strftime);
#
sub usage()
{
print "Usage: bootvnodes [-d] [-f] [-k | -h | -r | -b | -c]\n";
print STDERR "Usage: bootvnodes [-w sec] [-d] [-f] [-k|-h|-r|-b|-c]\n";
exit(1);
}
my $optlist = "kdfhrcb";
my $optlist = "kdfhrcbw:";
#
# Turn off line buffering on output
......@@ -62,6 +62,7 @@ my $vndir = "$VARDIR/jails";
my $debug = 0;
my $daemon = 1;
my $reconfig= 0;
my $waittime = 0;
my $action;
# Prototypes
......@@ -105,6 +106,13 @@ if (defined($options{"b"})) {
if (defined($options{"c"})) {
$reconfig = 1;
}
if (defined($options{"w"})) {
if ($options{"w"} !~ /^(\d+)$/) {
print STDERR "Invalid wait time for -w\n";
usage();
}
$waittime = $1;
}
if (@ARGV) {
usage();
}
......@@ -153,6 +161,20 @@ if (GENVNODE() &&
exit($? >> 8);
}
#
# Sort by vnode number if it follows are convention. We need this because
# we don't use a fixed field width for the vnode number.
# XXX I am sure there are more perl-ish ways to do this.
#
sub byvnode {
if ($a =~ /^(.*)-(\d+)$/ && ($apre = $1) && ($anum = $2) &&
$b =~ /^(.*)-(\d+)$/ && ($bpre = $1) && ($bnum = $2) &&
$apre eq $bpre) {
return $anum <=> $bnum;
}
return $a cmp $b;
}
#
# This applies to whatever vnodes are running. Do it and exit.
#
......@@ -162,11 +184,23 @@ if (defined($action) && !$reconfig) {
my @files = readdir(DIR);
closedir(DIR);
#
# XXX make a feeble effort to weed out random files.
#
# We used to do this by making sure the name was of the form
# pcvm<foo>-<num>, but not all clusters use the "pc" naming scheme.
# So now, the best we can do is ensure that the name is like
# <foo>vm<bar>-<num> and is a directory.
#
my @vnfiles = ();
foreach my $file (@files) {
if ($file =~ /^((?:pc|homenet)vm[-\w]*)$/) {
bootvnode($1, $action, (-e "$vndir/$file/fakejail" ? 0 : 1));
if ($file =~ /^([-\w]+vm[-\w]*-\d+)$/ && -d "$vndir/$file") {
push(@vnfiles, $1);
}
}
foreach my $file (sort byvnode @vnfiles) {
bootvnode($file, $action, (-e "$vndir/$file/fakejail" ? 0 : 1));
}
exit(0);
}
......@@ -190,22 +224,8 @@ foreach my $str (@tmccresults) {
if ($2 eq "0");
}
else {
warn("*** WARNING: Skipping bad subnodeid: '$str'\n");
}
}
#
# Sort by vnode number if it follows are convention. We need this because
# we don't use a fixed field width for the vnode number.
# XXX I am sure there are more perl-ish ways to do this.
#
sub byvnode {
if ($a =~ /^(.*)-(\d+)$/ && ($apre = $1) && ($anum = $2) &&
$b =~ /^(.*)-(\d+)$/ && ($bpre = $1) && ($bnum = $2) &&
$apre eq $bpre) {
return $anum <=> $bnum;
warn("*** WARNING: Skipping bad VNODEID: '$str'\n");
}
return $a cmp $b;
}
#
......@@ -218,14 +238,19 @@ if ($reconfig) {
my @files = readdir(DIR);
closedir(DIR);
# XXX make a feeble effort to weed out random files.
my @vnfiles = ();
foreach my $file (@files) {
if ($file =~ /^((?:pc|homenet)vm[-\w]*)$/) {
if (-e "$vndir/$file/fakejail") {
$fakejails++;
$curvnodelist{$1} = 0;
} else {
$curvnodelist{$1} = 1;
}
if ($file =~ /^([-\w]+vm[-\w]*-\d+)$/ && -d "$vndir/$file") {
push(@vnfiles, $1);
}
}
foreach my $file (sort byvnode @vnfiles) {
if (-e "$vndir/$file/fakejail") {
$fakejails++;
$curvnodelist{$file} = 0;
} else {
$curvnodelist{$file} = 1;
}
}
......@@ -360,7 +385,7 @@ sub bootvnode($$$)
my ($vnode, $action, $jailed) = @_;
my $opt;
my $act;
my $extrawait;
my $extrawait = $waittime;
if ($action eq "halt") {
$opt = "-h";
......@@ -369,8 +394,8 @@ sub bootvnode($$$)
elsif ($action eq "reboot") {
$opt = "-r";
$act = "Rebooting";
$extrawait = 20
if (GENVNODETYPE() eq "xen");
## XXX should no longer be needed
#$extrawait = 20 if (GENVNODETYPE() eq "xen");
}
elsif ($action eq "kill") {
$opt = "-k";
......@@ -379,8 +404,8 @@ sub bootvnode($$$)
else {
$opt = "-b";
$act = "Booting";
$extrawait = 20
if (GENVNODETYPE() eq "xen");
## XXX should no longer be needed
#$extrawait = 20 if (GENVNODETYPE() eq "xen");
}
$opt .= ($jailed ? " -jVt" : " -i");
......@@ -390,6 +415,6 @@ sub bootvnode($$$)
return($?)
if ($?);
sleep($extrawait)
if (defined($extrawait));
if ($extrawait > 0);
return 0;
}
......@@ -484,10 +484,9 @@ sub doinfo()
# $doteardown == 2 is for cleaning up after any partial or failed setups.
# This means terminating with extreme prejudice. It destroys all
# existing blockstores but ignores any errors along the way.
# $doteardown == 3 is (rather, will be) for taking an image.
# $doteardown == 3 is for taking an image.
# This means also removing entries from /etc/fstab and removing
# other ZFS/LVM/gvinum state stored in the imagable filesystems.
# Not implemented yet.
#
sub docleanup($)
{
......@@ -791,6 +790,8 @@ sub process($$$$)
}
if ($href->{'PERMS'} eq "RO") {
$msg .= " read-only";
} elsif ($href->{'PERMS'} eq "CLONE") {
$msg .= " read-write clone of";
}
print " $msg iSCSI node attached as $dev";
}
......
......@@ -3520,7 +3520,7 @@ sub getarpinfo($;$)
#
# SLICE format:
#
# CMD=SLICE IDX=<index> CLASS=local PROTO=<SAS|SCSI|SATA> \
# CMD=SLICE IDX=<index> CLASS=local PROTO=<SAS|SCSI|SATA|NVMe> \
# BSID=<local-disk-id> VOLNAME=<id> VOLSIZE=<size-in-MiB> MOUNTPOINT=<dir>
#
# Where:
......@@ -3566,7 +3566,7 @@ sub getstorageconfig($;$) {
'MOUNTPOINT' => '\/[-\w\/\.]+',
'PERMS' => '(RO|RW|CLONE)',
'PERSIST' => '(0|1)',
'PROTO' => '(iSCSI|local|SCSI|SAS|SATA|PATA|IDE)',
'PROTO' => '(iSCSI|local|SCSI|SAS|SATA|PATA|IDE|NVMe)',
'UUID' => '[-\w\.:]+',
'UUID_TYPE'=> '(iqn|serial)',
'VOLNAME' => '[-\w]+',
......
......@@ -628,7 +628,7 @@ if (! -e "$VNDIR/vnode.info") {
($ret,$err) = safeLibOp('vnodeCreate',0,0);
if ($err) {
MyFatal("vnodeCreate failed");
MyFatal("vnodeCreate failed: $err");
}
$vmid = $ret;
......
......@@ -356,6 +356,7 @@ sub handler ($) {
my ($signame) = @_;
print STDERR "vnodesetup ($PID) caught a SIG${signame}!\n";
TBDebugTimeStampWithDate("vnodesetup shutting down ...");
$SIG{USR1} = 'IGNORE';
$SIG{USR2} = 'IGNORE';
......
......@@ -206,6 +206,15 @@ sub find_serial($)
# Try using "smartctl -i" first
#
if (-x "$SMARTCTL") {
# XXX for NVMe devices we have to use a control device
# XXX assumes namespace 1
if ($dev =~ /^nvd(\d+)/) {
my $nvmedev = "nvme" . $1 . "ns1";
if (-e "/dev/$nvmedev") {
$dev = $nvmedev;
}
}
@lines = `$SMARTCTL -i /dev/$dev 2>&1`;
foreach (@lines) {
if (/^serial number:\s+(\S.*)/i) {
......@@ -229,13 +238,13 @@ sub init_serial_map()
{
my %snmap = ();
my @lines = `ls /dev/ad* /dev/da* /dev/mfid* /dev/mfisyspd* 2>&1`;
my @lines = `ls /dev/ad* /dev/da* /dev/mfid* /dev/mfisyspd* /dev/nvd* 2>&1`;
foreach (@lines) {
# XXX just use the /dev/ad? traditional names for now
if (m#^/dev/ada\d+$#) {
next;
}
if (m#^/dev/((?:da|ad|mfid|mfisyspd)\d+)$#) {
if (m#^/dev/((?:da|ad|mfid|mfisyspd|nvd)\d+)$#) {
my $dev = $1;
$sn = find_serial($dev);
if ($sn) {
......
# No stupid menu
beastie_disable="YES"
# Shorten this to allow faster boots
autoboot_delay="5"
## for wireless nodes
#if_ath_load="YES"
#hw.bge.allow_asf=1
......
# No stupid menu
beastie_disable="YES"
## for wireless nodes
#if_ath_load="YES"
#hw.bge.allow_asf=1
# Shorten this to allow faster boots
autoboot_delay="5"
#
# If you are using an extra, regular (i.e., visible to the OS) Ethernet port
......
......@@ -847,7 +847,7 @@ sub volumeDestroy($$$$) {
# Volume must not have snapshots
if (exists($vref->{'snapshots'})) {
warn("*** ERROR: $tag: ".
"Volume '$volname' has clones, cannot destroy");
"Volume '$volname' has clones and/or snapshots, cannot destroy");
return -1;
}
......
......@@ -195,11 +195,12 @@ sub init_serial_map()
# XXX this is a total hack and maybe distro dependent?
#
my %snmap = ();
my @lines = `ls -l /sys/block/sd[a-z] /sys/block/sd[a-z][a-z] 2>&1`;
my @lines = `ls -l /sys/block/sd[a-z] /sys/block/sd[a-z][a-z] /sys/block/nvme[0-9]* 2>&1`;
foreach (@lines) {
# XXX if a pci device, assume a local disk
# XXX for moonshots (arm64), it is different
if (m#/sys/block/(sd[a-z][a-z]?) -> ../devices/pci\d+# ||
m#/sys/block/(nvme\d+n\d+) -> ../devices/pci\d+# ||
m#/sys/block/(sd[a-z][a-z]?) -> ../devices/soc.\d+#) {
my $dev = $1;
$sn = find_serial($dev);
......@@ -235,7 +236,9 @@ sub get_bootdisk()
if ($line && $line =~ qr{^(/dev/\S+) on /}) {
my $device = abs_path($1);
if ($device && $device =~ qr{^/dev/(\S+)\d+}) {
if ($device &&
($device =~ qr{^/dev/(nvme\S+)p\d+} ||
$device =~ qr{^/dev/(\S+)\d+})) {
$disk = $1;
}
}
......@@ -253,7 +256,7 @@ sub get_ptabtype($)
}
# if sfdisk fails, assume unknown
my $pinfo = `$SFDISK -l /dev/sda 2>&1`;
my $pinfo = `$SFDISK -l /dev/$dev 2>&1`;
if ($?) {
return "unknown";
}
......@@ -282,7 +285,8 @@ sub get_partsize($)
return $size;
}
while (<FD>) {
if (/^\s+\d+\s+\d+\s+(\d+)\s+(sd[a-z][a-z]?(?:\d+)?)/) {
if (/^\s+\d+\s+\d+\s+(\d+)\s+((?:xvd|sd)[a-z][a-z]?)(?:\d+)?/ ||
/^\s+\d+\s+\d+\s+(\d+)\s+(nvme\d+n\d+)(?:p\d+)?/) {
my ($_size,$_dev) = ($1,$2);
if ($dev eq $_dev) {
......@@ -387,8 +391,9 @@ sub get_diskinfo()
return undef;
}
while (<FD>) {
if (/^\s+\d+\s+\d+\s+(\d+)\s+((xvd|sd)[a-z][a-z]?)(\d+)?/) {
my ($size,$dev,$part) = ($1,$2,$4);
if (/^\s+\d+\s+\d+\s+(\d+)\s+((?:xvd|sd)[a-z][a-z]?)(\d+)?/ ||
/^\s+\d+\s+\d+\s+(\d+)\s+(nvme\d+n\d+)(?:p(\d+))?/) {
my ($size,$dev,$part) = ($1,$2,$3);
# DOS partition
if (defined($part)) {
my $pttype = "MBR";
......@@ -400,6 +405,9 @@ sub get_diskinfo()
next if ($pttype eq "MBR" && ($part < 1 || $part > 4));
my $pdev = "$dev$part";
if ($dev =~ /^nvme/) {
$pdev = "${dev}p${part}";
}
$geominfo{$pdev}{'level'} = 1;
$geominfo{$pdev}{'type'} = "PART";
$geominfo{$pdev}{'size'} = int($size / 1024);
......@@ -430,7 +438,7 @@ sub get_diskinfo()
return undef;
}
while (<FD>) {
if (/^\/dev\/((xvd|sd)\S+)/) {
if (/^\/dev\/((?:xvd|sd|nvme)\S+)/) {
my $dev = $1;
if (exists($geominfo{$dev}) && $geominfo{$dev}{'inuse'} == 0) {
$geominfo{$dev}{'inuse'} = -1;
......@@ -446,7 +454,7 @@ sub get_diskinfo()
foreach my $dev (keys %geominfo) {
if ($geominfo{$dev}{'type'} eq "PART" &&
$geominfo{$dev}{'level'} == 1 &&
$dev =~ /^(.*)\d+$/) {
($dev =~ /^(nvme\d+n\d+)p\d+$/ || $dev =~ /^(.*)\d+$/)) {
if (exists($geominfo{$1}) && $geominfo{$1}{'inuse'} == 0) {
$geominfo{$1}{'inuse'} = 1;
}
......@@ -1047,7 +1055,11 @@ sub os_check_storage_slice($$)
# figure out the device of interest
if ($bsid eq "SYSVOL") {
$dev = $rdev = "${bdisk}4";
my $pchr = "";
if ($bdisk =~ /^nvme/) {
$pchr = "p";
}
$dev = $rdev = "${bdisk}${pchr}4";
$devtype = "PART";
$pttype = $ginfo->{$bdisk}->{'ptabtype'};
} else {
......@@ -1472,7 +1484,11 @@ sub os_create_storage_slice($$$)
# dostype -f /dev/sda 4 131
#
if ($bsid eq "SYSVOL") {
$mdev = "$bdisk" . "4";
my $pchr = "";
if ($bdisk =~ /^nvme/) {
$pchr = "p";
}
$mdev = "${bdisk}${pchr}4";
if ($ginfo->{$bdisk}->{'ptabtype'} eq "GPT") {
if (exists($ginfo->{$mdev})) {
......@@ -1518,7 +1534,11 @@ sub os_create_storage_slice($$$)
my $dev;
if ($bsid eq "ANY") {
$dev = $bdisk . "4";
my $pchr = "";
if ($bdisk =~ /^nvme/) {
$pchr = "p";
}
$dev = "${bdisk}${pchr}4";
if ($ginfo->{$bdisk}->{'ptabtype'} eq "GPT") {
if (exists($ginfo->{$dev})) {
......@@ -1715,7 +1735,11 @@ sub os_remove_storage_slice($$$)
# figure out the device of interest
my ($dev, $devtype, $mdev);
if ($bsid eq "SYSVOL") {
$dev = $mdev = "${bdisk}4";
my $pchr = "";
if ($bdisk =~ /^nvme/) {
$pchr = "p";
}
$dev = $mdev = "${bdisk}${pchr}4";
$devtype = "PART";
} else {
$dev = "emulab/$lv";
......
......@@ -795,9 +795,14 @@ sub restartDHCP()
if (mysystem2("/sbin/initctl restart $dhcpd_service") != 0) {
mysystem2("/sbin/initctl start $dhcpd_service");
}
} else {
#sysvinit
} elsif (-x '/bin/systemctl') {
# systemd
mysystem2("/bin/systemctl restart $dhcpd_service.service");
} elsif (-x '/etc/init.d/$dhcpd_service') {
# sysvinit
mysystem2("/etc/init.d/$dhcpd_service restart");
} else {
print STDERR "restartDHCP: could not restart dhcpd!\n";
}
}
......
......@@ -27,6 +27,7 @@ use English;
use Data::Dumper;
use POSIX qw(setsid);
use POSIX ":sys_wait_h";
use POSIX ":signal_h";
use Socket;
#
......@@ -302,6 +303,9 @@ sub Online()
else {
POSIX::setsid();
# XXX make sure we can kill the proxy when done
local $SIG{TERM} = 'DEFAULT';
exec("$BINDIR/tmcc.bin -d -t 15 -n $vnode_id ".
" -X $host_ip:$local_tmcd_port -s $boss_ip -p $TMCD_PORT ".
" -o $LOGDIR/tmccproxy.$vnode_id.log");
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
# Generated by GNU Autoconf 2.69.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
# Copyright (C) 1992-1996, 1998-2012, 2016 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
......@@ -6873,6 +6873,18 @@ else
PROTOGENI_URL="https://$PROTOGENI_RPCNAME:$PROTOGENI_RPCPORT/protogeni/xmlrpc"
fi
#
# Check to see if snmpit is a plain file, delete it if so. It is now
# a directory. This only matters when reconfiguring an existing tree.
#
if test -f "tbsetup/snmpit"; then
echo "Removing old snmpit file, now a directory";
/bin/rm -f tbsetup/snmpit
if test $? -ne 0; then
as_fn_error $? "Cannot remove old tbsetup/snmpit file" "$LINENO" 5;
fi
fi
#
# Determine the timezone (stupidity in PHP5, see apache/php.ini)
#
......@@ -6951,8 +6963,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
backend/editnodetype backend/editsitevars backend/newimageid \
backend/editgroup backend/newimageid_ez \
tbsetup/GNUmakefile tbsetup/console_setup tbsetup/spewlogfile \
tbsetup/snmpit_test/GNUmakefile \
tbsetup/snmpit_old/GNUmakefile \
tbsetup/snmpit/GNUmakefile \
tbsetup/spewrpmtar tbsetup/gentopofile tbsetup/power_sgmote.pm \
tbsetup/console_reset tbsetup/bwconfig tbsetup/power_rpc27.pm \
tbsetup/power_mail.pm tbsetup/power_whol.pm \
......
......@@ -1209,6 +1209,18 @@ else
PROTOGENI_URL="https://$PROTOGENI_RPCNAME:$PROTOGENI_RPCPORT/protogeni/xmlrpc"
fi
#
# Check to see if snmpit is a plain file, delete it if so. It is now
# a directory. This only matters when reconfiguring an existing tree.
#
if test -f "tbsetup/snmpit"; then
echo "Removing old snmpit file, now a directory";
/bin/rm -f tbsetup/snmpit
if test $? -ne 0; then
AC_MSG_ERROR([Cannot remove old tbsetup/snmpit file]);
fi
fi
#
# Determine the timezone (stupidity in PHP5, see apache/php.ini)
#
......@@ -1285,8 +1297,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
backend/editnodetype backend/editsitevars backend/newimageid \
backend/editgroup backend/newimageid_ez \
tbsetup/GNUmakefile tbsetup/console_setup tbsetup/spewlogfile \
tbsetup/snmpit_test/GNUmakefile \
tbsetup/snmpit_old/GNUmakefile \
tbsetup/snmpit/GNUmakefile \
tbsetup/spewrpmtar tbsetup/gentopofile tbsetup/power_sgmote.pm \
tbsetup/console_reset tbsetup/bwconfig tbsetup/power_rpc27.pm \
tbsetup/power_mail.pm tbsetup/power_whol.pm \
......
......@@ -5769,7 +5769,7 @@ sub SyncPortLans($)
}
print "Syncing target vlan $idx in $experiment\n";
mysystem("$TB/bin/snmpit_test -f --redirect-err -X $pid $eid $idx");
mysystem("$TB/bin/snmpit -f --redirect-err -X $pid $eid $idx");
if ($?) {
$portvlan->Unlock();
return -1;
......@@ -6012,7 +6012,7 @@ sub ClearPortLans($;$@)
my $lanid = $portvlan->lanid();
print "Syncing target vlan $lanid in $experiment\n";
mysystem("$TB/bin/snmpit_test -f --redirect-err -X $pid $eid $lanid");
mysystem("$TB/bin/snmpit -f --redirect-err -X $pid $eid $lanid");
if ($?) {
$portvlan->Unlock()
if (!$nolock);
......
......@@ -456,7 +456,7 @@ Setting up an InstaGeni Rack. First, we need the following info:
Now create and share the openflow vlan:
boss> wap snmpit_test --vlan_tag=1750 -m mesoscale-openflow \
boss> wap snmpit --vlan_tag=1750 -m mesoscale-openflow \
emulab-ops openflow-vlans interconnect-geni-core:eth0
boss> wap sharevlan -f -o emulab-ops,openflow-vlans \
mesoscale-openflow mesoscale-openflow
......
......@@ -82,7 +82,7 @@ my $EVENTSYS = "$TB/bin/eventsys_control";
my $VNODESETUP = "$TB/sbin/vnode_setup";
my $POWER = "$TB/bin/power";
my $OSLOAD = "$TB/bin/os_load";
my $SNMPIT = "$TB/bin/snmpit_test";
my $SNMPIT = "$TB/bin/snmpit";
my $NAMEDSETUP = "$TB/sbin/named_setup";
my $EXPORTS_SETUP = "$TB/sbin/exports_setup";
my $GENTOPOFILE = "$TB/libexec/gentopofile";
......
......@@ -109,7 +109,7 @@ my $IPASSIGN = "$TB/libexec/ipassign_wrapper";
my $TARFILES_SETUP = "$TB/bin/tarfiles_setup";
my $MAPPER = "$TB/bin/mapper";
my $VTOPGEN = "$TB/bin/vtopgen";
my $SNMPIT = "$TB/bin/snmpit_test";
my $SNMPIT = "$TB/bin/snmpit";
my $RESERVEVLANS = "$TB/sbin/protogeni/reservevlans";
my $NEWGROUP = "$TB/bin/newgroup";
my $NEWPROJECT = "$TB/sbin/newproj";
......
......@@ -2190,8 +2190,7 @@ CREATE TABLE `image_aliases` (
`uuid` varchar(40) NOT NULL default '',
`target_imagename` varchar(30) NOT NULL default '',
`target_imageid` int(8) unsigned NOT NULL default '0',
PRIMARY KEY (`imageid`),
UNIQUE KEY `pid` (`pid`,`imagename`),
PRIMARY KEY (`imageid`,`target_imageid`),
KEY `uuid` (`uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......
......@@ -1099,9 +1099,11 @@ REPLACE INTO table_regex VALUES ('images','relocatable','text','redirect','defau
REPLACE INTO table_regex VALUES ('images','origin_uuid','text','regex','^\\w+\\-\\w+\\-\\w+\\-\\w+\\-\\w+$',0,64,NULL);
REPLACE INTO table_regex VALUES ('images','origin_name','text','regex','^[-\\w\\.+:\\/]+$',0,128,NULL);
REPLACE INTO table_regex VALUES ('images','origin_urn','text','redirect','projects:manager_urn',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','architecture','text','regex','^[\\w,]*$',0,0,NULL);
REPLACE INTO table_regex VALUES ('node_types','new_type','text','redirect','default:tinytext',0,0,NULL);
REPLACE INTO table_regex VALUES ('node_types','node_type','text','regex','^[-\\w]+$',1,30,NULL);
REPLACE INTO table_regex VALUES ('node_types','class','text','regex','^[\\w]+$',1,30,NULL);
REPLACE INTO table_regex VALUES ('node_types','architecture','text','regex','^[\\w,]*$',0,0,NULL);
REPLACE INTO table_regex VALUES ('node_types','isvirtnode','text','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('node_types','isjailed','text','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('node_types','isswitch','text','redirect','default:boolean',0,0,NULL);
......
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
#
# No one is using this table yet.
#
DBQueryFatal("ALTER TABLE image_aliases DROP KEY `pid`");
DBQueryFatal("ALTER TABLE image_aliases DROP PRIMARY KEY");
DBQueryFatal("ALTER TABLE image_aliases ADD PRIMARY KEY ".
"(`imageid`,`target_imageid`)");
DBQueryFatal("REPLACE INTO table_regex VALUES ".
"('images','architecture', ".
" 'text','regex','^[\\\\w,]*\$',0,0,NULL)");
DBQueryFatal("REPLACE INTO table_regex VALUES ".
"('node_types','architecture', ".
" 'text','regex','^[\\\\w,]*\$',0,0,NULL)");
# Fix up special OSids; clear the version string so that it
# passes IsGeneric().