From fa879a63a1f8634f6ebf9e242b8a5ebe2a815f1e Mon Sep 17 00:00:00 2001 From: Maciej Delmanowski Date: Mon, 23 Sep 2013 12:15:33 +0200 Subject: [PATCH 1/2] Add Linux Container identification --- system/setup | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/system/setup b/system/setup index 6b5a53e4f62..80cab6ee65f 100755 --- a/system/setup +++ b/system/setup @@ -1899,6 +1899,13 @@ class LinuxVirtual(Virtual): self.facts['virtualization_role'] = 'guest' return + if os.path.exists('/proc/1/cgroup'): + for line in open('/proc/1/cgroup').readlines(): + if re.search('/lxc/.*$', line): + self.facts['virtualization_type'] = 'lxc' + self.facts['virtualization_role'] = 'guest' + return + product_name = get_file_content('/sys/devices/virtual/dmi/id/product_name') if product_name in ['KVM', 'Bochs']: From 669b345937a389203cfc6c83a13eecac048b58c4 Mon Sep 17 00:00:00 2001 From: Maciej Delmanowski Date: Mon, 23 Sep 2013 12:27:14 +0200 Subject: [PATCH 2/2] Made re.search string shorter --- system/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/setup b/system/setup index 80cab6ee65f..f9f08ce79dd 100755 --- a/system/setup +++ b/system/setup @@ -1901,7 +1901,7 @@ class LinuxVirtual(Virtual): if os.path.exists('/proc/1/cgroup'): for line in open('/proc/1/cgroup').readlines(): - if re.search('/lxc/.*$', line): + if re.search('/lxc/', line): self.facts['virtualization_type'] = 'lxc' self.facts['virtualization_role'] = 'guest' return