Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-stable
Commits
9e31bc5b
Commit
9e31bc5b
authored
Apr 06, 2001
by
Leigh B. Stoller
Browse files
Add DELTA command to return list of deltas to install.
parent
c8dd525a
Changes
1
Hide whitespace changes
Inline
Side-by-side
tmcd/tmcd.c
View file @
9e31bc5b
...
...
@@ -41,6 +41,7 @@ static int doaccounts(int sock, struct in_addr ipaddr, char *rdata, int tcp);
static
int
dodelay
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
static
int
dohosts
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
static
int
dorpms
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
static
int
dodeltas
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
static
int
dostartcmd
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
static
int
dostartstat
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
static
int
doready
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
...
...
@@ -58,6 +59,7 @@ struct command {
{
"delay"
,
dodelay
},
{
"hostnames"
,
dohosts
},
{
"rpms"
,
dorpms
},
{
"deltas"
,
dodeltas
},
{
"startupcmd"
,
dostartcmd
},
{
"startstatus"
,
dostartstat
},
/* Leave this before "startstat" */
{
"startstat"
,
dostartstat
},
...
...
@@ -925,6 +927,72 @@ dorpms(int sock, struct in_addr ipaddr, char *rdata, int tcp)
return
0
;
}
/*
* Return Delats stuff.
*/
static
int
dodeltas
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
)
{
MYSQL_RES
*
res
;
MYSQL_ROW
row
;
char
nodeid
[
32
];
char
pid
[
64
];
char
eid
[
64
];
char
buf
[
MYBUFSIZE
],
*
bp
,
*
sp
;
if
(
iptonodeid
(
ipaddr
,
nodeid
))
{
syslog
(
LOG_ERR
,
"DELTAS: %s: No such node"
,
inet_ntoa
(
ipaddr
));
return
1
;
}
/*
* Now check reserved table
*/
if
(
nodeidtoexp
(
nodeid
,
pid
,
eid
))
return
0
;
/*
* Get Delta list for the node.
*/
res
=
mydb_query
(
"select deltas from nodes where node_id='%s' "
,
1
,
nodeid
);
if
(
!
res
)
{
syslog
(
LOG_ERR
,
"DELTAS: %s: DB Error getting Deltas!"
,
nodeid
);
return
1
;
}
if
((
int
)
mysql_num_rows
(
res
)
==
0
)
{
mysql_free_result
(
res
);
return
0
;
}
/*
* Text string is a colon separated list.
*/
row
=
mysql_fetch_row
(
res
);
if
(
!
row
[
0
]
||
!
row
[
0
][
0
])
{
mysql_free_result
(
res
);
return
0
;
}
bp
=
row
[
0
];
sp
=
bp
;
do
{
bp
=
strsep
(
&
sp
,
":"
);
sprintf
(
buf
,
"DELTA=%s
\n
"
,
bp
);
client_writeback
(
sock
,
buf
,
strlen
(
buf
),
tcp
);
syslog
(
LOG_INFO
,
"DELTAS: %s"
,
buf
);
}
while
(
bp
=
sp
);
mysql_free_result
(
res
);
return
0
;
}
/*
* Return node run command. We return the command to run, plus the UID
* of the experiment creator to run it as!
...
...
Write
Preview
Supports
Markdown
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