When setting lxc.network.veth.pair to get a fixed interface
name the recreation of it after a reboot caused an EEXIST.
-) The reboot flag is now a three-state value. It's set to
1 to request a reboot, and 2 during a reboot until after
lxc_spawn where it is reset to 0.
-) If the reboot is set (!= 0) within instantiate_veth and
a fixed name is used, the interface is now deleted before
being recreated.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
char veth2buf[IFNAMSIZ], *veth2;
int err;
char veth2buf[IFNAMSIZ], *veth2;
int err;
- if (netdev->priv.veth_attr.pair)
+ if (netdev->priv.veth_attr.pair) {
veth1 = netdev->priv.veth_attr.pair;
veth1 = netdev->priv.veth_attr.pair;
+ if (handler->conf->reboot)
+ lxc_netdev_delete_by_name(veth1);
+ } else {
err = snprintf(veth1buf, sizeof(veth1buf), "vethXXXXXX");
if (err >= sizeof(veth1buf)) { /* can't *really* happen, but... */
ERROR("veth1 name too long");
err = snprintf(veth1buf, sizeof(veth1buf), "vethXXXXXX");
if (err >= sizeof(veth1buf)) { /* can't *really* happen, but... */
ERROR("veth1 name too long");
if (lxc_check_inherited(conf, daemonize, -1)) {
ERROR("Inherited fds found");
ret = 1;
if (lxc_check_inherited(conf, daemonize, -1)) {
ERROR("Inherited fds found");
ret = 1;
ret = lxc_start(c->name, argv, conf, c->config_path, daemonize);
c->error_num = ret;
ret = lxc_start(c->name, argv, conf, c->config_path, daemonize);
c->error_num = ret;
+ if (conf->reboot == 1) {
INFO("container requested reboot");
INFO("container requested reboot");
goto out_detach_blockdev;
}
goto out_detach_blockdev;
}
+ handler->conf->reboot = 0;
+
netnsfd = get_netns_fd(handler->pid);
err = lxc_poll(name, handler);
netnsfd = get_netns_fd(handler->pid);
err = lxc_poll(name, handler);