Merge lp:~andreserl/maas/lp1673724_improved into lp:~maas-committers/maas/trunk

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: no longer in the source branch.
Merged at revision: 5841
Proposed branch: lp:~andreserl/maas/lp1673724_improved
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 43 lines (+4/-4)
2 files modified
src/provisioningserver/refresh/node_info_scripts.py (+1/-1)
src/provisioningserver/refresh/tests/test_node_info_scripts.py (+3/-3)
To merge this branch: bzr merge lp:~andreserl/maas/lp1673724_improved
Reviewer Review Type Date Requested Status
Mike Pontillo (community) Approve
Review via email: mp+320688@code.launchpad.net

Commit message

Filter lsblk by maj,min, which is the major,minor device number. This should ensure the first disk is always listed first (i.e. 'sda')

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/refresh/node_info_scripts.py'
2--- src/provisioningserver/refresh/node_info_scripts.py 2017-03-17 10:54:40 +0000
3+++ src/provisioningserver/refresh/node_info_scripts.py 2017-03-22 17:25:57 +0000
4@@ -313,7 +313,7 @@
5 blockdevs = []
6 block_list = check_output((
7 "lsblk", "--exclude", "1,2,7", "-d", "-P",
8- "-o", "NAME,RO,RM,MODEL,ROTA", "-x", "NAME"))
9+ "-o", "NAME,RO,RM,MODEL,ROTA,MAJ:MIN", "-x", "MAJ:MIN"))
10 block_list = block_list.decode("utf-8")
11 for blockdev in block_list.splitlines():
12 tokens = shlex.split(blockdev)
13
14=== modified file 'src/provisioningserver/refresh/tests/test_node_info_scripts.py'
15--- src/provisioningserver/refresh/tests/test_node_info_scripts.py 2017-03-22 14:19:07 +0000
16+++ src/provisioningserver/refresh/tests/test_node_info_scripts.py 2017-03-22 17:25:57 +0000
17@@ -399,7 +399,7 @@
18 self.call_gather_physical_block_devices()
19 self.assertThat(check_output, MockCalledOnceWith((
20 "lsblk", "--exclude", "1,2,7", "-d", "-P",
21- "-o", "NAME,RO,RM,MODEL,ROTA", "-x", "NAME")))
22+ "-o", "NAME,RO,RM,MODEL,ROTA,MAJ:MIN", "-x", "MAJ:MIN")))
23
24 def test__returns_empty_list_when_no_disks(self):
25 check_output = self.patch(subprocess, "check_output")
26@@ -419,7 +419,7 @@
27 self.assertThat(check_output, MockCallsMatch(
28 call((
29 "lsblk", "--exclude", "1,2,7", "-d", "-P",
30- "-o", "NAME,RO,RM,MODEL,ROTA", "-x", "NAME")),
31+ "-o", "NAME,RO,RM,MODEL,ROTA,MAJ:MIN", "-x", "MAJ:MIN")),
32 call(("udevadm", "info", "-q", "all", "-n", name))))
33
34 def test__returns_empty_list_when_cdrom_only(self):
35@@ -451,7 +451,7 @@
36 self.assertThat(check_output, MockCallsMatch(
37 call((
38 "lsblk", "--exclude", "1,2,7", "-d", "-P",
39- "-o", "NAME,RO,RM,MODEL,ROTA", "-x", "NAME")),
40+ "-o", "NAME,RO,RM,MODEL,ROTA,MAJ:MIN", "-x", "MAJ:MIN")),
41 call(("udevadm", "info", "-q", "all", "-n", name)),
42 call(("sudo", "-n", "blockdev", "--getsize64", "/dev/%s" % name)),
43 call(("sudo", "-n", "blockdev", "--getbsz", "/dev/%s" % name))))