~serge-hallyn/ubuntu/quantal/lxc/lxc-fixapi

« back to all changes in this revision

Viewing changes to src/lxc/conf.c

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2011-07-07 13:53:52 UTC
  • mfrom: (1.2.7 upstream)
  • mto: (3.1.15 sid)
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: james.westby@ubuntu.com-20110707135352-2e27007vciicu4gf
Tags: upstream-0.7.4.2
ImportĀ upstreamĀ versionĀ 0.7.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
979
979
                goto out;
980
980
        }
981
981
 
982
 
        snprintf(path, MAXPATHLEN, "%s%s", rootfs->mount,
 
982
        snprintf(path, MAXPATHLEN, "%s/%s", rootfs->mount,
983
983
                 aux + strlen(rootfs->path));
984
984
 
985
985
        ret = mount_entry(mntent->mnt_fsname, path, mntent->mnt_type,
1218
1218
        /* empty network namespace */
1219
1219
        if (!netdev->ifindex) {
1220
1220
                if (netdev->flags & IFF_UP) {
1221
 
                        err = lxc_device_up("lo");
 
1221
                        err = lxc_netdev_up("lo");
1222
1222
                        if (err) {
1223
1223
                                ERROR("failed to set the loopback up : %s",
1224
1224
                                      strerror(-err));
1241
1241
                        netdev->link : "eth%d";
1242
1242
 
1243
1243
        /* rename the interface name */
1244
 
        err = lxc_device_rename(ifname, netdev->name);
 
1244
        err = lxc_netdev_rename_by_name(ifname, netdev->name);
1245
1245
        if (err) {
1246
1246
                ERROR("failed to rename %s->%s : %s", ifname, netdev->name,
1247
1247
                      strerror(-err));
1284
1284
        if (netdev->flags & IFF_UP) {
1285
1285
                int err;
1286
1286
 
1287
 
                err = lxc_device_up(current_ifname);
 
1287
                err = lxc_netdev_up(current_ifname);
1288
1288
                if (err) {
1289
1289
                        ERROR("failed to set '%s' up : %s", current_ifname,
1290
1290
                              strerror(-err));
1292
1292
                }
1293
1293
 
1294
1294
                /* the network is up, make the loopback up too */
1295
 
                err = lxc_device_up("lo");
 
1295
                err = lxc_netdev_up("lo");
1296
1296
                if (err) {
1297
1297
                        ERROR("failed to set the loopback up : %s",
1298
1298
                              strerror(-err));
1381
1381
        }
1382
1382
 
1383
1383
        if (netdev->mtu) {
1384
 
                err = lxc_device_set_mtu(veth1, atoi(netdev->mtu));
 
1384
                err = lxc_netdev_set_mtu(veth1, atoi(netdev->mtu));
1385
1385
                if (!err)
1386
 
                        err = lxc_device_set_mtu(veth2, atoi(netdev->mtu));
 
1386
                        err = lxc_netdev_set_mtu(veth2, atoi(netdev->mtu));
1387
1387
                if (err) {
1388
1388
                        ERROR("failed to set mtu '%s' for %s-%s : %s",
1389
1389
                              netdev->mtu, veth1, veth2, strerror(-err));
1406
1406
                goto out_delete;
1407
1407
        }
1408
1408
 
1409
 
        err = lxc_device_up(veth1);
 
1409
        err = lxc_netdev_up(veth1);
1410
1410
        if (err) {
1411
1411
                ERROR("failed to set %s up : %s", veth1, strerror(-err));
1412
1412
                goto out_delete;
1425
1425
        return 0;
1426
1426
 
1427
1427
out_delete:
1428
 
        lxc_device_delete(veth1);
 
1428
        lxc_netdev_delete_by_name(veth1);
1429
1429
        return -1;
1430
1430
}
1431
1431
 
1458
1458
        netdev->ifindex = if_nametoindex(peer);
1459
1459
        if (!netdev->ifindex) {
1460
1460
                ERROR("failed to retrieve the index for %s", peer);
1461
 
                lxc_device_delete(peer);
 
1461
                lxc_netdev_delete_by_name(peer);
1462
1462
                return -1;
1463
1463
        }
1464
1464
 
1498
1498
        netdev->ifindex = if_nametoindex(peer);
1499
1499
        if (!netdev->ifindex) {
1500
1500
                ERROR("failed to retrieve the ifindex for %s", peer);
1501
 
                lxc_device_delete(peer);
 
1501
                lxc_netdev_delete_by_name(peer);
1502
1502
                return -1;
1503
1503
        }
1504
1504
 
1578
1578
 
1579
1579
        lxc_list_for_each(iterator, network) {
1580
1580
                netdev = iterator->elem;
1581
 
                if (netdev->ifindex > 0 && netdev->type != LXC_NET_PHYS)
1582
 
                        lxc_device_delete_index(netdev->ifindex);
 
1581
                if (netdev->ifindex == 0)
 
1582
                        continue;
 
1583
 
 
1584
                /* Recent kernels already delete the virtual devices */
 
1585
                if (netdev->type != LXC_NET_PHYS)
 
1586
                        continue;
 
1587
 
 
1588
                if (lxc_netdev_rename_by_index(netdev->ifindex, netdev->link))
 
1589
                        WARN("failed to rename to the initial name the netdev '%s'",
 
1590
                             netdev->link);
1583
1591
        }
1584
1592
}
1585
1593
 
1597
1605
                if (!netdev->ifindex)
1598
1606
                        continue;
1599
1607
 
1600
 
                err = lxc_device_move(netdev->ifindex, pid);
 
1608
                err = lxc_netdev_move_by_index(netdev->ifindex, pid);
1601
1609
                if (err) {
1602
1610
                        ERROR("failed to move '%s' to the container : %s",
1603
1611
                              netdev->link, strerror(-err));