Commit 58ebf784 authored by Mike Hibler's avatar Mike Hibler

Resolve some Mysql 5.7 keyword conflicts.

partition/partitions/stored/virtual
parent c69bf73f
#!/usr/bin/perl -wT
#
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -561,7 +561,7 @@ if (!exists($newimageid_args{"mbr_version"}) && defined($node_id)) {
# to version 1.
#
my $query_result =
DBQueryFatal("select mbr_version from partitions as p, images as i ".
DBQueryFatal("select mbr_version from `partitions` as p, images as i ".
" where p.imageid=i.imageid and p.node_id='$node_id' ".
" group by mbr_version");
if ($query_result && $query_result->numrows == 1) {
......
......@@ -650,7 +650,7 @@ if (!$isdataset &&
#
my $query_result =
DBQueryFatal("select mbr_version from ".
" partitions as p,image_versions as i ".
" `partitions` as p,image_versions as i ".
" where p.imageid=i.imageid ".
" and p.imageid_version=i.version ".
" and p.node_id='$node_id' group by mbr_version");
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2007-2016 University of Utah and the Flux Group.
# Copyright (c) 2007-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -494,7 +494,7 @@ sub CompareVlansWithSwitches($$$)
# Grab the existing vlans from the vlans table (managed by snmpit).
#
my $query_result =
DBQueryWarn("select id,virtual,members,tag from vlans ".
DBQueryWarn("select id,`virtual`,members,tag from vlans ".
"where exptidx='$exptidx'");
return -1
if (!$query_result);
......@@ -578,7 +578,7 @@ sub CompareVlansWithSwitches2($$)
# Grab the existing vlans from the vlans table (managed by snmpit).
#
my $query_result =
DBQueryWarn("select id,virtual,members,tag from vlans ".
DBQueryWarn("select id,`virtual`,members,tag from vlans ".
"where exptidx='$exptidx'");
return -1
if (!$query_result);
......@@ -3487,7 +3487,7 @@ sub RecordVlanInsertion($$$)
DBQueryWarn("replace into vlans set ".
" id='$lanid', pid='$pid', eid='$eid', exptidx='$exptidx', ".
" virtual='$vname', members='$members', tag='$tag', ".
" `virtual`='$vname', members='$members', tag='$tag', ".
" stack='$stack', class='$vclass' $path")
or return -1;
......
......@@ -400,7 +400,7 @@ sub Store($)
}
unlink($filename);
DBQueryWarn("update logfiles set ".
" stored=1,compressed=1,filename=$newname ".
" `stored`=1,compressed=1,filename=$newname ".
"where logid='$logid'")
or return -1;
......
......@@ -2788,7 +2788,7 @@ sub DeleteVnodes(@)
# Need to clean out some additional tables since some vnodes can be
# reimaged now!
DBQueryWarn("delete from current_reloads where node_id='$vnodeid'");
DBQueryWarn("delete from partitions where node_id='$vnodeid'");
DBQueryWarn("delete from `partitions` where node_id='$vnodeid'");
# Slothd updates/creates these records.
DBQueryWarn("delete from node_activity where node_id='$vnodeid'");
DBQueryWarn("delete from node_idlestats where node_id='$vnodeid'");
......@@ -2991,7 +2991,7 @@ sub ClearPartitions($)
my $node_id = $self->node_id();
DBQueryWarn("delete from partitions where node_id='$node_id'");
DBQueryWarn("delete from `partitions` where node_id='$node_id'");
return 0;
}
......@@ -3615,7 +3615,7 @@ sub IsOSLoaded($$)
my $nodeid = $self->node_id();
my $query_result =
DBQueryWarn("select osid from partitions as p ".
DBQueryWarn("select osid from `partitions` as p ".
"where p.node_id='$nodeid' and p.osid='$osid' and ".
" p.osid_vers='$vers'");
return -1
......@@ -4128,7 +4128,7 @@ sub SyncDiskPartitionTaintStates($)
my $node_id = $self->node_id();
my $query_result =
DBQueryWarn("select osid,osid_vers from partitions ".
DBQueryWarn("select osid,osid_vers from `partitions` ".
"where node_id='$node_id' and osid is not null");
return -1
if (!$query_result);
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2008,2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -123,7 +123,7 @@ if (defined($args{"ver"})) {
$cond .= " and d.version='".$args{"ver"}."'" if $args{"ver"} ne '=';
}
if ($os) {
$join .= " left join partitions as c on a.node_id=c.node_id";
$join .= " left join `partitions` as c on a.node_id=c.node_id";
$join .= " left join os_info as d on c.osid=d.osid";
}
if (defined($args{"prereserve"})) {
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2014, 2016 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -558,8 +558,8 @@ sub TBPxelinuxConfig($;$)
$action = "pxefail";
my $query_result =
DBQueryWarn("SELECT v.path,v.mfs,p.partition FROM nodes AS n ".
" LEFT JOIN partitions AS p ON ".
DBQueryWarn("SELECT v.path,v.mfs,p.`partition` FROM nodes AS n ".
" LEFT JOIN `partitions` AS p ON ".
" n.node_id=p.node_id AND ".
" n.${field}=p.osid ".
" LEFT JOIN os_info AS i ON ".
......@@ -794,7 +794,7 @@ sub TBOSCountInstances ($;@)
$nodelist = "0";
}
my $query_result = DBQueryFatal("select distinct p.node_id from partitions " .
my $query_result = DBQueryFatal("select distinct p.node_id from `partitions` " .
"as p left join reserved as r on p.node_id = r.node_id " .
"where osid='$osid' and !($nodelist) and r.pid != '$TBOPSPID'");
my $current_count = $query_result->num_rows();
......
#!/usr/bin/perl -wT
#
# Copyright (c) 2005 University of Utah and the Flux Group.
# Copyright (c) 2005-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -127,8 +127,8 @@ foreach my $node_id (@node_ids) {
"op_mode_timestamp=NOW(),allocstate='FREE',".
"allocstate_timestamp=NOW()");
DBQueryFatal("REPLACE INTO partitions SET ".
"node_id='$node_id',partition=1,".
DBQueryFatal("REPLACE INTO `partitions` SET ".
"node_id='$node_id',`partition`=1,".
"osid='emulab-ops-TinyOS-STD'");
DBQueryFatal("REPLACE INTO tiplines SET ".
......
/*
* Copyright (c) 2000-2016 University of Utah and the Flux Group.
* Copyright (c) 2000-2017 University of Utah and the Flux Group.
*
* {{{EMULAB-LICENSE
*
......@@ -155,17 +155,17 @@ query_bootinfo_db(struct in_addr ipaddr, char *node_id, int version,
*/
res = mydb_query("select n.def_boot_osid, n.def_boot_cmd_line, "
" odef.path, odef.mfs, "
" odef.osfeatures, pdef.partition, "
" odef.osfeatures, pdef.`partition`, "
" n.temp_boot_osid, "
" otemp.path, otemp.mfs, "
" otemp.osfeatures, ptemp.partition, "
" otemp.osfeatures, ptemp.`partition`, "
" n.next_boot_osid, n.next_boot_cmd_line, "
" onext.path, onext.mfs, "
" onext.osfeatures, pnext.partition, "
" onext.osfeatures, pnext.`partition`, "
" r.pid,n.pxe_boot_path "
" from nodes as n "
"left join reserved as r on n.node_id=r.node_id "
"left join partitions as pdef on "
"left join `partitions` as pdef on "
" n.node_id=pdef.node_id and "
" n.def_boot_osid=pdef.osid "
"left join os_info as oidef on "
......@@ -173,7 +173,7 @@ query_bootinfo_db(struct in_addr ipaddr, char *node_id, int version,
"left join os_info_versions as odef on "
" odef.osid=oidef.osid and "
" odef.vers=oidef.version "
"left join partitions as ptemp on "
"left join `partitions` as ptemp on "
" n.node_id=ptemp.node_id and "
" n.temp_boot_osid=ptemp.osid "
"left join os_info as oitemp on "
......@@ -181,7 +181,7 @@ query_bootinfo_db(struct in_addr ipaddr, char *node_id, int version,
"left join os_info_versions as otemp on "
" otemp.osid=oitemp.osid and "
" otemp.vers=oitemp.version "
"left join partitions as pnext on "
"left join `partitions` as pnext on "
" n.node_id=pnext.node_id and "
" n.next_boot_osid=pnext.osid "
"left join os_info as oinext on "
......@@ -201,18 +201,18 @@ query_bootinfo_db(struct in_addr ipaddr, char *node_id, int version,
else if (! haskey) {
res = mydb_query("select n.def_boot_osid, n.def_boot_cmd_line, "
" odef.path, odef.mfs, "
" odef.osfeatures, pdef.partition, "
" odef.osfeatures, pdef.`partition`, "
" n.temp_boot_osid, "
" otemp.path, otemp.mfs, "
" otemp.osfeatures, ptemp.partition, "
" otemp.osfeatures, ptemp.`partition`, "
" n.next_boot_osid, n.next_boot_cmd_line, "
" onext.path, onext.mfs, "
" onext.osfeatures, pnext.partition, "
" onext.osfeatures, pnext.`partition`, "
" r.pid,n.pxe_boot_path "
" from interfaces as i "
"left join nodes as n on i.node_id=n.node_id "
"left join reserved as r on i.node_id=r.node_id "
"left join partitions as pdef on "
"left join `partitions` as pdef on "
" n.node_id=pdef.node_id and "
" n.def_boot_osid=pdef.osid "
"left join os_info as oidef on "
......@@ -220,7 +220,7 @@ query_bootinfo_db(struct in_addr ipaddr, char *node_id, int version,
"left join os_info_versions as odef on "
" odef.osid=oidef.osid and "
" odef.vers=oidef.version "
"left join partitions as ptemp on "
"left join `partitions` as ptemp on "
" n.node_id=ptemp.node_id and "
" n.temp_boot_osid=ptemp.osid "
"left join os_info as oitemp on "
......@@ -228,7 +228,7 @@ query_bootinfo_db(struct in_addr ipaddr, char *node_id, int version,
"left join os_info_versions as otemp on "
" otemp.osid=oitemp.osid and "
" otemp.vers=oitemp.version "
"left join partitions as pnext on "
"left join `partitions` as pnext on "
" n.node_id=pnext.node_id and "
" n.next_boot_osid=pnext.osid "
"left join os_info as oinext on "
......@@ -280,18 +280,18 @@ query_bootinfo_db(struct in_addr ipaddr, char *node_id, int version,
/* This is meant to be similar to the above, but queries on the wideareanodekey instead. */
res = mydb_query("SELECT n.def_boot_osid, n.def_boot_cmd_line, "
" odef.path, odef.mfs, "
" odef.osfeatures, pdef.partition, "
" odef.osfeatures, pdef.`partition`, "
"n.temp_boot_osid, "
" otemp.path, otemp.mfs, "
" otemp.osfeatures, ptemp.partition, "
" otemp.osfeatures, ptemp.`partition`, "
"n.next_boot_osid, n.next_boot_cmd_line, "
" onext.path, onext.mfs, "
" onext.osfeatures, pnext.partition, "
" onext.osfeatures, pnext.`partition`, "
"r.pid,n.pxe_boot_path "
"FROM nodes AS n "
"LEFT JOIN reserved AS r ON "
" n.node_id=r.node_id "
"LEFT JOIN partitions AS pdef ON "
"LEFT JOIN `partitions` AS pdef ON "
" n.node_id=pdef.node_id AND "
" n.def_boot_osid=pdef.osid "
"LEFT JOIN os_info AS oidef ON "
......@@ -299,7 +299,7 @@ query_bootinfo_db(struct in_addr ipaddr, char *node_id, int version,
"left join os_info_versions as odef on "
" odef.osid=oidef.osid and "
" odef.vers=oidef.version "
"LEFT JOIN partitions AS ptemp ON"
"LEFT JOIN `partitions` AS ptemp ON"
" n.node_id=ptemp.node_id AND "
" n.temp_boot_osid=ptemp.osid "
"LEFT JOIN os_info AS oitemp ON "
......@@ -307,7 +307,7 @@ query_bootinfo_db(struct in_addr ipaddr, char *node_id, int version,
"left join os_info_versions as otemp on "
" otemp.osid=oitemp.osid and "
" otemp.vers=oitemp.version "
"LEFT JOIN partitions AS pnext ON "
"LEFT JOIN `partitions` AS pnext ON "
" n.node_id=pnext.node_id AND "
" n.next_boot_osid=pnext.osid "
"LEFT JOIN os_info AS oinext ON "
......
......@@ -106,12 +106,12 @@ sub DoUpdate($$$)
" AFTER parent_osid");
}
if (!DBSlotExists("partitions", "osid_vers")) {
DBQueryFatal("ALTER TABLE partitions ADD ".
DBQueryFatal("ALTER TABLE `partitions` ADD ".
" `osid_vers` int(8) unsigned default NULL ".
" AFTER osid");
}
if (!DBSlotExists("partitions", "imageid_version")) {
DBQueryFatal("ALTER TABLE partitions ADD ".
DBQueryFatal("ALTER TABLE `partitions` ADD ".
" `imageid_version` int(8) unsigned default NULL ".
" AFTER imageid");
}
......
......@@ -368,7 +368,7 @@ sub osload ($$) {
if (!$prepare) {
my $dbresult =
DBQueryWarn("select p.*,v.mbr_version ".
" from partitions as p,image_versions as v ".
" from `partitions` as p,image_versions as v ".
" where p.imageid=v.imageid and ".
" p.imageid_version=v.version and ".
" v.deleted is null ".
......@@ -537,16 +537,16 @@ sub osload ($$) {
my $imvers = $href->{'imageid_version'};
my $impid = $href->{'imagepid'};
$dbresult =
DBQueryWarn("replace into partitions ".
"(node_id,partition,osid,imageid,imagepid,".
DBQueryWarn("replace into `partitions` ".
"(node_id,`partition`,osid,imageid,imagepid,".
" osid_vers,imageid_version) ".
"values ".
"('$node','$i','$osid','$imid','$impid',".
" '$osvers','$imvers')");
} else {
$dbresult =
DBQueryWarn("delete from partitions ".
"where node_id='$node' and partition='$i'");
DBQueryWarn("delete from `partitions` ".
"where node_id='$node' and `partition`='$i'");
}
if (!$dbresult) {
tberror "$node: Could not update partitions table";
......@@ -1486,13 +1486,13 @@ sub osload_setupswapinfo($$;@)
# set to an MFS at other times.
#
my $query_result = DBQueryWarn(
"select r.node_id,r.vname,r.pid,r.eid,r.erole,n.osid,p.partition,".
"select r.node_id,r.vname,r.pid,r.eid,r.erole,n.osid,p.`partition`,".
" p.imageid,p.imageid_version,p.imagepid,i.imagename,".
" iv.loadpart,e.savedisk ".
"from reserved as r ".
"left join nodes as n on n.node_id=r.node_id ".
"left join node_types as nt on nt.type=n.type ".
"left join partitions as p on p.node_id=n.node_id and ".
"left join `partitions` as p on p.node_id=n.node_id and ".
" p.osid=n.def_boot_osid ".
"left join images as i on i.imageid=p.imageid and ".
" i.version=p.imageid_version ".
......
......@@ -1496,13 +1496,13 @@ sub osload_setupswapinfo($$$;@)
# set to an MFS at other times.
#
my $query_result = DBQueryWarn(
"select r.node_id,r.vname,r.pid,r.eid,r.erole,n.osid,p.partition,".
"select r.node_id,r.vname,r.pid,r.eid,r.erole,n.osid,p.`partition`,".
" p.imageid,p.imageid_version,p.imagepid,i.imagename,".
" iv.loadpart,e.savedisk ".
"from reserved as r ".
"left join nodes as n on n.node_id=r.node_id ".
"left join node_types as nt on nt.type=n.type ".
"left join partitions as p on p.node_id=n.node_id and ".
"left join `partitions` as p on p.node_id=n.node_id and ".
" p.osid=n.def_boot_osid ".
"left join images as i on i.imageid=p.imageid and ".
" i.version=p.imageid_version ".
......@@ -2066,8 +2066,8 @@ sub SaveNodeDiskInfo($$)
# Save the old ones off first!
#
my $dbres;
$dbres = DBQueryFatal("select node_id,partition,osid,imageid,imagepid" .
" from partitions where node_id='$node_id'");
$dbres = DBQueryFatal("select node_id,`partition`,osid,imageid,imagepid" .
" from `partitions` where node_id='$node_id'");
if (defined($dbres) && $dbres->numrows()) {
my @rows = ();
while (my $rowref = $dbres->fetchrow_hashref()) {
......@@ -2099,14 +2099,14 @@ sub RestoreNodeDiskInfo($$)
my $partref = $self->nodeinfo($nodeobject,'old_partitions');
if (defined($partref) && @$partref) {
DBQueryFatal("delete from partitions where node_id='$node_id'");
DBQueryFatal("delete from `partitions` where node_id='$node_id'");
foreach my $rowref (@$partref) {
my ($part,$osid,$imageid,$imagepid) =
( $rowref->{'partition'},$rowref->{'osid'},
$rowref->{'imageid'},$rowref->{'imagepid'} );
DBQueryFatal("insert into partitions " .
" (node_id,partition,osid,imageid,imagepid)" .
DBQueryFatal("insert into `partitions` " .
" (node_id,`partition`,osid,imageid,imagepid)" .
" values" .
" ('$node_id','$part','$osid','$imageid','$imagepid')");
}
......@@ -2161,7 +2161,7 @@ sub UpdatePartitions($$)
if (!$prepare) {
my $dbresult =
DBQueryWarn("select p.*,v.mbr_version ".
" from partitions as p,image_versions as v ".
" from `partitions` as p,image_versions as v ".
" where p.imageid=v.imageid and ".
" p.imageid_version=v.version and ".
" v.deleted is null ".
......@@ -2283,16 +2283,16 @@ sub UpdatePartitions($$)
my $imvers = $href->{'imageid_version'};
my $impid = $href->{'imagepid'};
$dbresult =
DBQueryWarn("replace into partitions ".
"(node_id,partition,osid,imageid,imagepid,".
DBQueryWarn("replace into `partitions` ".
"(node_id,`partition`,osid,imageid,imagepid,".
" osid_vers,imageid_version) ".
"values ".
"('$node_id','$i','$osid','$imid','$impid',".
" '$osvers','$imvers')");
} else {
$dbresult =
DBQueryWarn("delete from partitions ".
"where node_id='$node_id' and partition='$i'");
DBQueryWarn("delete from `partitions` ".
"where node_id='$node_id' and `partition`='$i'");
}
if (!$dbresult) {
tberror "$node_id: Could not update partitions table";
......
......@@ -245,8 +245,8 @@ sub PreSetupReload($$)
# otherwise set the force-load flag ourselves!
#
if (!$self->nodeflag($nodeobject,'force')) {
my $qres = DBQueryWarn("select * from partitions".
" where node_id='$node_id' and partition=$newpart");
my $qres = DBQueryWarn("select * from `partitions`".
" where node_id='$node_id' and `partition`=$newpart");
if (!$qres->numrows()) {
tbinfo "$self PreSetupReload($node_id): forcing reload; nothing in partitions table for this node\n";
$self->nodeflag($nodeobject,'force',1);
......
......@@ -5959,7 +5959,7 @@ COMMAND_PROTOTYPE(doloadinfo)
res = mydb_query("select iv.loadpart,ov.OS,mustwipe,iv.mbr_version,"
" iv.access_key,"
" i.imageid,prepare,i.imagename,p.pid,g.gid,iv.path,"
" ov.version,pa.partition,iv.size,"
" ov.version,pa.`partition`,iv.size,"
" iv.lba_low,iv.lba_high,iv.lba_size,iv.relocatable,"
" UNIX_TIMESTAMP(iv.updated),r.imageid_version "
"from current_reloads as r "
......@@ -5973,7 +5973,7 @@ COMMAND_PROTOTYPE(doloadinfo)
" ov.vers=iv.default_vers "
"left join projects as p on i.pid_idx=p.pid_idx "
"left join groups as g on i.gid_idx=g.gid_idx "
"left join partitions as pa on "
"left join `partitions` as pa on "
" pa.node_id=r.node_id and "
" pa.osid=iv.default_osid and loadpart=0 "
"where r.node_id='%s' order by r.idx",
......@@ -8675,7 +8675,7 @@ int get_imagestrings(tmcdreq_t *reqp, imstrings_t *imstrings)
/* We want data on the default OS set for this node. */
res = mydb_query("select p.pid,g.gid,iv.imagename,iv.version "
" from nodes as n "
"left join partitions as pa on "
"left join `partitions` as pa on "
" pa.node_id=n.node_id and "
" pa.osid=n.def_boot_osid "
"left join image_versions as iv on "
......
<?php
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -90,7 +90,7 @@ if ($isadmin) {
" o.vers as overs, " .
" p.osid as posid, p.osid_vers as pvers ".
" from os_info_versions as o ".
"left join partitions as p on o.osid=p.osid ".
"left join `partitions` as p on o.osid=p.osid ".
"where p.node_id='$node_id' or ".
"(o.path!='' and o.path is not NULL) ".
"order by p.node_id desc,o.pid,o.osname");
......@@ -104,7 +104,7 @@ else {
" p.osid as posid, p.osid_vers as pvers ".
"from os_info_versions as o ".
"left join group_membership as m on m.pid=o.pid ".
"left join partitions as p on o.osid=p.osid ".
"left join `partitions` as p on o.osid=p.osid ".
"where p.node_id='$node_id' or ".
" ((m.uid_idx='$uid_idx' or o.shared=1) and ".
" (o.path!='' and o.path is not NULL)) ".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment