Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
1b6a17ce
Commit
1b6a17ce
authored
Dec 11, 2017
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem with ordering of install vs database update scripts, wrt the
renaming of card/port in the interfaces table.
parent
f71d7d95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
7 deletions
+35
-7
db/updatewires.in
db/updatewires.in
+35
-7
No files found.
db/updatewires.in
View file @
1b6a17ce
...
...
@@ -97,6 +97,14 @@ my %ifaces = ();
# Hash for the wires.
my
%wires
=
();
#
# Minor ordering problem between DB updates and update scripts.
#
my
$NOSAVED
=
0
;
if
(
!
DBSlotExists
("
interfaces
",
"
card_saved
"))
{
$NOSAVED
=
1
;
}
#
# Grab interfaces and wires.
#
...
...
@@ -119,8 +127,15 @@ while (my ($node_id,$iface) = $query_result->fetchrow_array()) {
print
STDERR
"
No interface object for
$node_id
:
$iface
\n
";
next
;
}
my
$card
=
$interface
->
card_saved
();
my
$port
=
$interface
->
port_saved
();
my
(
$card
,
$port
);
if
(
$NOSAVED
)
{
$card
=
$interface
->
{'
card
'};
$port
=
$interface
->
{'
port
'};
}
else
{
$card
=
$interface
->
card_saved
();
$port
=
$interface
->
port_saved
();
}
$ifaces
{"
$node_id
:
$card
:
$port
"}
=
$interface
;
my
$node
=
Node
->
Lookup
(
$node_id
);
...
...
@@ -152,9 +167,16 @@ my %ifacenames = ();
foreach
my
$interface
(
values
(
%ifaces
))
{
my
$node_id
=
$interface
->
node_id
();
my
$card
=
$interface
->
card_saved
();
my
$port
=
$interface
->
port_saved
();
my
$iface
=
$interface
->
iface
();
my
(
$card
,
$port
);
if
(
$NOSAVED
)
{
$card
=
$interface
->
{'
card
'};
$port
=
$interface
->
{'
port
'};
}
else
{
$card
=
$interface
->
card_saved
();
$port
=
$interface
->
port_saved
();
}
if
(
!
defined
(
$interface
->
iface
())
||
$interface
->
iface
()
eq
"")
{
my
$update_state
=
0
;
...
...
@@ -216,9 +238,15 @@ foreach my $interface (values(%ifaces)) {
else
{
print
STDERR
"
Creating missing interface_state for
"
.
"
$node_id
:
$iface
\n
";
DBQueryFatal
("
insert into interface_state set
"
.
"
node_id='
$node_id
',card_saved='
$card
',
"
.
"
port_saved='
$port
',iface='
$iface
'
");
my
$q
=
"
insert into interface_state set
"
.
"
node_id='
$node_id
', iface='
$iface
'
";
if
(
$NOSAVED
)
{
$q
.=
"
, card='
$card
', port='
$port
'
";
}
else
{
$q
.=
"
, card_saved='
$card
', port_saved='
$port
'
";
}
DBQueryFatal
(
$q
);
}
}
my
$ifacename
=
$interface
->
node_id
()
.
"
:
"
.
$interface
->
iface
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment