Merge lp:~ack/landscape-client/fix-xen-dom0-container-info into lp:~landscape/landscape-client/trunk

Proposed by Alberto Donato
Status: Merged
Approved by: Alberto Donato
Approved revision: 923
Merged at revision: 922
Proposed branch: lp:~ack/landscape-client/fix-xen-dom0-container-info
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 65 lines (+1/-30)
2 files modified
landscape/lib/tests/test_vm_info.py (+0/-18)
landscape/lib/vm_info.py (+1/-12)
To merge this branch: bzr merge lp:~ack/landscape-client/fix-xen-dom0-container-info
Reviewer Review Type Date Requested Status
Данило Шеган (community) Approve
🤖 Landscape Builder test results Approve
Geoff Teale (community) Approve
Review via email: mp+306643@code.launchpad.net

Commit message

Fix VM detection for Xen, by returning "xen" only for paravirtualized and HVM hosts, not for dom0.

Description of the change

Fix VM detection for Xen, by returning "xen" only for paravirtualized and HVM hosts, not for dom0.

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: TRIAL_ARGS=-j4 make check
Result: Fail
Revno: 922
Branch: lp:~ack/landscape-client/fix-xen-dom0-container-info
Jenkins: https://ci.lscape.net/job/latch-test-precise/115/

review: Needs Fixing (test results)
923. By Alberto Donato

Fix comment.

Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: TRIAL_ARGS=-j4 make check
Result: Success
Revno: 923
Branch: lp:~ack/landscape-client/fix-xen-dom0-container-info
Jenkins: https://ci.lscape.net/job/latch-test-precise/116/

review: Approve (test results)
Revision history for this message
Geoff Teale (tealeg) wrote :

+1

review: Approve
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: TRIAL_ARGS=-j4 make check
Result: Success
Revno: 923
Branch: lp:~ack/landscape-client/fix-xen-dom0-container-info
Jenkins: https://ci.lscape.net/job/latch-test-precise/119/

review: Approve (test results)
Revision history for this message
Данило Шеган (danilo) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/lib/tests/test_vm_info.py'
2--- landscape/lib/tests/test_vm_info.py 2015-05-07 07:31:09 +0000
3+++ landscape/lib/tests/test_vm_info.py 2016-09-23 15:44:33 +0000
4@@ -36,15 +36,6 @@
5
6 self.assertEqual("openvz", get_vm_info(root_path=self.root_path))
7
8- def test_get_vm_info_is_xen_when_proc_sys_xen_exists(self):
9- """
10- L{get_vm_info} should return 'xen' when /proc/sys/xen exists.
11- """
12- proc_sys_xen_path = os.path.join(self.proc_sys_path, "xen")
13- self.makeFile(path=proc_sys_xen_path, content="foo")
14-
15- self.assertEqual("xen", get_vm_info(root_path=self.root_path))
16-
17 def test_get_vm_info_is_xen_when_sys_bus_xen_is_non_empty(self):
18 """
19 L{get_vm_info} should return 'xen' when /sys/bus/xen exists and has
20@@ -57,15 +48,6 @@
21
22 self.assertEqual("xen", get_vm_info(root_path=self.root_path))
23
24- def test_get_vm_info_is_xen_when_proc_xen_exists(self):
25- """
26- L{get_vm_info} should return 'xen' when /proc/xen exists.
27- """
28- proc_xen_path = os.path.join(self.proc_path, "xen")
29- self.makeFile(path=proc_xen_path, content="foo")
30-
31- self.assertEqual("xen", get_vm_info(root_path=self.root_path))
32-
33 def test_get_vm_info_is_empty_without_xen_devices(self):
34 """
35 L{get_vm_info} returns an empty string if the /sys/bus/xen/devices
36
37=== modified file 'landscape/lib/vm_info.py'
38--- landscape/lib/vm_info.py 2015-05-07 07:31:09 +0000
39+++ landscape/lib/vm_info.py 2016-09-23 15:44:33 +0000
40@@ -14,9 +14,6 @@
41 It loops through some possible configurations and return a string with
42 the name of the technology being used or None if there's no match
43 """
44- def join_root_path(path):
45- return os.path.join(root_path, path)
46-
47 if _is_vm_openvz(root_path):
48 return "openvz"
49 if _is_vm_xen(root_path):
50@@ -43,16 +40,8 @@
51
52 def _is_vm_xen(root_path):
53 """Check if the host is virtualized with Xen."""
54- xen_paths = [
55- os.path.join(root_path, path)
56- for path in ("proc/sys/xen", "proc/xen")]
57-
58- if filter(os.path.exists, xen_paths):
59- return True
60-
61- # /sys/bus/xen exists on most machines, but only virtual machines have
62- # devices
63 sys_xen_path = os.path.join(root_path, "sys/bus/xen/devices")
64+ # Paravirtualized and HVM instances have device links under the directory
65 return os.path.isdir(sys_xen_path) and os.listdir(sys_xen_path)
66
67

Subscribers

People subscribed via source and target branches

to all changes: