Merge lp:~raharper/curtin/trunk.zesty-btrfs into lp:~curtin-dev/curtin/trunk

Proposed by Ryan Harper
Status: Merged
Merged at revision: 468
Proposed branch: lp:~raharper/curtin/trunk.zesty-btrfs
Merge into: lp:~curtin-dev/curtin/trunk
Diff against target: 125 lines (+14/-23)
2 files modified
tests/vmtests/test_basic.py (+14/-22)
tests/vmtests/test_nvme.py (+0/-1)
To merge this branch: bzr merge lp:~raharper/curtin/trunk.zesty-btrfs
Reviewer Review Type Date Requested Status
Scott Moser (community) Approve
Joshua Powers (community) Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+317931@code.launchpad.net

Description of the change

vmtest: handle change in btrfs-progs when finding fs UUID.

Refactor how we extract the btrfs filesystem UUID with btrfs-progs tools.

To post a comment you must log in.
470. By Ryan Harper

Drop btrfs collect from nvme test

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Joshua Powers (powersj) :
review: Approve
Revision history for this message
Scott Moser (smoser) wrote :

I'm fine with this, but it might make more sense to make the "collector" smarter than having 2 different collectors (btrfs-debug-tree and btrfs-show ). What I'm suggesting is basically trying to produce a single 'btrfs-uuids' file with something like:

for dev in $(find_btrfs_devs); do
   if command -v btrfs-show >/dev/null 2>&1; then
      btrfs-show $dev | awk '/uuid/ {print dev, $4}' dev=$dev
   elif command -v btrfs-debug-tree >/dev/null 2>&1; then
      btrfs-debug-tree -r $dev | awk '/^uuid/ {print dev, $2}' dev=$dev | grep "-"
   fi

done > btrfs-uuids

I realize that is more work on your part, and that this is breaking vmtest, but I think generally we want to get to generic "collect a lot of stuff in the guest and then look at the results".

I'll approve, though. but at some point we are going to have to re-factor our inspection code.

review: Approve
Revision history for this message
Ryan Harper (raharper) wrote :

On Wed, Feb 22, 2017 at 8:30 AM, Scott Moser <email address hidden> wrote:

> Review: Approve
>
> I'm fine with this, but it might make more sense to make the "collector"
> smarter than having 2 different collectors (btrfs-debug-tree and
> btrfs-show ). What I'm suggesting is basically trying to produce a single
> 'btrfs-uuids' file with something like:
>
> for dev in $(find_btrfs_devs); do
> if command -v btrfs-show >/dev/null 2>&1; then
> btrfs-show $dev | awk '/uuid/ {print dev, $4}' dev=$dev
> elif command -v btrfs-debug-tree >/dev/null 2>&1; then
> btrfs-debug-tree -r $dev | awk '/^uuid/ {print dev, $2}' dev=$dev |
> grep "-"
> fi
>
> done > btrfs-uuids
>
> I realize that is more work on your part, and that this is breaking
> vmtest, but I think generally we want to get to generic "collect a lot of
> stuff in the guest and then look at the results".
>

So, it's precise *only* which will fall out in April this year which
doesn't have the now even more common btrfs-debug-tree.

>
> I'll approve, though. but at some point we are going to have to re-factor
> our inspection code.
>

Yes, the trunk.power8 branch does much of this so we're not repeating these
scripts in N test-files; and in that case
I agree it makes more sense to be release-tolerant in the collector.

>
> --
> https://code.launchpad.net/~raharper/curtin/trunk.zesty-
> btrfs/+merge/317931
> You are the owner of lp:~raharper/curtin/trunk.zesty-btrfs.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/vmtests/test_basic.py'
2--- tests/vmtests/test_basic.py 2017-02-08 17:50:26 +0000
3+++ tests/vmtests/test_basic.py 2017-02-22 01:42:33 +0000
4@@ -3,7 +3,6 @@
5 get_apt_proxy)
6 from .releases import base_vm_classes as relbase
7
8-import re
9 import textwrap
10
11
12@@ -19,7 +18,8 @@
13 blkid -o export /dev/vda > blkid_output_vda
14 blkid -o export /dev/vda1 > blkid_output_vda1
15 blkid -o export /dev/vda2 > blkid_output_vda2
16- btrfs-show-super /dev/vdd > btrfs_show_super_vdd
17+ f="btrfs_uuid_vdd"
18+ btrfs-debug-tree -r /dev/vdd | awk '/^uuid/ {print $2}' | grep "-" > $f
19 cat /proc/partitions > proc_partitions
20 ls -al /dev/disk/by-uuid/ > ls_uuid
21 cat /etc/fstab > fstab
22@@ -36,7 +36,7 @@
23 def test_output_files_exist(self):
24 self.output_files_exist(
25 ["blkid_output_vda", "blkid_output_vda1", "blkid_output_vda2",
26- "btrfs_show_super_vdd", "fstab", "ls_dname", "ls_uuid",
27+ "btrfs_uuid_vdd", "fstab", "ls_dname", "ls_uuid",
28 "proc_partitions"])
29
30 def test_ptable(self):
31@@ -89,15 +89,12 @@
32
33 def test_whole_disk_format(self):
34 # confirm the whole disk format is the expected device
35- btrfs_show_super = self.load_collect_file('btrfs_show_super_vdd')
36+ btrfs_uuid = self.load_collect_file('btrfs_uuid_vdd').strip()
37 ls_uuid = self.load_collect_file("ls_uuid")
38
39 # extract uuid from btrfs superblock
40- btrfs_fsid = [line for line in btrfs_show_super.split('\n')
41- if line.startswith('fsid\t\t')]
42- self.assertEqual(len(btrfs_fsid), 1)
43- btrfs_uuid = btrfs_fsid[0].split()[1]
44 self.assertTrue(btrfs_uuid is not None)
45+ self.assertEqual(len(btrfs_uuid), 36)
46
47 # extract uuid from /dev/disk/by-uuid on /dev/vdd
48 # parsing ls -al output on /dev/disk/by-uuid:
49@@ -138,7 +135,8 @@
50 blkid -o export /dev/vda > blkid_output_vda
51 blkid -o export /dev/vda1 > blkid_output_vda1
52 blkid -o export /dev/vda2 > blkid_output_vda2
53- btrfs-show /dev/vdd > btrfs_show_super_vdd
54+ f="btrfs_uuid_vdd"
55+ btrfs-show /dev/vdd | awk '/uuid/ {print $4}' > $f
56 cat /proc/partitions > proc_partitions
57 ls -al /dev/disk/by-uuid/ > ls_uuid
58 cat /etc/fstab > fstab
59@@ -154,15 +152,11 @@
60
61 def test_whole_disk_format(self):
62 # confirm the whole disk format is the expected device
63- btrfs_show_super = self.load_collect_file("btrfs_show_super_vdd")
64+ btrfs_uuid = self.load_collect_file("btrfs_uuid_vdd").strip()
65 ls_uuid = self.load_collect_file("ls_uuid")
66
67- # extract uuid from btrfs superblock
68- btrfs_fsid = re.findall('.*uuid:\ (.*)\n', btrfs_show_super)
69-
70- self.assertEqual(len(btrfs_fsid), 1)
71- btrfs_uuid = btrfs_fsid.pop()
72 self.assertTrue(btrfs_uuid is not None)
73+ self.assertEqual(len(btrfs_uuid), 36)
74
75 # extract uuid from /dev/disk/by-uuid on /dev/vdd
76 # parsing ls -al output on /dev/disk/by-uuid:
77@@ -233,7 +227,8 @@
78 blkid -o export /dev/sda > blkid_output_sda
79 blkid -o export /dev/sda1 > blkid_output_sda1
80 blkid -o export /dev/sda2 > blkid_output_sda2
81- btrfs-show-super /dev/sdc > btrfs_show_super_sdc
82+ f="btrfs_uuid_sdc"
83+ btrfs-debug-tree -r /dev/sdc | awk '/^uuid/ {print $2}' | grep "-" > $f
84 cat /proc/partitions > proc_partitions
85 ls -al /dev/disk/by-uuid/ > ls_uuid
86 ls -al /dev/disk/by-id/ > ls_disk_id
87@@ -251,7 +246,7 @@
88 def test_output_files_exist(self):
89 self.output_files_exist(
90 ["blkid_output_sda", "blkid_output_sda1", "blkid_output_sda2",
91- "btrfs_show_super_sdc", "fstab", "ls_dname", "ls_uuid",
92+ "btrfs_uuid_sdc", "fstab", "ls_dname", "ls_uuid",
93 "ls_disk_id", "proc_partitions"])
94
95 def test_ptable(self):
96@@ -304,15 +299,12 @@
97
98 def test_whole_disk_format(self):
99 # confirm the whole disk format is the expected device
100- btrfs_show_super = self.load_collect_file("btrfs_show_super_sdc")
101+ btrfs_uuid = self.load_collect_file("btrfs_uuid_sdc").strip()
102 ls_uuid = self.load_collect_file("ls_uuid")
103
104 # extract uuid from btrfs superblock
105- btrfs_fsid = [line for line in btrfs_show_super.split('\n')
106- if line.startswith('fsid\t\t')]
107- self.assertEqual(len(btrfs_fsid), 1)
108- btrfs_uuid = btrfs_fsid[0].split()[1]
109 self.assertTrue(btrfs_uuid is not None)
110+ self.assertEqual(len(btrfs_uuid), 36)
111
112 # extract uuid from /dev/disk/by-uuid on /dev/sdc
113 # parsing ls -al output on /dev/disk/by-uuid:
114
115=== modified file 'tests/vmtests/test_nvme.py'
116--- tests/vmtests/test_nvme.py 2017-02-01 20:32:13 +0000
117+++ tests/vmtests/test_nvme.py 2017-02-22 01:42:33 +0000
118@@ -25,7 +25,6 @@
119 blkid -o export /dev/vda > blkid_output_vda
120 blkid -o export /dev/vda1 > blkid_output_vda1
121 blkid -o export /dev/vda2 > blkid_output_vda2
122- btrfs-show-super /dev/vdd > btrfs_show_super_vdd
123 cat /proc/partitions > proc_partitions
124 ls -al /dev/disk/by-uuid/ > ls_uuid
125 cat /etc/fstab > fstab

Subscribers

People subscribed via source and target branches