Commit graph

80 commits

Author SHA1 Message Date
Virgil Dupras
2a5510b34c Fix "vargant package" for LXC 2.1+ config format
New config format would be under `lxc.rootfs.path` and be prefixed by
`dir:`.
2018-07-24 12:23:25 -04:00
Virgil Dupras
a1aa60ded5 Remove supports_attach? and call to /sbin/halt
Hosts without support for lxc-attach are ancien and can always use old
versions of vagrant-lxc. To be able to move forward more easily, we
should be able to assume a functional `lxc-attach`.

As for `/sbin/halt`, I'm really not sure it's needed anymore. Let's see
if its removal causes problems.
2018-07-24 11:21:09 -04:00
Virgil Dupras
8cfe577b17 Fix LXC 3.0 compatibility with old boxes
Creating a new vagrant machine with a box created with an old LXC config
format would fail with LXC 3.0. We now update the LXC config of the box
itself before calling `lxc-create`.
2018-04-30 20:45:25 -04:00
Virgil Dupras
dd24cdc3d6 Fix incompatibility with LXC 3.0
LXC 3.0, unlike 2.1, doesn't support old configuration formats at all
and because our previous approach to handling old format was incomplete,
running `vagrant up` on a system with LXC 3.0 would fail, even if the
base box itself was made with modernized config.

This commit fixes this problem: is the box has a modern config, it's
going to be properly created and booted under LXC 3.0. It does so
without breaking the support for LXC < 2.1
2018-04-29 22:57:31 -04:00
Virgil Dupras
530a899467 Add support for unprivileged containers
fixes #312

I've also remove the "EXPERIMENTAL" flag to bridge support in the README.
It's been there long enough.
2018-02-17 21:53:16 -05:00
Virgil Dupras
c74ddbf2fc create: with LXC 2.1+ run lxc-update-config on new boxes
When running with LXC 2.1+, ensure that our boxes have up-to-date config
keys by running the `lxc-update-config` utility that ships with LXC
2.1+.

When the command doesn't exist (LXC <2.1), we do nothing.

ref #445
2018-01-13 21:03:34 -05:00
Virgil Dupras
2b08ae199f driver: little cleanup after LXC 1.0+ requirement bump
The conditional `lxc-version` and `lxc-config` mechanisms aren't needed
anymore. They were for pre-1.0 LXC versions.
2018-01-13 20:34:41 -05:00
Virgil Dupras
aa777653f4 Use lxc-info instead of lxc-attach to retrieve container IP
`lxc-info -iH` to retrieve IP address was not available in early LXC
development but was there at LXC 1.0. Because we've bumped our minimum
LXC requirement to v1.0 recently, we can simplify the IP retrieval
process and also get rid of the `dnsmasq` fallback.
2018-01-13 15:53:28 -05:00
Virgil Dupras
97b5882262 Refactoring: make SudoWrapper a bit more self-contained
By looking at the code, it seems that it was a goal to make the sudo
wrapper path configurable through the Vagrantfile, but it wasn't
effective and didn't make much sense (that kind of config is a per-host
config, not a per-guest one).

This caused the cause to be needlessly complex by giving the Provider
the responsibility of instanciating the wrapper. This commit gets rid of
that.

I didn't get rid of `sudo_wrapper` injection in `Driver` and
`Driver::CLI` constructors because they're needed for tests. I'm not
ready to tackle this yet.
2018-01-13 08:32:27 -05:00
Michael Stucki
7c778dfb4d Fix warning message 2015-08-28 15:00:37 +02:00
Michael Stucki
9e5637a9fe Do not remove system bridge virbr0 2015-08-28 15:00:37 +02:00
Andriy
6136ebb966 Update driver.rb
Fixing https://github.com/fgrehm/vagrant-lxc/issues/353 issue
2015-08-28 15:00:37 +02:00
Robin Gloster
611a86ce84 do not copy the lxc template instead use the full path 2015-08-28 14:58:16 +02:00
Michael Stucki
7eb3be37de driver.rb: Check for correct bridge device name 2015-08-25 10:20:21 +02:00
Michael Stucki
31bb4eadf9 Move away from using ifconfig to ip link for enabling / disabling bridge devices 2015-08-25 10:18:14 +02:00
Michael Stucki
c3508870fd Private networking: Create bridge if it is missing 2015-07-06 18:01:18 +02:00
Michael Stucki
fb661300e7 Move bridge_exists check into a function 2015-07-06 18:01:15 +02:00
Fabio Rehm
55bbadef6f Merge pull request #352 from ccope/private_dhcp
Support private networking using DHCP
2015-04-06 10:56:38 -03:00
Cam Cope
caa3c53a8f move mountpoint creation to lxc template for lvm rootfs support 2015-04-05 17:46:22 -07:00
Cam Cope
5da3fc8be5 support containers with dhcp private networking 2015-03-08 19:58:29 -07:00
Fabio Rehm
555499d04a Merge branch 'master' of https://github.com/pruby/vagrant-lxc into next
Closes GH-329
2015-01-11 21:06:46 -02:00
Fabio Rehm
447d0dfc42 Experimental support for private networking [GH-298] 2015-01-11 20:59:38 -02:00
Tim Goddard
fe532525c8 Support for formatted overlayfs path spec when finding the root FS path
We're using snapshots in a CI set-up so that a Vagrant cluster can be built
once, then each push to the repository only checked as an incremental
update to the cluster. We copy each LXC VM to a master image, then re-create
the original names as snapshots.

This change corrects a method which assumes the LXC root path in the config
file is a simple directory name, which is only true for directory-backed
instances.

Conflicts:
	spec/unit/driver_spec.rb
2014-11-12 15:21:28 +13:00
Stefan Langenmaier
188a1eb089 uninitialized constant Tempfile 2014-11-05 08:50:46 -05:00
Azamat Khudaygulov
f454924a59 The path of storage containers taken from lxc-config, instead of using a constant for lxc>=1.0.0.
* for lxc to 1.0.0 using constant Vagrant::LXC::Driver::DEFAULT_CONTAINERS_PATH
 * change method Vagrant::LXC::Driver::CLI#version to call lxc-create if lxc-version command not exists (to lxc version 1.0.0)
2014-09-23 16:07:03 +04:00
Fabio Rehm
aac8c31410 driver: Remove calls to in favor of Vagrant's built in graceful halt 2014-07-24 21:58:04 -03:00
Fabio Rehm
3e22f424e6 driver: Escape synced folders with spaces
Fix GH-291
2014-06-08 23:27:27 -03:00
Kristof Willaert
a4768c26ca Add fallback mechanism for platforms without attach support
Some platforms (most notably CentOS and RHEL) use a kernel without
'attach' support. This patch detects this absence and falls back
to the alternative ways of doing things like detection of IP address
and halting the container.
It does so by running the command "true" through lxc-attach.
2014-06-03 17:53:26 +02:00
Fabio Rehm
9111261f79 driver: Do not show a stacktrace to the user if no network.hwaddr is present on container configs
This is enough to close GH-266 since Vagrant will take care of showing
an error informing the user that it was unable to connect to the
machine.
2014-05-12 23:21:41 -03:00
Fabio Rehm
c580865ab2 driver: Fix lxc config customizations prunning [GH-279] 2014-05-12 23:06:45 -03:00
Fabio Rehm
5eef1524d7 driver: Use relative guest paths for synced folders
Closes GH-258
2014-05-04 20:52:00 -03:00
Fabio Rehm
4c3143aa34 Merge branch 'backingstore_options' of https://github.com/tailhook/vagrant-lxc
Conflicts:
	lib/vagrant-lxc/config.rb
2014-05-03 23:42:39 -03:00
Cam Cope
a9248cb697 add backingstore parameters 2014-04-28 17:17:59 +03:00
Jef Mathiot
0eae5c0926 Removed unsecure calls to SudoWrapper#su_c. 2014-04-17 12:56:56 +02:00
Fabio Rehm
da96e8c1a4 synced_folder: Fix mount_options on Vagrant 1.4+ 2014-03-14 00:21:21 -03:00
Fabio Rehm
20d4547044 synced_folder: Support for mount_options 2014-03-13 23:36:15 -03:00
Fabio Rehm
35feb11367 core: Fix synced folder creation (AKA first bug caught with vagrant-spec)
Thanks @mitchellh!
2014-03-13 00:57:36 -03:00
Fabio Rehm
d5abb523de core: Implement support for built in synced folders and add required logic for NFS 2014-03-13 00:57:36 -03:00
Fabio Rehm
1072a42ed2 revert 2014-03-13 00:57:36 -03:00
Cam Cope
b5c7a50a74 match hwaddr lines with varying spaces 2014-02-19 18:25:45 -05:00
Fabio Rehm
6779556650 Add a TODO so that we can easily grep this 2013-11-11 20:44:02 -02:00
Fabio Rehm
324cddcb9d Bring back @gwillem comment from 2790261e58 regarding rootfs paths so we know what this "./." is about :) 2013-11-11 20:42:34 -02:00
Fabio Rehm
c8f379c764 Fix various issues related to recent default permissions changes to /var/lib/lxc [GH-180] 2013-11-06 19:38:48 -02:00
Willem de Groot
2790261e58 included rootfs_path variable in tar command 2013-11-05 19:55:41 +01:00
Willem de Groot
f52835cb58 Fix relative path issue used for vagrant package 2013-10-30 12:01:51 +01:00
Fabio Rehm
2b062487bc Hack in a fix for hosts that do not have lxc-shutdown around [GH-150] 2013-10-24 11:47:15 -02:00
Fabio Rehm
18bb9482d5 Nicely handles missing templates path (fixes GH-139) 2013-09-28 02:58:38 -03:00
Fabio Rehm
a6c95bff50 Format code 2013-09-28 01:46:27 -03:00
Fabio Rehm
6680858184 Improve logging and add some TODOs that have been around for a while 2013-09-21 01:32:15 -03:00
Fabio Rehm
d02a9d575f Ensures lxc templates are executable prior to running lxc-create
Closes #128
2013-09-21 01:28:03 -03:00