From fe532525c82e16fd939896748dbf390900fcac81 Mon Sep 17 00:00:00 2001 From: Tim Goddard Date: Fri, 7 Nov 2014 11:23:08 +1300 Subject: [PATCH] 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 --- lib/vagrant-lxc/driver.rb | 16 +++++- spec/unit/driver_spec.rb | 105 +++++++++++++++++++++++++++++--------- 2 files changed, 97 insertions(+), 24 deletions(-) diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index dbba577..c71b0b3 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -45,7 +45,21 @@ module Vagrant end def rootfs_path - Pathname.new(config_string.match(/^lxc\.rootfs\s+=\s+(.+)$/)[1]) + config_entry = config_string.match(/^lxc\.rootfs\s+=\s+(.+)$/)[1] + case config_entry + when /^overlayfs:/ + # Split on colon (:), ignoring any colon escaped by an escape character ( \ ) + # Pays attention to when the escape character is itself escaped. + fs_type, master_path, overlay_path = config_entry.split(/(?