Skip to content

Commit ec8449f

Browse files
Tycho Andersenstgraber
authored andcommitted
c/r: get rid of dump_net_info()
This was originally used to propagate the bridge and veth names across hosts, but now we extract both from the container's config file, and nothing reads the files that dump_net_info() writes, so let's just get rid of them. Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
1 parent 65b2022 commit ec8449f

3 files changed

Lines changed: 0 additions & 56 deletions

File tree

src/lxc/criu.c

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -348,57 +348,6 @@ bool criu_ok(struct lxc_container *c)
348348
return true;
349349
}
350350

351-
bool dump_net_info(struct lxc_container *c, char *directory)
352-
{
353-
int netnr;
354-
struct lxc_list *it;
355-
356-
netnr = 0;
357-
lxc_list_for_each(it, &c->lxc_conf->network) {
358-
char *veth = NULL, *bridge = NULL, veth_path[PATH_MAX], eth[128];
359-
struct lxc_netdev *n = it->elem;
360-
bool has_error = true;
361-
int pret;
362-
363-
pret = snprintf(veth_path, PATH_MAX, "lxc.network.%d.veth.pair", netnr);
364-
if (pret < 0 || pret >= PATH_MAX)
365-
goto out;
366-
367-
veth = c->get_running_config_item(c, veth_path);
368-
if (!veth) {
369-
/* criu_ok() checks that all interfaces are
370-
* LXC_NET{VETH,NONE}, and VETHs should have this
371-
* config */
372-
assert(n->type == LXC_NET_NONE);
373-
break;
374-
}
375-
376-
bridge = c->get_running_config_item(c, veth_path);
377-
if (!bridge)
378-
goto out;
379-
380-
pret = snprintf(veth_path, PATH_MAX, "%s/veth%d", directory, netnr);
381-
if (pret < 0 || pret >= PATH_MAX || print_to_file(veth_path, veth) < 0)
382-
goto out;
383-
384-
if (n->name) {
385-
if (strlen(n->name) >= 128)
386-
goto out;
387-
strncpy(eth, n->name, 128);
388-
} else
389-
sprintf(eth, "eth%d", netnr);
390-
391-
has_error = false;
392-
out:
393-
free(veth);
394-
free(bridge);
395-
if (has_error)
396-
return false;
397-
}
398-
399-
return true;
400-
}
401-
402351
static bool restore_net_info(struct lxc_container *c)
403352
{
404353
struct lxc_list *it;

src/lxc/criu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ void exec_criu(struct criu_opts *opts);
6161
* dump. */
6262
bool criu_ok(struct lxc_container *c);
6363

64-
bool dump_net_info(struct lxc_container *c, char *directory);
65-
6664
// do_restore never returns, the calling process is used as the
6765
// monitor process. do_restore calls exit() if it fails.
6866
void do_restore(struct lxc_container *c, int pipe, char *directory, bool verbose);

src/lxc/lxccontainer.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3733,9 +3733,6 @@ static bool do_lxcapi_checkpoint(struct lxc_container *c, char *directory, bool
37333733
return false;
37343734
}
37353735

3736-
if (!dump_net_info(c, directory))
3737-
return false;
3738-
37393736
pid = fork();
37403737
if (pid < 0)
37413738
return false;

0 commit comments

Comments
 (0)